directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r506058 [1/3] - in /directory/ldapstudio/trunk: ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/ ldap...
Date Sun, 11 Feb 2007 16:01:39 GMT
Author: seelmann
Date: Sun Feb 11 08:01:38 2007
New Revision: 506058

URL: http://svn.apache.org/viewvc?view=rev&rev=506058
Log:
Patch for DIRSTUDIO-49: 
- Removed back/forward navigation buttons from schema browser, using main navigation buttons instead. 
- Added combo box to select the connection shown in schema browser
- Code cleaning and Javadoc

Added:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserManager.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserNavigationLocation.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SchemaElementSelectionListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/BackAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ForwardAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/HistoryListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/HistoryManager.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ReloadSchemaAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowser.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserInput.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ShowDefaultSchemaAction.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java Sun Feb 11 08:01:38 2007
@@ -210,141 +210,4 @@
         }
     }
 
-    private static List schemaElementSelectionListenerList = new ArrayList();
-
-
-    public static void addSchemaElementSelectionListener( SchemaElementSelectionListener listener )
-    {
-        if ( !schemaElementSelectionListenerList.contains( listener ) )
-            schemaElementSelectionListenerList.add( listener );
-    }
-
-
-    public static void removeSchemaElementSelectionListener( SchemaElementSelectionListener listener )
-    {
-        if ( schemaElementSelectionListenerList.contains( listener ) )
-            schemaElementSelectionListenerList.remove( listener );
-    }
-
-
-    public static void fireObjectClassDescriptionSelected( final ObjectClassDescription ocd, final Object source )
-    {
-        for ( int i = 0; i < schemaElementSelectionListenerList.size(); i++ )
-        {
-            final SchemaElementSelectionListener listener = ( SchemaElementSelectionListener ) schemaElementSelectionListenerList
-                .get( i );
-            EventRunnable runnable = new EventRunnable()
-            {
-                public Object getEventObject()
-                {
-                    return ocd;
-                }
-
-
-                public void run()
-                {
-                    listener.objectClassDescriptionSelected( ocd );
-                }
-            };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
-        }
-    }
-
-
-    public static void fireAttributeTypeDescriptionSelected( final AttributeTypeDescription atd, final Object source )
-    {
-        for ( int i = 0; i < schemaElementSelectionListenerList.size(); i++ )
-        {
-            final SchemaElementSelectionListener listener = ( SchemaElementSelectionListener ) schemaElementSelectionListenerList
-                .get( i );
-            EventRunnable runnable = new EventRunnable()
-            {
-                public Object getEventObject()
-                {
-                    return atd;
-                }
-
-
-                public void run()
-                {
-                    listener.attributeTypeDescriptionSelected( atd );
-                }
-            };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
-        }
-    }
-
-
-    public static void fireMatchingRuleDescriptionSelected( final MatchingRuleDescription mrd, final Object source )
-    {
-        for ( int i = 0; i < schemaElementSelectionListenerList.size(); i++ )
-        {
-            final SchemaElementSelectionListener listener = ( SchemaElementSelectionListener ) schemaElementSelectionListenerList
-                .get( i );
-            EventRunnable runnable = new EventRunnable()
-            {
-                public Object getEventObject()
-                {
-                    return mrd;
-                }
-
-
-                public void run()
-                {
-                    listener.matchingRuleDescriptionSelected( mrd );
-                }
-            };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
-        }
-    }
-
-
-    public static void fireLdapSyntaxDescriptionSelected( final LdapSyntaxDescription lsd, final Object source )
-    {
-        for ( int i = 0; i < schemaElementSelectionListenerList.size(); i++ )
-        {
-            final SchemaElementSelectionListener listener = ( SchemaElementSelectionListener ) schemaElementSelectionListenerList
-                .get( i );
-            EventRunnable runnable = new EventRunnable()
-            {
-                public Object getEventObject()
-                {
-                    return lsd;
-                }
-
-
-                public void run()
-                {
-                    listener.ldapSyntacDescriptionSelected( lsd );
-                }
-            };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
-        }
-    }
-
-
-    public static void fireMatchingRuleUseDescriptionSelected( final MatchingRuleUseDescription mrud,
-        final Object source )
-    {
-        for ( int i = 0; i < schemaElementSelectionListenerList.size(); i++ )
-        {
-            final SchemaElementSelectionListener listener = ( SchemaElementSelectionListener ) schemaElementSelectionListenerList
-                .get( i );
-            EventRunnable runnable = new EventRunnable()
-            {
-                public Object getEventObject()
-                {
-                    return mrud;
-                }
-
-
-                public void run()
-                {
-                    listener.matchingRuleUseDescriptionSelected( mrud );
-                }
-            };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
-        }
-    }
-
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java Sun Feb 11 08:01:38 2007
@@ -115,4 +115,23 @@
         this.line = line;
     }
 
