You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/06/20 15:20:33 UTC

svn commit: r1686613 - in /directory/studio/trunk/plugins: common.ui/src/main/java/org/apache/directory/studio/common/ui/ openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/

Author: elecharny
Date: Sat Jun 20 13:20:32 2015
New Revision: 1686613

URL: http://svn.apache.org/r1686613
Log:
o Created some utility methods to declare Text easily.
o Used those methods in th Tuning page
o Fixed some wrong labels

Modified:
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java (original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java Sat Jun 20 13:20:32 2015
@@ -23,7 +23,13 @@ package org.apache.directory.studio.comm
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.osgi.framework.Bundle;
 
 
@@ -132,4 +138,83 @@ public class CommonUIUtils
         Bundle bundle = Platform.getBundle( "org.apache.directory.studio.rcp" );
         return bundle == null;
     }
+    
+    
+    /**
+     * Create a default Text input, with a label and a ModifyListener.
+     * 
+     * @param toolkit the toolkit
+     * @param composite the Composite
+     * @param label the Text label
+     * @param value the default value. Default to "" if null
+     * @param limit the size limit. Ignored if < 0 
+     * @param listener the ModifyListener
+     * @return An instance of a Text
+     */
+    public static Text createText( FormToolkit toolkit, Composite composite, String label, String defaultValue, int limit, ModifyListener listener  )
+    {
+        toolkit.createLabel( composite, label );
+        String value = "";
+        
+        if ( defaultValue != null )
+        {
+            value = defaultValue;
+        }
+        
+        Text text = toolkit.createText( composite, value );
+        text.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        
+        if ( limit >= 0 )
+        {
+            text.setTextLimit( limit );
+        }
+        
+        // Attach a listener to check the value
+        if ( listener != null )
+        {
+            text.addModifyListener( listener );
+        }
+        
+        return text;
+    }
+    
+    
+    /**
+     * Create a default Text input, with a label and a ModifyListener.
+     * 
+     * @param toolkit the toolkit
+     * @param composite the Composite
+     * @param label the Text label
+     * @param value the default value. Default to "" if null
+     * @param limit the size limit. Ignored if < 0 
+     * @param gridData the GridData
+     * @param listener the ModifyListener
+     * @return An instance of a Text
+     */
+    public static Text createText( FormToolkit toolkit, Composite composite, String label, String defaultValue, int limit, GridData gridData, ModifyListener listener  )
+    {
+        toolkit.createLabel( composite, label );
+        String value = "";
+        
+        if ( defaultValue != null )
+        {
+            value = defaultValue;
+        }
+        
+        Text text = toolkit.createText( composite, value );
+        text.setLayoutData( gridData );
+        
+        if ( limit >= 0 )
+        {
+            text.setTextLimit( limit );
+        }
+        
+        // Attach a listener to check the value
+        if ( listener != null )
+        {
+            text.addModifyListener( listener );
+        }
+        
+        return text;
+    }
 }

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/DatabasesPage.java Sat Jun 20 13:20:32 2015
@@ -41,7 +41,7 @@ public class DatabasesPage extends OpenL
     public static final String ID = DatabasesPage.class.getName(); //$NON-NLS-1$
 
     /** The Page Title */
-    private static final String TITLE = Messages.getString( "DatabasesPage.Title" ); //$NON-NLS-1$
+    private static final String TITLE = Messages.getString( "OpenLDAPDatabasesPage.Title" ); //$NON-NLS-1$
 
     /** The master details block */
     private DatabasesMasterDetailsBlock masterDetailsBlock;

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java Sat Jun 20 13:20:32 2015
@@ -22,7 +22,6 @@ package org.apache.directory.studio.open
 
 import java.util.List;
 
-import org.apache.directory.studio.openldap.config.editor.Messages;
 import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
 import org.apache.directory.studio.openldap.config.model.OlcGlobal;
 import org.eclipse.swt.SWT;
@@ -95,7 +94,7 @@ public class OptionsPage extends OpenLDA
     public static final String ID = OptionsPage.class.getName(); //$NON-NLS-1$
 
     /** The Page Title */
-    private static final String TITLE = Messages.getString( "OptionsPage.Title" );
+    private static final String TITLE = Messages.getString( "OpenLDAPOptionsPage.Title" );
 
     // UI Controls
     /** The olcPluginLogFile parameter */

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java Sat Jun 20 13:20:32 2015
@@ -41,6 +41,7 @@ import org.eclipse.ui.forms.widgets.Form
 import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.forms.widgets.TableWrapData;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.apache.directory.studio.common.ui.CommonUIUtils;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.common.ui.widgets.TableWidget;
 import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
