directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1032622 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/
Date Mon, 08 Nov 2010 16:17:54 GMT
Author: pamarcelot
Date: Mon Nov  8 16:17:54 2010
New Revision: 1032622

URL: http://svn.apache.org/viewvc?rev=1032622&view=rev
Log:
Renamed LDAP/LDAPS page.
Added UI for LDAP/LDAPS page.
Changed the layout to a TableWrapLayout.

Added:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
      - copied, changed from r1031681, directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapServerPage.java
Removed:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/AuthenticationPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapServerPage.java
Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java

Copied: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
(from r1031681, directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapServerPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java?p2=directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java&p1=directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapServerPage.java&r1=1031681&r2=1032622&rev=1032622&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapServerPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
Mon Nov  8 16:17:54 2010
@@ -20,9 +20,21 @@
 package org.apache.directory.studio.apacheds.configuration.v2.editor;
 
 
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.editor.FormEditor;
 import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 
 /**
@@ -30,13 +42,26 @@ import org.eclipse.ui.forms.widgets.Form
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapServerPage extends ServerConfigurationEditorPage
+public class LdapLdapsServersPage extends ServerConfigurationEditorPage
 {
     /** The Page ID*/
-    public static final String ID = LdapServerPage.class.getName(); //$NON-NLS-1$
+    public static final String ID = LdapLdapsServersPage.class.getName(); //$NON-NLS-1$
 
     /** The Page Title */
-    private static final String TITLE = "LDAP/LDAPS Server";
+    private static final String TITLE = "LDAP/LDAPS Servers";
+
+    // UI Fields
+    private Button enableLdapCheckbox;
+    private Text ldapPortText;
+    private Button enableLdapsCheckbox;
+    private Text ldapsPortText;
+    private CheckboxTableViewer supportedMechanismsTableViewer;
+    private Button editSupportedMechanismButton;
+    private Button selectAllSupportedMechanismsButton;
+    private Button deselectAllSupportedMechanismsButton;
+    private Text saslHostText;
+    private Text saslPrincipalText;
+    private Text saslSearchBaseDnText;
 
 
     /**
@@ -45,7 +70,7 @@ public class LdapServerPage extends Serv
      * @param editor
      *      the associated editor
      */
-    public LdapServerPage( FormEditor editor )
+    public LdapLdapsServersPage( FormEditor editor )
     {
         super( editor, ID, TITLE );
     }
@@ -56,5 +81,172 @@ public class LdapServerPage extends Serv
      */
     protected void createFormContent( Composite parent, FormToolkit toolkit )
     {
+        TableWrapLayout twl = new TableWrapLayout();
+        twl.numColumns = 2;
+        parent.setLayout( twl );
+
+        Composite leftComposite = toolkit.createComposite( parent );
+        leftComposite.setLayout( new GridLayout() );
+        TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
+        leftCompositeTableWrapData.grabHorizontal = true;
+        leftComposite.setLayoutData( leftCompositeTableWrapData );
+
+        Composite rightComposite = toolkit.createComposite( parent );
+        rightComposite.setLayout( new GridLayout() );
+        TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
+        rightCompositeTableWrapData.grabHorizontal = true;
+        rightComposite.setLayoutData( rightCompositeTableWrapData );
+
+        createLdapServerSection( toolkit, leftComposite );
+        createLdapsServerSection( toolkit, leftComposite );
+        createSupportedAuthenticationMechanismsSection( toolkit, rightComposite );
+        createSaslSettingsSection( toolkit, rightComposite );
+
+        initUI();
+    }
+
+
+    private void createLdapServerSection( FormToolkit toolkit, Composite parent )
+    {
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( "LDAP Server" );
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite composite = toolkit.createComposite( section );
+        toolkit.paintBordersFor( composite );
+        GridLayout gridLayout = new GridLayout( 4, false );
+        gridLayout.marginHeight = gridLayout.marginWidth = 0;
+        composite.setLayout( gridLayout );
+        section.setClient( composite );
+
+        enableLdapCheckbox = toolkit.createButton( composite, "Enable LDAP Server", SWT.CHECK
);
+        enableLdapCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
gridLayout.numColumns, 1 ) );
+        toolkit.createLabel( composite, TABULATION );
+        toolkit.createLabel( composite, "Port:" );
+        ldapPortText = createPortText( toolkit, composite );
+        createDefaultValueLabel( toolkit, composite, "10389" );
+    }
+
+
+    private void createLdapsServerSection( FormToolkit toolkit, Composite parent )
+    {
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( "LDAPS Server" );
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite composite = toolkit.createComposite( section );
+        toolkit.paintBordersFor( composite );
+        GridLayout gridLayout = new GridLayout( 4, false );
+        gridLayout.marginHeight = gridLayout.marginWidth = 0;
+        composite.setLayout( gridLayout );
+        section.setClient( composite );
+
+        enableLdapsCheckbox = toolkit.createButton( composite, "Enable LDAPS Server", SWT.CHECK
);
+        enableLdapsCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
gridLayout.numColumns, 1 ) );
+        toolkit.createLabel( composite, TABULATION );
+        toolkit.createLabel( composite, "Port:" );
+        ldapsPortText = createPortText( toolkit, composite );
+        createDefaultValueLabel( toolkit, composite, "10636" );
+    }
+
+
+    /**
+     * Creates the Supported Authentication Mechanisms Section
+     *
+     * @param toolkit
+     *      the toolkit to use
+     * @param parent
+     *      the parent composite
+     */
+    private void createSupportedAuthenticationMechanismsSection( FormToolkit toolkit, Composite
parent )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( "Supported Authentication Mechanisms" );
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite composite = toolkit.createComposite( section );
+        toolkit.paintBordersFor( composite );
+        GridLayout glayout = new GridLayout( 2, false );
+        composite.setLayout( glayout );
+        section.setClient( composite );
+
+        // Supported Authentication Mechanisms Table
+        Table supportedMechanismsTable = toolkit.createTable( composite, SWT.CHECK );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
+        gd.heightHint = 110;
+        supportedMechanismsTable.setLayoutData( gd );
+        supportedMechanismsTableViewer = new CheckboxTableViewer( supportedMechanismsTable
);
+        supportedMechanismsTableViewer.setContentProvider( new ArrayContentProvider() );
+        supportedMechanismsTableViewer.setInput( new String[]
+            { "Simple", "CRAM-MD5", "DIGEST-MD5", "GSSAPI", "NTLM", "GSS_SPNEGO" } );
+
+        // Edit Button
+        editSupportedMechanismButton = toolkit.createButton( composite, "Edit", SWT.PUSH
);
+        editSupportedMechanismButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING,
false, false ) );
+        editSupportedMechanismButton.setEnabled( false );
+
+        // Select All Button
+        selectAllSupportedMechanismsButton = toolkit.createButton( composite, "Select All",
SWT.PUSH );
+        selectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING,
false, false ) );
+
+        // Deselect All Button
+        deselectAllSupportedMechanismsButton = toolkit.createButton( composite, "Deselect
All", SWT.PUSH );
+        deselectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING,
false, false ) );
+    }
+
+
+    /**
+     * Creates the SASL Settings Section
+     *
+     * @param toolkit
+     *      the toolkit to use
+     * @param parent
+     *      the parent composite
+     */
+    private void createSaslSettingsSection( FormToolkit toolkit, Composite parent )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( "SASL Settings" );
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite composite = toolkit.createComposite( section );
+        toolkit.paintBordersFor( composite );
+        GridLayout glayout = new GridLayout( 2, false );
+        composite.setLayout( glayout );
+        section.setClient( composite );
+
+        // SASL Host
+        toolkit.createLabel( composite, "SASL Host:" );
+        saslHostText = toolkit.createText( composite, "" );
+        saslHostText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label defaultSaslHostLabel = createDefaultValueLabel( toolkit, composite, "ldap.example.com"
);
+        defaultSaslHostLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
2, 1 ) );
+
+        // SASL Principal
+        toolkit.createLabel( composite, "SASL Principal:" );
+        saslPrincipalText = toolkit.createText( composite, "" ); //$NON-NLS-1$
+        saslPrincipalText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false )
);
+        Label defaultSaslPrincipalLabel = createDefaultValueLabel( toolkit, composite,
+            "ldap/ldap.example.com@EXAMPLE.COM" );
+        defaultSaslPrincipalLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
+
+        // Search Base DN
+        toolkit.createLabel( composite, "Search Base DN:" );
+        saslSearchBaseDnText = toolkit.createText( composite, "" ); //$NON-NLS-1$
+        saslSearchBaseDnText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false
) );
+        Label defaultSaslSearchBaseDnLabel = createDefaultValueLabel( toolkit, composite,
"ou=users,dc=example,dc=com" );
+        defaultSaslSearchBaseDnLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
+    }
+
+
+    private void initUI()
+    {
+        enableLdapCheckbox.setSelection( true );
+        ldapPortText.setText( "10389" );
+
+        enableLdapsCheckbox.setSelection( true );
+        ldapsPortText.setText( "10636" );
+
+        saslHostText.setText( "ldap.example.com" );
+        saslPrincipalText.setText( "ldap/ldap.example.com@EXAMPLE.COM" );
+        saslSearchBaseDnText.setText( "ou=users,dc=example,dc=com" );
     }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java?rev=1032622&r1=1032621&r2=1032622&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