+    
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof SchemaPart )
+        {
+            return this.getClass() == obj.getClass() && this.toString().equals( obj.toString() );
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    
+    public int hashCode()
+    {
+        return toString().hashCode();
+    }
+    
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java Sun Feb 11 08:01:38 2007
@@ -21,14 +21,14 @@
 package org.apache.directory.ldapstudio.browser.ui.actions;
 
 
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
-import org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser.SchemaBrowser;
-
+import org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser.SchemaBrowserManager;
 import org.eclipse.jface.resource.ImageDescriptor;
 
 
@@ -108,35 +108,35 @@
     {
         if ( mode == MODE_NONE )
         {
-            SchemaBrowser.select( null );
+            SchemaBrowserManager.setInput( getConnection(), null );
         }
         else if ( mode == MODE_OBJECTCLASS )
         {
-            SchemaBrowser.select( getOcd() );
+            SchemaBrowserManager.setInput( getConnection(), getOcd() );
         }
         else if ( mode == MODE_ATTRIBUTETYPE )
         {
-            SchemaBrowser.select( getAtd() );
+            SchemaBrowserManager.setInput( getConnection(), getAtd() );
         }
         else if ( mode == MODE_EQUALITYMATCHINGRULE )
         {
-            SchemaBrowser.select( getEmrd() );
+            SchemaBrowserManager.setInput( getConnection(), getEmrd() );
         }
         else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
         {
-            SchemaBrowser.select( getSmrd() );
+            SchemaBrowserManager.setInput( getConnection(), getSmrd() );
         }
         else if ( mode == MODE_ORDERINGMATCHINGRULE )
         {
-            SchemaBrowser.select( getOmrd() );
+            SchemaBrowserManager.setInput( getConnection(), getOmrd() );
         }
         else if ( mode == MODE_SYNTAX )
         {
-            SchemaBrowser.select( getLsd() );
+            SchemaBrowserManager.setInput( getConnection(), getLsd() );
         }
         else
         {
-            SchemaBrowser.select( null );
+            SchemaBrowserManager.setInput( getConnection(), null );
         }
     }
 
@@ -152,27 +152,27 @@
         }
         else if ( mode == MODE_OBJECTCLASS )
         {
-            return "Object Class Definition";
+            return "Object Class Description";
         }
         else if ( mode == MODE_ATTRIBUTETYPE )
         {
-            return "Attribute Type Definiton";
+            return "Attribute Type Description";
         }
         else if ( mode == MODE_EQUALITYMATCHINGRULE )
         {
-            return "Equality Matching Rule Definiton";
+            return "Equality Matching Rule Description";
         }
         else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
         {
-            return "Substring Matching Rule Definiton";
+            return "Substring Matching Rule Description";
         }
         else if ( mode == MODE_ORDERINGMATCHINGRULE )
         {
-            return "Ordering Matching Rule Definiton";
+            return "Ordering Matching Rule Description";
         }
         else if ( mode == MODE_SYNTAX )
         {
-            return "Syntax Definiton";
+            return "Syntax Description";
         }
         else
         {
@@ -341,6 +341,56 @@
             }
 
             return atd;
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets the connection.
+     *
+     * @return the connection
+     */
+    private IConnection getConnection()
+    {
+        if ( ( getSelectedValues().length + getSelectedAttributes().length ) + getSelectedAttributeHierarchies().length == 1 )
+        {
+            IConnection connection = null;
+            if ( getSelectedValues().length == 1 )
+            {
+                connection = getSelectedValues()[0].getAttribute().getEntry().getConnection();
+            }
+            else if ( getSelectedAttributes().length == 1 )
+            {
+                connection = getSelectedAttributes()[0].getEntry().getConnection();
+            }
+            else if ( getSelectedAttributeHierarchies().length == 1 && getSelectedAttributeHierarchies()[0].size() == 1 )
+            {
+                connection = getSelectedAttributeHierarchies()[0].getAttribute().getEntry().getConnection();
+            }
+
+            return connection;
+        }
+        else if ( getSelectedConnections().length == 1 )
+        {
+            return getSelectedConnections()[0];
+        }
+        else if ( getSelectedEntries().length == 1 )
+        {
+            return getSelectedEntries()[0].getConnection();
+        }
+        else if ( getSelectedSearchResults().length == 1 )
+        {
+            return getSelectedSearchResults()[0].getEntry().getConnection();
+        }
+        else if ( getSelectedBookmarks().length == 1 )
+        {
+            return getSelectedBookmarks()[0].getConnection();
+        }
+        else if ( getSelectedSearches().length == 1 )
+        {
+            return getSelectedSearches()[0].getConnection();
         }
 
         return null;

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java Sun Feb 11 08:01:38 2007
@@ -25,7 +25,6 @@
 import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -34,86 +33,129 @@
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.events.ExpansionAdapter;
 import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Hyperlink;
 import org.eclipse.ui.forms.widgets.ScrolledForm;
 import org.eclipse.ui.forms.widgets.Section;
 
 
+/**
+ * The AttributeTypeDescriptionDetailsPage displays the details of an
+ * attribute type description.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class AttributeTypeDescriptionDetailsPage extends SchemaDetailsPage
 {
 
+    /** The main section, contains oid, names, desc and usage */
     private Section mainSection;
 
+    /** The numeric oid field */
     private Text numericOidText;
 
-    private Text nameText;
+    /** The names field */
+    private Text namesText;
 
+    /** The description field */
     private Text descText;
 
+    /** The usage field */
     private Text usageText;
 
+    /** The flag section, contains sv, obsolete, collective and read-only */
     private Section flagSection;
 
+    /** The single-valued field */
     private Label singleValuedText;
 
+    /** The obsolete field */
     private Label isObsoleteText;
 
+    /** The collective field */
     private Label collectiveText;
 
+    /** The no-user-modification field */
     private Label noUserModificationText;
 
+    /** The syntax section, contains syntax description, lenth and a link to the syntax */ 
     private Section syntaxSection;
 
-    private Text syntaxText;
+    /** The syntax description field */
+    private Text syntaxDescText;
 
+    /** The syntax length field */
     private Text lengthText;
 
+    /** The link to the syntax */
     private Hyperlink syntaxLink;
 
-    private Section matchSection;
+    /** The matching rules section, contains links to matching rules */
+    private Section matchingRulesSection;
 
+    /** The link to the equality matching rule */
     private Hyperlink equalityLink;
 
+    /** The link to the substring matching rule */
     private Hyperlink substringLink;
 
+    /** The link to the ordering matching rule */
     private Hyperlink orderingLink;
 
+    /** The section with other matching rules */
     private Section otherMatchSection;
 
+    /** The links to other matching rules applicaple to the selected attribute */
     private Hyperlink[] otherMatchLinks;
 
-    private Section mustSection;
+    /** The section with links to object classes using the selected attribute as must */
+    private Section usedAsMustSection;
 
+    /** The links to object classes using the selected attribute as must */
     private Hyperlink[] usedAsMustLinks;
 
-    private Section maySection;
+    /** The section with links to object classes using the selected attribute as may */
+    private Section usedAsMaySection;
 
+    /** The links to object classes using the selected attribute as may */
     private Hyperlink[] usedAsMayLinks;
 
-    private Section superSection;
+    /** The section with a link to the superior attribute type */
+    private Section supertypeSection;
 
+    /** The link to the superior attribute type */
     private Hyperlink superLink;
 
-    private Section subSection;
+    /** The section with links to the derived attribute types */
+    private Section subtypesSection;
 
+    /** The links to derived attribute types */
     private Hyperlink[] subAttributeTypeLinks;
 
 
-    public AttributeTypeDescriptionDetailsPage( SchemaBrowser schemaBrowser, FormToolkit toolkit )
+    /**
+     * Creates a new instance of AttributeTypeDescriptionDetailsPage.
+     *
+     * @param schemaPage the master schema page
+     * @param toolkit the toolkit used to create controls
+     */
+    public AttributeTypeDescriptionDetailsPage( SchemaPage schemaPage, FormToolkit toolkit )
     {
-        super( schemaBrowser, toolkit );
+        super( schemaPage, toolkit );
     }
 
 
-    public void createContents( final ScrolledForm detailForm )
+    /**
+     * {@inheritDoc}
+     */
+    protected void createContents( final ScrolledForm detailForm )
     {
 
         this.detailForm = detailForm;
         detailForm.getBody().setLayout( new GridLayout() );
 
+        // create main section
         mainSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
         mainSection.setText( "Details" );
         mainSection.marginWidth = 0;
@@ -121,6 +163,7 @@
         mainSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         toolkit.createCompositeSeparator( mainSection );
 
+        // create flag section
         flagSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
         flagSection.setText( "Flags" );
         flagSection.marginWidth = 0;
@@ -128,6 +171,7 @@
         flagSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         toolkit.createCompositeSeparator( flagSection );
 
+        // create flags content
         Composite flagClient = toolkit.createComposite( flagSection, SWT.WRAP );
         GridLayout flagLayout = new GridLayout();
         flagLayout.numColumns = 4;
@@ -152,6 +196,7 @@
         isObsoleteText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         isObsoleteText.setEnabled( false );
 
+        // create syntax section
         syntaxSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
         syntaxSection.setText( "Syntax" );
         syntaxSection.marginWidth = 0;
@@ -159,6 +204,7 @@
         syntaxSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         toolkit.createCompositeSeparator( syntaxSection );
 
+        // create syntax content
         Composite syntaxClient = toolkit.createComposite( syntaxSection, SWT.WRAP );
         GridLayout syntaxLayout = new GridLayout();
         syntaxLayout.numColumns = 2;
@@ -170,72 +216,51 @@
         toolkit.createLabel( syntaxClient, "Syntax OID:", SWT.NONE );
         syntaxLink = toolkit.createHyperlink( syntaxClient, "", SWT.WRAP );
         syntaxLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        syntaxLink.addHyperlinkListener( new HyperlinkAdapter()
-        {
-            public void linkActivated( HyperlinkEvent e )
-            {
-                SchemaBrowser.select( e.getHref() );
-            }
-        } );
+        syntaxLink.addHyperlinkListener( this );
 
         toolkit.createLabel( syntaxClient, "Syntax Description:", SWT.NONE );
-        syntaxText = toolkit.createText( syntaxClient, "", SWT.NONE );
-        syntaxText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        syntaxText.setEditable( false );
+        syntaxDescText = toolkit.createText( syntaxClient, "", SWT.NONE );
+        syntaxDescText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        syntaxDescText.setEditable( false );
 
         toolkit.createLabel( syntaxClient, "Length:", SWT.NONE );
         lengthText = toolkit.createText( syntaxClient, "", SWT.NONE );
         lengthText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         lengthText.setEditable( false );
 
-        matchSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
-        matchSection.setText( "Matching Rules" );
-        matchSection.marginWidth = 0;
-        matchSection.marginHeight = 0;
-        matchSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        toolkit.createCompositeSeparator( matchSection );
+        // create matching rules section
+        matchingRulesSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
+        matchingRulesSection.setText( "Matching Rules" );
+        matchingRulesSection.marginWidth = 0;
+        matchingRulesSection.marginHeight = 0;
+        matchingRulesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( matchingRulesSection );
 
-        Composite matchClient = toolkit.createComposite( matchSection, SWT.WRAP );
+        // create matching rules content
+        Composite matchClient = toolkit.createComposite( matchingRulesSection, SWT.WRAP );
         GridLayout matchLayout = new GridLayout();
         matchLayout.numColumns = 2;
         matchLayout.marginWidth = 0;
         matchLayout.marginHeight = 0;
         matchClient.setLayout( matchLayout );
-        matchSection.setClient( matchClient );
+        matchingRulesSection.setClient( matchClient );
 
         toolkit.createLabel( matchClient, "Equality match:", SWT.NONE );
         equalityLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP );
         equalityLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        equalityLink.addHyperlinkListener( new HyperlinkAdapter()
-        {
-            public void linkActivated( HyperlinkEvent e )
-            {
-                SchemaBrowser.select( e.getHref() );
-            }
-        } );
+        equalityLink.addHyperlinkListener( this );
 
         toolkit.createLabel( matchClient, "Substring match:", SWT.NONE );
         substringLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP );
         substringLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        substringLink.addHyperlinkListener( new HyperlinkAdapter()
-        {
-            public void linkActivated( HyperlinkEvent e )
-            {
-                SchemaBrowser.select( e.getHref() );
-            }
-        } );
+        substringLink.addHyperlinkListener( this );
 
         toolkit.createLabel( matchClient, "Ordering match:", SWT.NONE );
         orderingLink = toolkit.createHyperlink( matchClient, "", SWT.WRAP );
         orderingLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        orderingLink.addHyperlinkListener( new HyperlinkAdapter()
-        {
-            public void linkActivated( HyperlinkEvent e )
-            {
-                SchemaBrowser.select( e.getHref() );
-            }
-        } );
+        orderingLink.addHyperlinkListener( this );
 