@@ -48,7 +49,6 @@ import org.apache.directory.studio.commo
 import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
 import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
 import org.apache.directory.studio.openldap.config.editor.dialogs.SizeLimitDialog;
-import org.apache.directory.studio.openldap.config.editor.dialogs.TcpBufferDialog;
 import org.apache.directory.studio.openldap.config.editor.dialogs.TimeLimitDialog;
 import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferWrapper;
@@ -929,58 +929,28 @@ public class TuningPage extends OpenLDAP
         Composite concurrencySectionComposite = createSectionComposite( toolkit, section, 2, false );
 
         // The olcConcurrency parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.Concurrency" ) ); //$NON-NLS-1$
-        concurrencyText = toolkit.createText( concurrencySectionComposite, "" );
-        concurrencyText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        concurrencyText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        concurrencyText.addModifyListener( concurrencyTextListener );
+        concurrencyText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.Concurrency" ), "", 5, concurrencyTextListener );
 
         // The olcConnMaxPending parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.ConnMaxPending" ) ); //$NON-NLS-1$
-        connMaxPendingText = toolkit.createText( concurrencySectionComposite, "" );
-        connMaxPendingText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        connMaxPendingText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        connMaxPendingText.addModifyListener( connMaxPendingTextListener );
+        connMaxPendingText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.ConnMaxPending" ), "", 5, connMaxPendingTextListener );
 
         // The olcConnMaxPendingAuth parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.ConnMaxPendingAuth" ) ); //$NON-NLS-1$
-        connMaxPendingAuthText = toolkit.createText( concurrencySectionComposite, "" );
-        connMaxPendingAuthText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        connMaxPendingAuthText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        connMaxPendingAuthText.addModifyListener( connMaxPendingAuthTextListener );
+        connMaxPendingAuthText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.ConnMaxPendingAuth" ), "", 5, connMaxPendingAuthTextListener );
 
         // The olcListenerThreads parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.ListenerThreads" ) ); //$NON-NLS-1$
-        listenerThreadsText = toolkit.createText( concurrencySectionComposite, "" );
-        listenerThreadsText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        listenerThreadsText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        listenerThreadsText.addModifyListener( listenerThreadsTextListener );
+        listenerThreadsText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.ListenerThreads" ), "", 5, listenerThreadsTextListener );
 
         // The olcThreads parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.Threads" ) ); //$NON-NLS-1$
-        threadsText = toolkit.createText( concurrencySectionComposite, "" );
-        threadsText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        threadsText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        threadsText.addModifyListener( threadsTextListener );
+        threadsText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.Threads" ), "", 5, threadsTextListener );
 
         // The olcToolThreads parameter.