Mon Nov  8 16:17:54 2010
@@ -29,9 +29,6 @@ import org.eclipse.jface.viewers.ArrayCo
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -44,6 +41,8 @@ import org.eclipse.ui.forms.editor.FormE
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Hyperlink;
 import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 
 /**
@@ -53,9 +52,6 @@ import org.eclipse.ui.forms.widgets.Sect
  */
 public class OverviewPage extends ServerConfigurationEditorPage
 {
-    private static final Color GRAY_COLOR = new Color( null, 120, 120, 120 );
-    private static final String TABULATION = "      ";
-
     /** The Page ID*/
     public static final String ID = OverviewPage.class.getName(); //$NON-NLS-1$
 
@@ -98,18 +94,26 @@ public class OverviewPage extends Server
      */
     protected void createFormContent( Composite parent, FormToolkit toolkit )
     {
-        Composite composite = toolkit.createComposite( parent );
-        GridLayout layout = new GridLayout();
-        layout.numColumns = 2;
-        layout.makeColumnsEqualWidth = true;
-        composite.setLayout( layout );
-        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
-        composite.setLayoutData( gridData );
-
-        createLdapServerSection( toolkit, composite );
-        createKerberosServerSection( toolkit, composite );
-        createPartitionsSection( toolkit, composite );
-        createOptionsSection( toolkit, composite );
+        TableWrapLayout twl = new TableWrapLayout();
+        twl.numColumns = 2;
+        parent.setLayout( twl );
+
+        Composite leftComposite = toolkit.createComposite( parent );
+        leftComposite.setLayout( new GridLayout() );
+        TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
+        leftCompositeTableWrapData.grabHorizontal = true;
+        leftComposite.setLayoutData( leftCompositeTableWrapData );
+
+        Composite rightComposite = toolkit.createComposite( parent );
+        rightComposite.setLayout( new GridLayout() );
+        TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
+        rightCompositeTableWrapData.grabHorizontal = true;
+        rightComposite.setLayoutData( rightCompositeTableWrapData );
+
+        createLdapServerSection( toolkit, leftComposite );
+        createPartitionsSection( toolkit, leftComposite );
+        createKerberosServerSection( toolkit, rightComposite );
+        createOptionsSection( toolkit, rightComposite );
 
         initUI();
     }
@@ -132,16 +136,14 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         ldapPortText = createPortText( toolkit, composite );
-        Label defaultLdapPortLabel = toolkit.createLabel( composite, "(Default: 10389)" );
-        defaultLdapPortLabel.setForeground( GRAY_COLOR );
+        createDefaultValueLabel( toolkit, composite, "10389" );
 
         enableLdapsCheckbox = toolkit.createButton( composite, "Enable LDAPS Server", SWT.CHECK
);
         enableLdapsCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
gridLayout.numColumns, 1 ) );
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         ldapsPortText = createPortText( toolkit, composite );
-        Label defaultLdapsPortLabel = toolkit.createLabel( composite, "(Default: 10636)"
);
-        defaultLdapsPortLabel.setForeground( GRAY_COLOR );
+        createDefaultValueLabel( toolkit, composite, "10636" );
 
         openLdapConfigurationLink = toolkit.createHyperlink( composite,
             "Advanced LDAP/LDAPS configuration...", SWT.NONE );