+        // create other matching rules section
         otherMatchSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
         otherMatchSection.setText( "Other Matching Rules" );
         otherMatchSection.marginWidth = 0;
@@ -250,13 +275,14 @@
             }
         } );
 
-        mustSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
-        mustSection.setText( "Used as MUST" );
-        mustSection.marginWidth = 0;
-        mustSection.marginHeight = 0;
-        mustSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        toolkit.createCompositeSeparator( mustSection );
-        mustSection.addExpansionListener( new ExpansionAdapter()
+        // create used as must section
+        usedAsMustSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        usedAsMustSection.setText( "Used as MUST" );
+        usedAsMustSection.marginWidth = 0;
+        usedAsMustSection.marginHeight = 0;
+        usedAsMustSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( usedAsMustSection );
+        usedAsMustSection.addExpansionListener( new ExpansionAdapter()
         {
             public void expansionStateChanged( ExpansionEvent e )
             {
@@ -264,13 +290,14 @@
             }
         } );
 
-        maySection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
-        maySection.setText( "Used as MAY" );
-        maySection.marginWidth = 0;
-        maySection.marginHeight = 0;
-        maySection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        toolkit.createCompositeSeparator( maySection );
-        maySection.addExpansionListener( new ExpansionAdapter()
+        // create used as may section
+        usedAsMaySection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        usedAsMaySection.setText( "Used as MAY" );
+        usedAsMaySection.marginWidth = 0;
+        usedAsMaySection.marginHeight = 0;
+        usedAsMaySection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( usedAsMaySection );
+        usedAsMaySection.addExpansionListener( new ExpansionAdapter()
         {
             public void expansionStateChanged( ExpansionEvent e )
             {
@@ -278,13 +305,14 @@
             }
         } );
 
-        superSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
-        superSection.setText( "Supertypes" );
-        superSection.marginWidth = 0;
-        superSection.marginHeight = 0;
-        superSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        toolkit.createCompositeSeparator( superSection );
-        superSection.addExpansionListener( new ExpansionAdapter()
+        // create supertype section
+        supertypeSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        supertypeSection.setText( "Supertype" );
+        supertypeSection.marginWidth = 0;
+        supertypeSection.marginHeight = 0;
+        supertypeSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( supertypeSection );
+        supertypeSection.addExpansionListener( new ExpansionAdapter()
         {
             public void expansionStateChanged( ExpansionEvent e )
             {
@@ -292,13 +320,14 @@
             }
         } );
 
-        subSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
-        subSection.setText( "Subtypes" );
-        subSection.marginWidth = 0;
-        subSection.marginHeight = 0;
-        subSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        toolkit.createCompositeSeparator( subSection );
-        subSection.addExpansionListener( new ExpansionAdapter()
+        // create subtypes section
+        subtypesSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        subtypesSection.setText( "Subtypes" );
+        subtypesSection.marginWidth = 0;
+        subtypesSection.marginHeight = 0;
+        subtypesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( subtypesSection );
+        subtypesSection.addExpansionListener( new ExpansionAdapter()
         {
             public void expansionStateChanged( ExpansionEvent e )
             {
@@ -306,20 +335,33 @@
             }
         } );
 
-        super.createRawSection();
+        // create raw section
+        createRawSection();
     }
 
 
-    public void attributeTypeDescriptionSelected( AttributeTypeDescription atd )
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( Object input )
     {
-        this.createMainContent( atd );
+        AttributeTypeDescription atd = null;
+        if ( input instanceof AttributeTypeDescription )
+        {
+            atd = ( AttributeTypeDescription ) input;
+        }
+
+        // create main content
+        createMainContent( atd );
 
+        // set flags
         singleValuedText.setEnabled( atd != null && atd.isSingleValued() );
         isObsoleteText.setEnabled( atd != null && atd.isObsolete() );
         collectiveText.setEnabled( atd != null && atd.isCollective() );
         noUserModificationText.setEnabled( atd != null && atd.isNoUserModification() );
         flagSection.layout();
 
+        // set syntax content
         String lsdOid = null;
         LdapSyntaxDescription lsd = null;
         String lsdLength = null;
@@ -336,10 +378,11 @@
         syntaxLink.setHref( lsd );
         syntaxLink.setUnderlined( lsd != null );
         syntaxLink.setEnabled( lsd != null );
-        syntaxText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
+        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
         lengthText.setText( getNonNullString( lsdLength ) );
         syntaxSection.layout();
 
+        // set matching rules content
         String emrOid = null;
         MatchingRuleDescription emr = null;
         if ( atd != null )
@@ -384,45 +427,53 @@
         orderingLink.setHref( omr );
         orderingLink.setUnderlined( omr != null );
         orderingLink.setEnabled( omr != null );
-        matchSection.layout();
+        matchingRulesSection.layout();
 
-        this.createOtherMatchContent( atd );
-        this.createMustContent( atd );
-        this.createMayContent( atd );
-        this.createSuperContent( atd );
-        this.createSubContent( atd );
-
-        super.createRawContents( atd );
+        // create contents of dynamic sections
+        createOtherMatchContent( atd );
+        createUsedAsMustContent( atd );
+        createUsedAsMayContent( atd );
+        createSupertypeContent( atd );
+        createSubtypesContent( atd );
+        createRawContents( atd );
 
         detailForm.reflow( true );
     }
 
 
+    /**
+     * Creates the content of the main section. It is newly created
+     * on every input change to ensure a proper layout of 
+     * multilined descriptions. 
+     *
+     * @param atd the attribute type description
+     */
     private void createMainContent( AttributeTypeDescription atd )
     {
-
+        // dispose old content
         if ( mainSection.getClient() != null )
         {
             mainSection.getClient().dispose();
         }
 
+        // create new client
         Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
         GridLayout mainLayout = new GridLayout( 2, false );
         mainClient.setLayout( mainLayout );
         mainSection.setClient( mainClient );
 
+        // create new content
         if ( atd != null )
         {
-
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
             numericOidText = toolkit.createText( mainClient, getNonNullString( atd.getNumericOID() ), SWT.NONE );
             numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             numericOidText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Attribute names:", SWT.NONE );
-            nameText = toolkit.createText( mainClient, getNonNullString( atd.toString() ), SWT.NONE );
-            nameText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-            nameText.setEditable( false );
+            namesText = toolkit.createText( mainClient, getNonNullString( atd.toString() ), SWT.NONE );
+            namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            namesText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Descripton:", SWT.WRAP );
             descText = toolkit.createText( mainClient, getNonNullString( atd.getDesc() ), SWT.WRAP | SWT.MULTI );
@@ -442,18 +493,28 @@
     }
 
 
+    /**
+     * Creates the content of the other matching rules section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param atd the attribute type description
+     */
     private void createOtherMatchContent( AttributeTypeDescription atd )
     {
-
+        // dispose old content
         if ( otherMatchSection.getClient() != null )
         {
             otherMatchSection.getClient().dispose();
         }
 
+        // create new client
         Composite otherMatchClient = toolkit.createComposite( otherMatchSection, SWT.WRAP );
         otherMatchClient.setLayout( new GridLayout() );
         otherMatchSection.setClient( otherMatchClient );
 
+        // create new content, either links to other matching rules 
+        // or a dash if no other matching rules exist.
         if ( atd != null )
         {
             String[] names = atd.getOtherMatchingRuleDescriptionNames();
@@ -471,13 +532,7 @@
                         otherMatchLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                         otherMatchLinks[i].setUnderlined( true );
                         otherMatchLinks[i].setEnabled( true );
-                        otherMatchLinks[i].addHyperlinkListener( new HyperlinkAdapter()
-                        {
-                            public void linkActivated( HyperlinkEvent e )
-                            {
-                                SchemaBrowser.select( e.getHref() );
-                            }
-                        } );
+                        otherMatchLinks[i].addHyperlinkListener( this );
                     }
                     else
                     {
@@ -503,28 +558,37 @@
         }
 
         otherMatchSection.layout();
-
     }
 
 
-    private void createSuperContent( AttributeTypeDescription atd )
+    /**
+     * Creates the content of the supertype section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param atd the attribute type description
+     */
+    private void createSupertypeContent( AttributeTypeDescription atd )
     {
-
-        if ( superSection.getClient() != null )
+        // dispose old content
+        if ( supertypeSection.getClient() != null )
         {
-            superSection.getClient().dispose();
+            supertypeSection.getClient().dispose();
         }
 
-        Composite superClient = toolkit.createComposite( superSection, SWT.WRAP );
+        // create new client
+        Composite superClient = toolkit.createComposite( supertypeSection, SWT.WRAP );
         superClient.setLayout( new GridLayout() );
-        superSection.setClient( superClient );
+        supertypeSection.setClient( superClient );
 
+        // create new content, either a link to the superior attribute type
+        // or a dash if no supertype exists.
         if ( atd != null )
         {
             String superName = atd.getSuperiorAttributeTypeDescriptionName();
             if ( superName != null )
             {
-                superSection.setText( "Supertype (" + "1" + ")" );
+                supertypeSection.setText( "Supertype (" + "1" + ")" );
                 if ( atd.getSchema().hasAttributeTypeDescription( superName ) )
                 {
                     AttributeTypeDescription supAtd = atd.getSchema().getAttributeTypeDescription( superName );
@@ -533,13 +597,7 @@
                     superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     superLink.setUnderlined( true );
                     superLink.setEnabled( true );
-                    superLink.addHyperlinkListener( new HyperlinkAdapter()
-                    {
-                        public void linkActivated( HyperlinkEvent e )
-                        {
-                            SchemaBrowser.select( e.getHref() );
-                        }
-                    } );
+                    superLink.addHyperlinkListener( this );
                 }
                 else
                 {
@@ -551,7 +609,7 @@
             }
             else
             {
-                superSection.setText( "Supertype (0)" );
+                supertypeSection.setText( "Supertype (0)" );
                 superLink = null;
                 Text supText = toolkit.createText( superClient, getNonNullString( null ), SWT.NONE );
                 supText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
@@ -560,32 +618,40 @@
         }
         else
         {
-            superSection.setText( "Supertype" );
+            supertypeSection.setText( "Supertype" );
         }
 
-        superSection.layout();
-
+        supertypeSection.layout();
     }
 
 
-    private void createSubContent( AttributeTypeDescription atd )
+    /**
+     * Creates the content of the subtypes. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param atd the attribute type description
+     */
+    private void createSubtypesContent( AttributeTypeDescription atd )
     {
-
-        if ( subSection.getClient() != null )
+        // dispose old content
+        if ( subtypesSection.getClient() != null )
         {
-            subSection.getClient().dispose();
+            subtypesSection.getClient().dispose();
         }
 
-        Composite subClient = toolkit.createComposite( subSection, SWT.WRAP );
+        // create new client
+        Composite subClient = toolkit.createComposite( subtypesSection, SWT.WRAP );
         subClient.setLayout( new GridLayout() );
-        subSection.setClient( subClient );
+        subtypesSection.setClient( subClient );
 
+        // create new content, either links to subtypes or a dash if no subtypes exist.
         if ( atd != null )
         {
             AttributeTypeDescription[] subATDs = atd.getDerivedAttributeTypeDescriptions();
             if ( subATDs != null && subATDs.length > 0 )
             {
-                subSection.setText( "Subtypes (" + subATDs.length + ")" );
+                subtypesSection.setText( "Subtypes (" + subATDs.length + ")" );
                 subAttributeTypeLinks = new Hyperlink[subATDs.length];
                 for ( int i = 0; i < subATDs.length; i++ )
                 {
@@ -594,18 +660,12 @@
                     subAttributeTypeLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     subAttributeTypeLinks[i].setUnderlined( true );
                     subAttributeTypeLinks[i].setEnabled( true );
-                    subAttributeTypeLinks[i].addHyperlinkListener( new HyperlinkAdapter()
-                    {
-                        public void linkActivated( HyperlinkEvent e )
-                        {
-                            SchemaBrowser.select( e.getHref() );
-                        }
-                    } );
+                    subAttributeTypeLinks[i].addHyperlinkListener( this );
                 }
             }
             else
             {
-                subSection.setText( "Subtypes (0)" );
+                subtypesSection.setText( "Subtypes (0)" );
                 subAttributeTypeLinks = new Hyperlink[0];
                 Text subText = toolkit.createText( subClient, getNonNullString( null ), SWT.NONE );
                 subText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
@@ -614,32 +674,41 @@
         }
         else
         {
-            subSection.setText( "Subtypes" );
+            subtypesSection.setText( "Subtypes" );
         }
 
-        subSection.layout();
+        subtypesSection.layout();
 
     }
 
 
-    private void createMustContent( AttributeTypeDescription atd )
+    /**
+     * Creates the content of the used as must section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param atd the attribute type description
+     */
+    private void createUsedAsMustContent( AttributeTypeDescription atd )
     {
-
-        if ( mustSection.getClient() != null )
+        // dispose old content
+        if ( usedAsMustSection.getClient() != null )
         {
-            mustSection.getClient().dispose();
+            usedAsMustSection.getClient().dispose();
         }
 
-        Composite mustClient = toolkit.createComposite( mustSection, SWT.WRAP );
+        // create new client
+        Composite mustClient = toolkit.createComposite( usedAsMustSection, SWT.WRAP );
         mustClient.setLayout( new GridLayout() );
-        mustSection.setClient( mustClient );
+        usedAsMustSection.setClient( mustClient );
 
+        // create new content, either links to objectclasses or a dash
         if ( atd != null )
         {
             ObjectClassDescription[] usedAsMusts = atd.getUsedAsMust();
             if ( usedAsMusts != null && usedAsMusts.length > 0 )
             {
-                mustSection.setText( "Used as MUST (" + usedAsMusts.length + ")" );
+                usedAsMustSection.setText( "Used as MUST (" + usedAsMusts.length + ")" );
                 usedAsMustLinks = new Hyperlink[usedAsMusts.length];
                 for ( int i = 0; i < usedAsMusts.length; i++ )
                 {
@@ -648,18 +717,12 @@
                     usedAsMustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     usedAsMustLinks[i].setUnderlined( true );
                     usedAsMustLinks[i].setEnabled( true );
-                    usedAsMustLinks[i].addHyperlinkListener( new HyperlinkAdapter()
-                    {
-                        public void linkActivated( HyperlinkEvent e )
-                        {
-                            SchemaBrowser.select( e.getHref() );
-                        }
-                    } );
+                    usedAsMustLinks[i].addHyperlinkListener( this );
                 }
             }
             else
             {
-                mustSection.setText( "Used as MUST (0)" );
+                usedAsMustSection.setText( "Used as MUST (0)" );
                 usedAsMustLinks = new Hyperlink[0];
                 Text mustText = toolkit.createText( mustClient, getNonNullString( null ), SWT.NONE );
                 mustText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
@@ -668,32 +731,41 @@
         }
         else
         {
-            mustSection.setText( "Used as MUST" );
+            usedAsMustSection.setText( "Used as MUST" );
         }
 
-        mustSection.layout();
+        usedAsMustSection.layout();
 
     }
 
 
-    private void createMayContent( AttributeTypeDescription atd )
+    /**
+     * Creates the content of the used as may section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param atd the attribute type description
+     */
+    private void createUsedAsMayContent( AttributeTypeDescription atd )
     {
-
-        if ( maySection.getClient() != null )
+        // dispose old content
+        if ( usedAsMaySection.getClient() != null )
         {
-            maySection.getClient().dispose();
+            usedAsMaySection.getClient().dispose();
         }
 
-        Composite mayClient = toolkit.createComposite( maySection, SWT.WRAP );
+        // create new client
+        Composite mayClient = toolkit.createComposite( usedAsMaySection, SWT.WRAP );
         mayClient.setLayout( new GridLayout() );
-        maySection.setClient( mayClient );
+        usedAsMaySection.setClient( mayClient );
 
+        // create new content, either links to objectclasses or a dash
         if ( atd != null )
         {
             ObjectClassDescription[] usedAsMays = atd.getUsedAsMay();
             if ( usedAsMays != null && usedAsMays.length > 0 )
             {
-                maySection.setText( "Used as MAY (" + usedAsMays.length + ")" );
+                usedAsMaySection.setText( "Used as MAY (" + usedAsMays.length + ")" );
                 usedAsMayLinks = new Hyperlink[usedAsMays.length];
                 for ( int i = 0; i < usedAsMays.length; i++ )
                 {
@@ -702,18 +774,12 @@
                     usedAsMayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     usedAsMayLinks[i].setUnderlined( true );
                     usedAsMayLinks[i].setEnabled( true );
-                    usedAsMayLinks[i].addHyperlinkListener( new HyperlinkAdapter()
-                    {
-                        public void linkActivated( HyperlinkEvent e )
-                        {
-                            SchemaBrowser.select( e.getHref() );
-                        }
-                    } );
+                    usedAsMayLinks[i].addHyperlinkListener( this );
                 }
             }
             else
             {
-                maySection.setText( "Used as MAY (0)" );
+                usedAsMaySection.setText( "Used as MAY (0)" );
                 usedAsMayLinks = new Hyperlink[0];
                 Text mayText = toolkit.createText( mayClient, getNonNullString( null ), SWT.NONE );
                 mayText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
@@ -722,10 +788,10 @@
         }
         else
         {
-            maySection.setText( "Used as MAY" );
+            usedAsMaySection.setText( "Used as MAY" );
         }
 
-        maySection.layout();
+        usedAsMaySection.layout();
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java Sun Feb 11 08:01:38 2007
@@ -21,155 +21,111 @@
 package org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
 import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 
 
-public class AttributeTypeDescriptionPage extends SchemaPage implements ISelectionChangedListener
+/**
+ * The AttributeTypeDescriptionPage displays a list with all
+ * attribute type descriptions and hosts the detail page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeDescriptionPage extends SchemaPage
 {
 
-    private Section section;
-
-    private Text filterText;
-
-    private TableViewer viewer;
-
-
+    /**
+     * Creates a new instance of AttributeTypeDescriptionPage.
+     *
+     * @param schemaBrowser the schema browser
+     */
     public AttributeTypeDescriptionPage( SchemaBrowser schemaBrowser )
     {
         super( schemaBrowser );
     }
 
 
-    protected void refresh()
+    /**
+     * {@inheritDoc}
+     */
+    protected String getTitle()
     {
-        if ( this.schemaBrowser.isShowDefaultSchema() )
-        {
-            this.form.setText( "Attribute Types of default schema" );
-            this.viewer.setInput( Schema.DEFAULT_SCHEMA );
-        }
-        else if ( this.selectedConnection != null )
-        {
-            this.form.setText( "Attribute Types of connection '" + this.selectedConnection.getName() + "'" );
-            this.viewer.setInput( this.selectedConnection.getSchema() );
-        }
-        else
-        {
-            this.form.setText( "Attribute Types" );
-            this.viewer.setInput( null );
-        }
-        this.viewer.refresh();
+        return "Attribute Types";
     }
 
 
-    protected void createMaster( Composite parent )
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFilterDescription()
     {
+        return "Please select an attribute type. Enter a filter to restrict the list.";
+    }
 
-        section = toolkit.createSection( parent, Section.DESCRIPTION );
-        section.marginWidth = 10;
-        section.marginHeight = 12;
-        section.setText( "Attribute Types" );
-        section.setDescription( "Please select a attribute type. Enter a filter to restrict the list." );
-        toolkit.createCompositeSeparator( section );
-
-        Composite client = toolkit.createComposite( section, SWT.WRAP );
-        GridLayout layout = new GridLayout( 2, false );
-        layout.marginWidth = 5;
-        layout.marginHeight = 5;
-        client.setLayout( layout );
-        section.setClient( client );
 
-        toolkit.createLabel( client, "Filter:" );
-        this.filterText = toolkit.createText( client, "", SWT.NONE );
-        this.filterText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        this.filterText.setData( FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER );
-        this.filterText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                viewer.refresh();
-            }
-        } );
+    /**
+     * {@inheritDoc}
+     */
+    protected IStructuredContentProvider getContentProvider()
+    {
+        return new ATDContentProvider();
+    }
 
-        Table t = toolkit.createTable( client, SWT.NONE );
-        GridData gd = new GridData( GridData.FILL_BOTH );
-        gd.horizontalSpan = 2;
-        gd.heightHint = 20;
-        gd.widthHint = 100;
-        t.setLayoutData( gd );
-        toolkit.paintBordersFor( client );
 
-        viewer = new TableViewer( t );
-        viewer.setContentProvider( new ATDContentProvider() );
-        viewer.setLabelProvider( new ATDLabelProvider() );
-        viewer.setSorter( new ATDViewerSorter() );
-        viewer.addFilter( new ATDViewerFilter() );
+    /**
+     * {@inheritDoc}
+     */
+    protected ITableLabelProvider getLabelProvider()
+    {
+        return new ATDLabelProvider();
     }
 
 
-    protected void createDetail( Composite body )
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerSorter getSorter()
     {
-        this.detailsPage = new AttributeTypeDescriptionDetailsPage( this.schemaBrowser, this.toolkit );
-        this.detailsPage.createContents( this.detailForm );
-        this.viewer.addSelectionChangedListener( this );
+        return new ATDViewerSorter();
     }
 
 
-    public void selectionChanged( SelectionChangedEvent event )
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerFilter getFilter()
     {
-        ISelection selection = event.getSelection();
-        if ( selection.isEmpty() )
-        {
-            EventRegistry.fireAttributeTypeDescriptionSelected( null, this );
-        }
-        else
-        {
-            Object obj = ( ( StructuredSelection ) selection ).getFirstElement();
-            if ( obj instanceof AttributeTypeDescription )
-            {
-                AttributeTypeDescription atd = ( AttributeTypeDescription ) obj;
-                EventRegistry.fireAttributeTypeDescriptionSelected( atd, this );
-            }
-        }
+        return new ATDViewerFilter();
     }
 
 
-    public void select( Object obj )
+    /**
+     * {@inheritDoc}
+     */
+    protected SchemaDetailsPage getDetailsPage()
     {
-        this.viewer.setSelection( new StructuredSelection( obj ), true );
-        if ( this.viewer.getSelection().isEmpty() )
-        {
-            this.filterText.setText( "" );
-            this.viewer.setSelection( new StructuredSelection( obj ), true );
-        }
+        return new AttributeTypeDescriptionDetailsPage( this, this.toolkit );
     }
 
-    class ATDContentProvider implements IStructuredContentProvider
+    /**
+     * The content provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class ATDContentProvider implements IStructuredContentProvider
     {
+        /**
+         * {@inheritDoc}
+         */
         public Object[] getElements( Object inputElement )
         {
             if ( inputElement instanceof Schema )
@@ -184,40 +140,76 @@
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void dispose()
         {
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
         {
         }
     }
 
-    class ATDLabelProvider extends LabelProvider implements ITableLabelProvider
-    {
+    /**
+     * The label provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class ATDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
         public String getColumnText( Object obj, int index )
         {
             return obj.toString();
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public Image getColumnImage( Object obj, int index )
         {
             return null;
         }
     }
 
-    class ATDViewerSorter extends ViewerSorter
-    {
+    /**
+     * The sorter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class ATDViewerSorter extends ViewerSorter
+    {
+        /**
+         * {@inheritDoc}
+         */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
             return e1.toString().compareTo( e2.toString() );
         }
     }
 
-    class ATDViewerFilter extends ViewerFilter
-    {
+    /**
+     * The filter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class ATDViewerFilter extends ViewerFilter
+    {
+        /**
+         * {@inheritDoc}
+         */
         public boolean select( Viewer viewer, Object parentElement, Object element )
         {
             if ( element instanceof AttributeTypeDescription )

Added: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java?view=auto&rev=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java Sun Feb 11 08:01:38 2007
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.ui.widgets.connection.ConnectionContentProvider;
+import org.apache.directory.ldapstudio.browser.ui.widgets.connection.ConnectionLabelProvider;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+
+/**
+ * A contribution item that adds a combo with connections to the toolbar.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionComboContributionItem extends ContributionItem implements ConnectionUpdateListener
+{
+    /** The schema page */
+    private SchemaPage schemaPage;
+
+    /** Flag indicating if the combo's selection is changed programatically */
+    private boolean inChange;
+
+    /** The combo viewer */
+    private ComboViewer comboViewer;
+
+    /** The tool item */
+    private ToolItem toolitem;
+
+
+    /**
+     * Creates a new instance of ConnectionContributionItem.
+     *
+     * @param schemaPage the schema page
+     */
+    public ConnectionComboContributionItem( SchemaPage schemaPage )
+    {
+        this.schemaPage = schemaPage;
+        this.inChange = false;
+    }
+
+
+    /**
+     * Creates and returns the control for this contribution item
+     * under the given parent composite.
+     *
+     * @param parent the parent composite
+     * @return the new control
+     */
+    private Control createControl( Composite parent )
+    {
+        comboViewer = new ComboViewer( parent, SWT.DROP_DOWN | SWT.READ_ONLY );
+        comboViewer.setLabelProvider( new ConnectionLabelProvider() );
+        comboViewer.setContentProvider( new ConnectionContentProvider() );
+        comboViewer.setInput( BrowserCorePlugin.getDefault().getConnectionManager() );
+        comboViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                // Do not set the input of the schema browser if 
+                // the selection was changed programatically.
+                if ( !inChange )
+                {
+                    IConnection connection = getConnection();
+                    schemaPage.getSchemaBrowser().setInput( new SchemaBrowserInput( connection, null ) );
+                }
+            }
+        } );
+
+        EventRegistry.addConnectionUpdateListener( this );
+
+        // Initialize width of combo
+        toolitem.setWidth( comboViewer.getCombo().computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
+
+        return comboViewer.getCombo();
+    }
+
+
+    /**
+     * @see org.eclipse.jface.action.ContributionItem#dispose()
+     */
+    public void dispose()
+    {
+        EventRegistry.removeConnectionUpdateListener( this );
+        comboViewer = null;
+    }
+
+
+    /**
+     * The control item implementation of this <code>IContributionItem</code>
+     * method calls the <code>createControl</code> method.
+     * 
+     * @param parent the parent of the control to fill
+     */
+    public final void fill( Composite parent )
+    {
+        createControl( parent );
+    }
+
+
+    /**
+     * The control item implementation of this <code>IContributionItem</code>
+     * method throws an exception since controls cannot be added to menus.
+     * 
+     * @param parent the menu
+     * @param index menu index
+     */
+    public final void fill( Menu parent, int index )
+    {
+        Assert.isTrue( false, "Can't add a control to a menu" );//$NON-NLS-1$
+    }
+
+
+    /**
+     * The control item implementation of this <code>IContributionItem</code>
+     * method calls the <code>createControl</code>  method to
+     * create a control under the given parent, and then creates
+     * a new tool item to hold it.
+     * 
+     * @param parent the ToolBar to add the new control to
+     * @param index the index
+     */
+    public void fill( ToolBar parent, int index )
+    {
+        toolitem = new ToolItem( parent, SWT.SEPARATOR, index );
+        Control control = createControl( parent );
+        toolitem.setControl( control );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
+    {
+        if ( comboViewer != null )
+        {
+            this.comboViewer.refresh();
+        }
+    }
+
+
+    /**
+     * Gets the connection.
+     * 
+     * @return the connection
+     */
+    public IConnection getConnection()
+    {
+        ISelection selection = comboViewer.getSelection();
+        if ( !selection.isEmpty() )
+        {
+            return ( IConnection ) ( ( IStructuredSelection ) selection ).getFirstElement();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Sets the connection.
+     * 
+     * @param connection the connection
+     */
+    public void setConnection( IConnection connection )
+    {
+        ISelection newSelection = new StructuredSelection( connection );
+        ISelection oldSelection = comboViewer.getSelection();
+        if ( !newSelection.equals( oldSelection ) )
+        {
+            inChange = true;
+            comboViewer.setSelection( newSelection );
+            inChange = false;
+        }
+    }
+
+
+    /**
+     * Updates the enabled state.
+     */
+    public void updateEnabledState()
+    {
+        comboViewer.getCombo().setEnabled( !schemaPage.isShowDefaultSchema() );
+    }
+
+}
\ No newline at end of file

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java Sun Feb 11 08:01:38 2007
@@ -23,7 +23,6 @@
 
 import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -31,40 +30,60 @@
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.events.ExpansionAdapter;
 import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Hyperlink;
 import org.eclipse.ui.forms.widgets.ScrolledForm;
 import org.eclipse.ui.forms.widgets.Section;
 
 
+/**
+ * The LdapSyntaxDescriptionDetailsPage displays the details of an
+ * syntax description.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class LdapSyntaxDescriptionDetailsPage extends SchemaDetailsPage
 {
 
+    /** The main section, contains oid and desc */
     private Section mainSection;
 
-    private Section usedFromSection;
-
+    /** The numeric oid field */
     private Text numericOidText;
 
+    /** The description field */
     private Text descText;
 
+    /** The used from section, contains links to attribute types */
+    private Section usedFromSection;
+
+    /** The links to attributes using the syntax */
     private Hyperlink[] usedFromLinks;
 
 
-    public LdapSyntaxDescriptionDetailsPage( SchemaBrowser schemaBrowser, FormToolkit toolkit )
+    /**
+     * Creates a new instance of LdapSyntaxDescriptionDetailsPage.
+     *
+     * @param schemaPage the master schema page
+     * @param toolkit the toolkit used to create controls
+     */
+    public LdapSyntaxDescriptionDetailsPage( SchemaPage schemaPage, FormToolkit toolkit )
     {
-        super( schemaBrowser, toolkit );
+        super( schemaPage, toolkit );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void createContents( final ScrolledForm detailForm )
     {
 
         this.detailForm = detailForm;
         detailForm.getBody().setLayout( new GridLayout() );
 
+        // create main section
         mainSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
         mainSection.setText( "Details" );
         mainSection.marginWidth = 0;
@@ -72,6 +91,7 @@
         mainSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
         toolkit.createCompositeSeparator( mainSection );
 
+        // create used from section
         usedFromSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
         usedFromSection.setText( "Used from" );
         usedFromSection.marginWidth = 0;
@@ -86,46 +106,52 @@
             }
         } );
 
-        super.createRawSection();
+        // create raw aection
+        createRawSection();
     }
 
 
-    public void ldapSyntacDescriptionSelected( LdapSyntaxDescription lsd )
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( Object input )
     {
-        if ( this.detailForm != null && !this.detailForm.isDisposed() )
+        LdapSyntaxDescription lsd = null;
+        if ( input instanceof LdapSyntaxDescription )
         {
-            this.createMainContent( lsd );
-            this.createUsedFromContents( lsd );
-            super.createRawContents( lsd );
-
-            this.detailForm.reflow( true );
+            lsd = ( LdapSyntaxDescription ) input;
         }
+
+        createMainContent( lsd );
+        createUsedFromContents( lsd );
+        createRawContents( lsd );
+
+        detailForm.reflow( true );
     }
 
 
+    /**
+     * Creates the content of the main section. It is newly created
+     * on every input change to ensure a proper layout of 
+     * multilined descriptions. 
+     *
+     * @param lsd the syntax description
+     */
     private void createMainContent( LdapSyntaxDescription lsd )
     {
-
-        int labelWidth = 100;
-
+        // dispose old content
         if ( mainSection.getClient() != null )
         {
-            if ( mainSection.getClient() instanceof Composite )
-            {
-                Composite client = ( Composite ) mainSection.getClient();
-                if ( client.getChildren() != null && client.getChildren().length > 0 )
-                {
-                    labelWidth = client.getChildren()[0].getSize().x;
-                }
-            }
             mainSection.getClient().dispose();
         }
 
+        // create new client
         Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
         GridLayout mainLayout = new GridLayout( 2, false );
         mainClient.setLayout( mainLayout );
         mainSection.setClient( mainClient );
 
+        // create new content
         if ( lsd != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
@@ -136,27 +162,36 @@
             toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
             descText = toolkit.createText( mainClient, getNonNullString( lsd.getDesc() ), SWT.WRAP | SWT.MULTI );
             GridData gd = new GridData( GridData.FILL_HORIZONTAL );
-            gd.widthHint = detailForm.getForm().getSize().x - labelWidth - 60;
+            gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
             descText.setLayoutData( gd );
             descText.setEditable( false );
         }
 
         mainSection.layout();
-
     }
 
 
+    /**
+     * Creates the content of the used from section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param lsd the syntax description
+     */
     private void createUsedFromContents( LdapSyntaxDescription lsd )
     {
+        // dispose old content
         if ( usedFromSection.getClient() != null && !usedFromSection.getClient().isDisposed() )
         {
             usedFromSection.getClient().dispose();
         }
 
+        // create new client
         Composite usedFromClient = toolkit.createComposite( usedFromSection, SWT.WRAP );
         usedFromClient.setLayout( new GridLayout() );
         usedFromSection.setClient( usedFromClient );
 
+        // create content
         if ( lsd != null )
         {
             AttributeTypeDescription[] usedFromATDs = lsd.getUsedFromAttributeTypeDescription();
@@ -171,13 +206,7 @@
                     usedFromLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     usedFromLinks[i].setUnderlined( true );
                     usedFromLinks[i].setEnabled( true );
-                    usedFromLinks[i].addHyperlinkListener( new HyperlinkAdapter()
-                    {
-                        public void linkActivated( HyperlinkEvent e )
-                        {
-                            SchemaBrowser.select( e.getHref() );
-                        }
-                    } );
+                    usedFromLinks[i].addHyperlinkListener( this );
                 }
             }
             else
@@ -195,7 +224,6 @@
         }
 
         usedFromSection.layout();
-
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java?view=diff&rev=506058&r1=506057&r2=506058
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java Sun Feb 11 08:01:38 2007
@@ -24,156 +24,111 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
 import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 
 
-public class LdapSyntaxDescriptionPage extends SchemaPage implements ISelectionChangedListener
+/**
+ * The LdapSyntaxDescriptionPage displays a list with all
+ * syntax descriptions and hosts the detail page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdapSyntaxDescriptionPage extends SchemaPage
 {
 
-    private Section section;
-
-    private Text filterText;
-
-    private TableViewer viewer;
-
-
+    /**
+     * Creates a new instance of LdapSyntaxDescriptionPage.
+     *
+     * @param schemaBrowser the schema browser
+     */
     public LdapSyntaxDescriptionPage( SchemaBrowser schemaBrowser )
     {
         super( schemaBrowser );
     }
 
 
-    protected void refresh()
+    /**
+     * {@inheritDoc}
+     */
+    protected String getTitle()
     {
-        if ( this.schemaBrowser.isShowDefaultSchema() )
-        {
-            this.form.setText( "Syntaxes of default schema" );
-            this.viewer.setInput( Schema.DEFAULT_SCHEMA );
-        }
-        else if ( this.selectedConnection != null )
-        {
-            this.form.setText( "Syntaxes of connection '" + this.selectedConnection.getName() + "'" );
-            this.viewer.setInput( this.selectedConnection.getSchema() );
-        }
-        else
-        {
-            this.form.setText( "Syntaxes" );
-            this.viewer.setInput( null );
-        }
-        this.viewer.refresh();
-        this.selectionChanged( new SelectionChangedEvent( this.viewer, this.viewer.getSelection() ) );
+        return "Syntaxes";
     }
 
 
-    protected void createMaster( Composite parent )
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFilterDescription()
     {
+        return "Please select a syntax. Enter a filter to restrict the list.";
+    }
 
-        section = toolkit.createSection( parent, Section.DESCRIPTION );
-        section.marginWidth = 10;
-        section.marginHeight = 12;
-        section.setText( "Syntaxes" );
-        section.setDescription( "Please select a syntax. Enter a filter to restrict the list." );
-        toolkit.createCompositeSeparator( section );
-
-        Composite client = toolkit.createComposite( section, SWT.WRAP );
-        GridLayout layout = new GridLayout( 2, false );
-        layout.marginWidth = 5;
-        layout.marginHeight = 5;
-        client.setLayout( layout );
-        section.setClient( client );
 
-        toolkit.createLabel( client, "Filter:" );
-        this.filterText = toolkit.createText( client, "", SWT.NONE );
-        this.filterText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-        this.filterText.setData( FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER );
-        this.filterText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                viewer.refresh();
-            }
-        } );
+    /**
+     * {@inheritDoc}
+     */
+    protected IStructuredContentProvider getContentProvider()
+    {
+        return new LSDContentProvider();
+    }
 
-        Table t = toolkit.createTable( client, SWT.NONE );
-        GridData gd = new GridData( GridData.FILL_BOTH );
-        gd.horizontalSpan = 2;
-        gd.heightHint = 20;
-        gd.widthHint = 100;
-        t.setLayoutData( gd );
-        toolkit.paintBordersFor( client );
 
-        viewer = new TableViewer( t );
-        viewer.setContentProvider( new LSDContentProvider() );
-        viewer.setLabelProvider( new LSDLabelProvider() );
-        viewer.setSorter( new LSDViewerSorter() );
-        viewer.addFilter( new LSDViewerFilter() );
+    /**
+     * {@inheritDoc}
+     */
+    protected ITableLabelProvider getLabelProvider()
+    {
+        return new LSDLabelProvider();
     }
 
 
-    protected void createDetail( Composite body )
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerSorter getSorter()
     {
-        this.detailsPage = new LdapSyntaxDescriptionDetailsPage( this.schemaBrowser, this.toolkit );
-        this.detailsPage.createContents( this.detailForm );
-        this.viewer.addSelectionChangedListener( this );
+        return new LSDViewerSorter();
     }
 
 
-    public void selectionChanged( SelectionChangedEvent event )
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerFilter getFilter()
     {
-        ISelection selection = event.getSelection();
-        if ( selection.isEmpty() )
-        {
-            EventRegistry.fireLdapSyntaxDescriptionSelected( null, this );
-        }
-        else
-        {
-            Object obj = ( ( StructuredSelection ) selection ).getFirstElement();
-            if ( obj instanceof LdapSyntaxDescription )
-            {
-                LdapSyntaxDescription lsd = ( LdapSyntaxDescription ) obj;
-                EventRegistry.fireLdapSyntaxDescriptionSelected( lsd, this );
-            }
-        }
+        return new LSDViewerFilter();
     }
 
 
-    public void select( Object obj )
+    /**
+     * {@inheritDoc}
+     */
+    protected SchemaDetailsPage getDetailsPage()
     {
-        this.viewer.setSelection( new StructuredSelection( obj ), true );
-        if ( this.viewer.getSelection().isEmpty() )
-        {
-            this.filterText.setText( "" );
-            this.viewer.setSelection( new StructuredSelection( obj ), true );
-        }
+        return new LdapSyntaxDescriptionDetailsPage( this, this.toolkit );
     }
 
-    class LSDContentProvider implements IStructuredContentProvider
+    /**
+     * The content provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class LSDContentProvider implements IStructuredContentProvider
     {
+        /**
+         * {@inheritDoc}
+         */
         public Object[] getElements( Object inputElement )
         {
             if ( inputElement instanceof Schema )
@@ -181,7 +136,7 @@
                 Schema schema = ( Schema ) inputElement;
                 if ( schema != null && schema.getLsdMapByNumericOID() != null )
                 {
-                    Set set = new HashSet( schema.getLsdMapByNumericOID().values() );
+                    Set<Object> set = new HashSet<Object>( schema.getLsdMapByNumericOID().values() );
                     return set.toArray();
                 }
             }
@@ -189,40 +144,76 @@
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void dispose()
         {
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
         {
         }
     }
 
-    class LSDLabelProvider extends LabelProvider implements ITableLabelProvider
-    {
+    /**
+     * The label provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class LSDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
         public String getColumnText( Object obj, int index )
         {
             return obj.toString();
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public Image getColumnImage( Object obj, int index )
         {
             return null;
         }
     }
 
-    class LSDViewerSorter extends ViewerSorter
-    {
+    /**
+     * The sorter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class LSDViewerSorter extends ViewerSorter
+    {
+        /**
+         * {@inheritDoc}
+         */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
             return e1.toString().compareTo( e2.toString() );
         }
     }
 
-    class LSDViewerFilter extends ViewerFilter
-    {
+    /**
+     * The filter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class LSDViewerFilter extends ViewerFilter
+    {
+        /**
+         * {@inheritDoc}
+         */
         public boolean select( Viewer viewer, Object parentElement, Object element )
         {
             if ( element instanceof LdapSyntaxDescription )



Mime
View raw message