-        toolkit.createLabel( concurrencySectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.ToolThreads" ) ); //$NON-NLS-1$
-        toolThreadsText = toolkit.createText( concurrencySectionComposite, "" );
-        toolThreadsText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        toolThreadsText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        toolThreadsText.addModifyListener( toolThreadsTextListener );
+        toolThreadsText = CommonUIUtils.createText( toolkit, concurrencySectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.ToolThreads" ), "", 5, toolThreadsTextListener );
     }
 
     
@@ -1104,49 +1074,24 @@ public class TuningPage extends OpenLDAP
         Composite indexLimitSectionComposite = createSectionComposite( toolkit, section, 2, false );
 
         // The olcIndexIntLen parameter.
-        toolkit.createLabel( indexLimitSectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.IndexIntLen" ) ); //$NON-NLS-1$
-        indexIntLenText = toolkit.createText( indexLimitSectionComposite, "" );
-        indexIntLenText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        indexIntLenText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        indexIntLenText.addModifyListener( indexIntLenTextListener );
+        indexIntLenText = CommonUIUtils.createText( toolkit, indexLimitSectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.IndexIntLen" ), "", 5, indexIntLenTextListener );
 
         // The olcIndexSubstrAnyLen parameter.
-        toolkit.createLabel( indexLimitSectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.IndexSubstrAnyLen" ) ); //$NON-NLS-1$
-        indexSubstrAnyLenText = toolkit.createText( indexLimitSectionComposite, "" );
-        indexSubstrAnyLenText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        indexSubstrAnyLenText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        indexSubstrAnyLenText.addModifyListener( indexSubstrAnyLenTextListener );
+        indexSubstrAnyLenText = CommonUIUtils.createText( toolkit, indexLimitSectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.IndexSubstrAnyLen" ), "", 5, indexSubstrAnyLenTextListener );
 
-        // The olcIndexIntLen parameter.
-        toolkit.createLabel( indexLimitSectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.IndexSubstrAnyStep" ) ); //$NON-NLS-1$
-        indexSubstrAnyStepText = toolkit.createText( indexLimitSectionComposite, "" );
-        indexSubstrAnyStepText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        indexSubstrAnyStepText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        indexSubstrAnyStepText.addModifyListener( indexSubstrAnyStepTextListener );
+        // The olcIndexSubstrAnyStep parameter.
+        indexSubstrAnyStepText = CommonUIUtils.createText( toolkit, indexLimitSectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.IndexSubstrAnyStep" ), "", 5, indexSubstrAnyStepTextListener );
 
         // The olcIndexSubstrIfMaxLen parameter.
-        toolkit.createLabel( indexLimitSectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.IndexSubstrIfMaxLen" ) ); //$NON-NLS-1$
-        indexSubstrIfMaxLenText = toolkit.createText( indexLimitSectionComposite, "" );
-        indexSubstrIfMaxLenText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        indexSubstrIfMaxLenText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        indexSubstrIfMaxLenText.addModifyListener( indexSubstrIfMaxLenTextListener );
+        indexSubstrIfMaxLenText = CommonUIUtils.createText( toolkit, indexLimitSectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.IndexSubstrIfMaxLen" ), "", 5, indexSubstrIfMaxLenTextListener );
 
         // The olcIndexSubstrIfMinLen parameter.
-        toolkit.createLabel( indexLimitSectionComposite, 
-            Messages.getString( "OpenLDAPTuningPage.IndexSubstrIfMinLen" ) ); //$NON-NLS-1$
-        indexSubstrIfMinLenText = toolkit.createText( indexLimitSectionComposite, "" );
-        indexSubstrIfMinLenText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        indexSubstrIfMinLenText.setTextLimit( 5 );
-        // Attach a listener to check the value
-        indexSubstrIfMinLenText.addModifyListener( indexSubstrIfMinLenTextListener );
+        indexSubstrIfMinLenText = CommonUIUtils.createText( toolkit, indexLimitSectionComposite, 
+            Messages.getString( "OpenLDAPTuningPage.IndexSubstrIfMinLen" ), "", 5, indexSubstrIfMinLenTextListener );
     }
     
     

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties Sat Jun 20 13:20:32 2015
@@ -141,11 +141,11 @@ OpenLDAPSecurityPage.EditLogLevels=Edit
 #---------------------------------------------------------------------------------------
 # The Option page
 #---------------------------------------------------------------------------------------
-OptionsPage.Title=Options
+OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.LogTitle=Logs
+OpenLDAPOptionsPage.LogTitle=Logs
 
 #---------------------------------------------------------------------------------------
 # The Database page
 #---------------------------------------------------------------------------------------
-DatabasesPage.Title=Databases
+OpenLDAPDatabasesPage.Title=Databases

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties Sat Jun 20 13:20:32 2015
@@ -141,11 +141,11 @@ OpenLDAPSecurityPage.EditLogLevels=Edit
 #---------------------------------------------------------------------------------------
 # The Option page
 #---------------------------------------------------------------------------------------
-OptionsPage.Title=Options
+OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.LogTitle=Logs
+OpenLDAPOptionsPage.LogTitle=Logs
 
 #---------------------------------------------------------------------------------------
 # The Database page
 #---------------------------------------------------------------------------------------
-DatabasesPage.Title=Databases
+OpenLDAPDatabasesPage.Title=Databases

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties?rev=1686613&r1=1686612&r2=1686613&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties Sat Jun 20 13:20:32 2015
@@ -141,11 +141,11 @@ OpenLDAPSecurityPage.EditLogLevels=Editi
 #---------------------------------------------------------------------------------------
 # The Option page
 #---------------------------------------------------------------------------------------
-OptionsPage.Title=Options
+OpenLDAPOptionsPage.Title=Options
 
-OptionsPage.LogTitle=Logs
+OpenLDAPOptionsPage.LogTitle=Logs
 
 #---------------------------------------------------------------------------------------
 # The Database page
 #---------------------------------------------------------------------------------------
-DatabasesPage.Title=Bases de donn\u00E9es
+OpenLDAPDatabasesPage.Title=Bases de donn\u00E9es