@@ -168,8 +170,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         kerberosPortText = createPortText( toolkit, composite );
-        Label defaultKerberosPortLabel = toolkit.createLabel( composite, "(Default: 60088)"
);
-        defaultKerberosPortLabel.setForeground( GRAY_COLOR );
+        createDefaultValueLabel( toolkit, composite, "60088" );
 
         enableChangePasswordCheckbox = toolkit.createButton( composite, "Enable Kerberos
Change Password Server",
             SWT.CHECK );
@@ -178,8 +179,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         changePasswordPortText = createPortText( toolkit, composite );
-        Label defaultChangePasswordPortLabel = toolkit.createLabel( composite, "(Default:
60464)" );
-        defaultChangePasswordPortLabel.setForeground( GRAY_COLOR );
+        createDefaultValueLabel( toolkit, composite, "60464" );
 
         openKerberosConfigurationLink = toolkit.createHyperlink( composite,
             "Advanced Kerberos configuration...", SWT.NONE );
@@ -281,36 +281,4 @@ public class OverviewPage extends Server
     {
         // Does Nothing
     }
-
-
-    /**
-     * Creates a Text that can be used to enter a port number.
-     *
-     * @param toolkit
-     *      the toolkit
-     * @param parent
-     *      the parent
-     * @return
-     *      a Text that can be used to enter a port number
-     */
-    private Text createPortText( FormToolkit toolkit, Composite parent )
-    {
-        Text portText = toolkit.createText( parent, "" ); //$NON-NLS-1$
-        GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
-        gd.widthHint = 42;
-        portText.setLayoutData( gd );
-        portText.addVerifyListener( new VerifyListener()
-        {
-            public void verifyText( VerifyEvent e )
-            {
-                if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
-                {
-                    e.doit = false;
-                }
-            }
-        } );
-        portText.setTextLimit( 5 );
-
-        return portText;
-    }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java?rev=1032622&r1=1032621&r2=1032622&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
Mon Nov  8 16:17:54 2010
@@ -62,9 +62,8 @@ public class ServerConfigurationEditor e
         try
         {
             addPage( new OverviewPage( this ) );
-            addPage( new LdapServerPage( this ) );
+            addPage( new LdapLdapsServersPage( this ) );
             addPage( new KerberosServerPage( this ) );
-            addPage( new AuthenticationPage( this ) );
             addPage( new PartitionsPage( this ) );
             addPage( new ReplicationPage( this ) );
         }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java?rev=1032622&r1=1032621&r2=1032622&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
Mon Nov  8 16:17:54 2010
@@ -24,8 +24,16 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.apacheds.configuration.v2.actions.EditorImportConfigurationAction;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.IManagedForm;
 import org.eclipse.ui.forms.editor.FormEditor;
 import org.eclipse.ui.forms.editor.FormPage;
@@ -40,6 +48,10 @@ import org.eclipse.ui.forms.widgets.Scro
  */
 public abstract class ServerConfigurationEditorPage extends FormPage
 {
+    protected static final Color GRAY_COLOR = new Color( null, 120, 120, 120 );
+    protected static final String TABULATION = "      ";
+
+
     /**
      * Creates a new instance of GeneralPage.
      *
@@ -77,4 +89,45 @@ public abstract class ServerConfiguratio
 
 
     protected abstract void createFormContent( Composite parent, FormToolkit toolkit );
+
+
+    /**
+     * Creates a Text that can be used to enter a port number.
+     *
+     * @param toolkit
+     *      the toolkit
+     * @param parent
+     *      the parent
+     * @return
+     *      a Text that can be used to enter a port number
+     */
+    protected Text createPortText( FormToolkit toolkit, Composite parent )
+    {
+        Text portText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+        GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+        gd.widthHint = 42;
+        portText.setLayoutData( gd );
+        portText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        portText.setTextLimit( 5 );
+
+        return portText;
+    }
+
+
+    protected Label createDefaultValueLabel( FormToolkit toolkit, Composite parent, String
text )
+    {
+        Label label = toolkit.createLabel( parent, NLS.bind( "(Default: {0})", text ) );
+        label.setForeground( GRAY_COLOR );
+
+        return label;
+    }
 }



Mime
View raw message