directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r641069 [3/4] - in /directory/studio/trunk: aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ ldapbrowser-common/src/...
Date Tue, 25 Mar 2008 23:05:38 GMT
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenSchemaBrowserAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenSchemaBrowserAction.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenSchemaBrowserAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenSchemaBrowserAction.java Tue Mar 25 16:05:04 2008
@@ -21,14 +21,16 @@
 package org.apache.directory.studio.ldapbrowser.ui.actions;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser.SchemaBrowserManager;
@@ -282,12 +284,16 @@
      */
     private LdapSyntaxDescription getLsd()
     {
-        AttributeTypeDescription atd = getAtd();
-
-        if ( atd != null && atd.getSyntaxDescriptionNumericOIDTransitive() != null
-            && atd.getSchema().hasLdapSyntaxDescription( atd.getSyntaxDescriptionNumericOIDTransitive() ) )
+        if ( getConnection() != null )
         {
-            return atd.getSchema().getLdapSyntaxDescription( atd.getSyntaxDescriptionNumericOIDTransitive() );
+            Schema schema = getConnection().getSchema();
+            AttributeTypeDescription atd = getAtd();
+
+            if ( atd != null && SchemaUtils.getSyntaxNumericOidTransitive( atd, schema ) != null
+                && schema.hasLdapSyntaxDescription( SchemaUtils.getSyntaxNumericOidTransitive( atd, schema ) ) )
+            {
+                return schema.getLdapSyntaxDescription( SchemaUtils.getSyntaxNumericOidTransitive( atd, schema ) );
+            }
         }
 
         return null;
@@ -298,7 +304,7 @@
      * Gets the Object Class Description.
      *
      * @return
-     *      the Object Class Drescription
+     *      the Object Class Description
      */
     private ObjectClassDescription getOcd()
     {
@@ -378,8 +384,8 @@
         else if ( getSelectedConnections().length == 1 )
         {
             Connection connection = getSelectedConnections()[0];
-            IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnection(
-                connection );
+            IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+                .getBrowserConnection( connection );
             return browserConnection;
         }
         else if ( getSelectedEntries().length == 1 )
@@ -411,14 +417,19 @@
      */
     private MatchingRuleDescription getEmrd()
     {
-        AttributeTypeDescription atd = getAtd();
-
-        if ( atd != null && atd.getEqualityMatchingRuleDescriptionOIDTransitive() != null
-            && atd.getSchema().hasMatchingRuleDescription( atd.getEqualityMatchingRuleDescriptionOIDTransitive() ) )
+        if ( getConnection() != null )
         {
-            return atd.getSchema().getMatchingRuleDescription( atd.getEqualityMatchingRuleDescriptionOIDTransitive() );
+            Schema schema = getConnection().getSchema();
+            AttributeTypeDescription atd = getAtd();
+            if ( atd != null
+                && SchemaUtils.getEqualityMatchingRuleNameOrNumericOidTransitive( atd, schema ) != null
+                && schema.hasLdapSyntaxDescription( SchemaUtils.getEqualityMatchingRuleNameOrNumericOidTransitive( atd,
+                    schema ) ) )
+            {
+                return schema.getMatchingRuleDescription( SchemaUtils
+                    .getEqualityMatchingRuleNameOrNumericOidTransitive( atd, schema ) );
+            }
         }
-
         return null;
     }
 
@@ -431,14 +442,19 @@
      */
     private MatchingRuleDescription getSmrd()
     {
-        AttributeTypeDescription atd = getAtd();
-
-        if ( atd != null && atd.getSubstringMatchingRuleDescriptionOIDTransitive() != null
-            && atd.getSchema().hasMatchingRuleDescription( atd.getSubstringMatchingRuleDescriptionOIDTransitive() ) )
+        if ( getConnection() != null )
         {
-            return atd.getSchema().getMatchingRuleDescription( atd.getSubstringMatchingRuleDescriptionOIDTransitive() );
+            Schema schema = getConnection().getSchema();
+            AttributeTypeDescription atd = getAtd();
+            if ( atd != null
+                && SchemaUtils.getSubstringMatchingRuleNameOrNumericOidTransitive( atd, schema ) != null
+                && schema.hasLdapSyntaxDescription( SchemaUtils.getSubstringMatchingRuleNameOrNumericOidTransitive(
+                    atd, schema ) ) )
+            {
+                return schema.getMatchingRuleDescription( SchemaUtils
+                    .getSubstringMatchingRuleNameOrNumericOidTransitive( atd, schema ) );
+            }
         }
-
         return null;
     }
 
@@ -451,14 +467,19 @@
      */
     private MatchingRuleDescription getOmrd()
     {
-        AttributeTypeDescription atd = getAtd();
-
-        if ( atd != null && atd.getOrderingMatchingRuleDescriptionOIDTransitive() != null
-            && atd.getSchema().hasMatchingRuleDescription( atd.getOrderingMatchingRuleDescriptionOIDTransitive() ) )
+        if ( getConnection() != null )
         {
-            return atd.getSchema().getMatchingRuleDescription( atd.getOrderingMatchingRuleDescriptionOIDTransitive() );
+            Schema schema = getConnection().getSchema();
+            AttributeTypeDescription atd = getAtd();
+            if ( atd != null
+                && SchemaUtils.getOrderingMatchingRuleNameOrNumericOidTransitive( atd, schema ) != null
+                && schema.hasLdapSyntaxDescription( SchemaUtils.getOrderingMatchingRuleNameOrNumericOidTransitive( atd,
+                    schema ) ) )
+            {
+                return schema.getMatchingRuleDescription( SchemaUtils
+                    .getOrderingMatchingRuleNameOrNumericOidTransitive( atd, schema ) );
+            }
         }
-
         return null;
     }
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/AttributePropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/AttributePropertyPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/AttributePropertyPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/AttributePropertyPage.java Tue Mar 25 16:05:04 2008
@@ -21,14 +21,13 @@
 package org.apache.directory.studio.ldapbrowser.ui.dialogs.properties;
 
 
-import java.util.Arrays;
-
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
-
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -90,7 +89,6 @@
 
     protected Control createContents( Composite parent )
     {
-
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
 
         Composite mainGroup = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
@@ -188,6 +186,7 @@
         IAttribute attribute = getAttribute( getElement() );
         if ( attribute != null )
         {
+            Schema schema = attribute.getEntry().getBrowserConnection().getSchema();
 
             int bytes = 0;
             int valCount = 0;
@@ -207,33 +206,36 @@
             attributeValuesText.setText( "" + valCount );
             attributeSizeText.setText( Utils.formatBytes( bytes ) );
 
-            if ( attribute.getEntry().getBrowserConnection().getSchema().hasAttributeTypeDescription(
-                attribute.getDescription() ) )
+            if ( schema.hasAttributeTypeDescription( attribute.getDescription() ) )
             {
-                AttributeTypeDescription atd = attribute.getEntry().getBrowserConnection().getSchema()
-                    .getAttributeTypeDescription( attribute.getDescription() );
+                AttributeTypeDescription atd = schema.getAttributeTypeDescription( attribute.getDescription() );
 
-                atdOidText.setText( atd.getNumericOID() );
-                String atdNames = Arrays.asList( atd.getNames() ).toString();
+                atdOidText.setText( atd.getNumericOid() );
+                String atdNames = atd.getNames().toString();
                 atdNamesText.setText( atdNames.substring( 1, atdNames.length() - 1 ) );
-                atdDescText.setText( Utils.getNonNullString( atd.getDesc() ) );
+                atdDescText.setText( Utils.getNonNullString( atd.getDescription() ) );
                 atdUsageText.setText( Utils.getNonNullString( atd.getUsage() ) );
 
                 singleValuedFlag.setSelection( atd.isSingleValued() );
-                noUserModificationFlag.setSelection( atd.isNoUserModification() );
+                noUserModificationFlag.setSelection( !atd.isUserModifiable() );
                 collectiveFlag.setSelection( atd.isCollective() );
                 obsoleteFlag.setSelection( atd.isObsolete() );
 
-                syntaxOidText.setText( Utils.getNonNullString( atd.getSyntaxDescriptionNumericOIDTransitive() ) );
-                syntaxDescText.setText( Utils.getNonNullString( atd.getSyntaxDescription().getDesc() ) );
-                syntaxLengthText.setText( Utils.getNonNullString( atd.getSyntaxDescriptionLengthTransitive() ) );
-
-                equalityMatchingRuleText.setText( Utils.getNonNullString( atd
-                    .getEqualityMatchingRuleDescriptionOIDTransitive() ) );
-                substringMatchingRuleText.setText( Utils.getNonNullString( atd
-                    .getSubstringMatchingRuleDescriptionOIDTransitive() ) );
-                orderingMatchingRuleText.setText( Utils.getNonNullString( atd
-                    .getOrderingMatchingRuleDescriptionOIDTransitive() ) );
+                String syntaxNumericOid = SchemaUtils.getSyntaxNumericOidTransitive( atd, schema );
+                int syntaxLength = SchemaUtils.getSyntaxLengthTransitive( atd, schema );
+                String syntaxDescription = syntaxNumericOid != null ? schema
+                    .getLdapSyntaxDescription( syntaxNumericOid ).getDescription() : null;
+                syntaxOidText.setText( Utils.getNonNullString( syntaxNumericOid ) );
+                syntaxDescText.setText( Utils.getNonNullString( syntaxDescription ) );
+                syntaxLengthText.setText( Utils.getNonNullString( syntaxLength > 0 ? Integer.toString( syntaxLength )
+                    : null ) );
+
+                equalityMatchingRuleText.setText( Utils.getNonNullString( SchemaUtils
+                    .getEqualityMatchingRuleNameOrNumericOidTransitive( atd, schema ) ) );
+                substringMatchingRuleText.setText( Utils.getNonNullString( SchemaUtils
+                    .getSubstringMatchingRuleNameOrNumericOidTransitive( atd, schema ) ) );
+                orderingMatchingRuleText.setText( Utils.getNonNullString( SchemaUtils
+                    .getOrderingMatchingRuleNameOrNumericOidTransitive( atd, schema ) ) );
             }
         }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaAttributesPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaAttributesPropertyPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaAttributesPropertyPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaAttributesPropertyPage.java Tue Mar 25 16:05:04 2008
@@ -21,6 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.dialogs.properties;
 
 
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 
@@ -50,7 +53,6 @@
 
     protected Control createContents( Composite parent )
     {
-
         Table table = new Table( parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
             | SWT.HIDE_SELECTION );
         GridData gridData = new GridData( GridData.FILL_BOTH );
@@ -76,7 +78,7 @@
             IBrowserConnection connection = ( IBrowserConnection ) getElement();
             if ( connection != null )
             {
-                Object[] atds = connection.getSchema().getAttributeTypeDescriptions();
+                Collection<AttributeTypeDescription> atds = connection.getSchema().getAttributeTypeDescriptions();
                 viewer.setInput( atds );
                 column.pack();
             }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaObjectClassesPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaObjectClassesPropertyPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaObjectClassesPropertyPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaObjectClassesPropertyPage.java Tue Mar 25 16:05:04 2008
@@ -21,6 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.dialogs.properties;
 
 
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 
@@ -76,7 +79,7 @@
             IBrowserConnection connection = ( IBrowserConnection ) getElement();
             if ( connection != null )
             {
-                Object[] ocds = connection.getSchema().getObjectClassDescriptions();
+                Collection<ObjectClassDescription> ocds = connection.getSchema().getObjectClassDescriptions();
                 viewer.setInput( ocds );
                 column.pack();
             }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,10 +21,14 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -79,7 +83,7 @@
     /** The no-user-modification field */
     private Label noUserModificationText;
 
-    /** The syntax section, contains syntax description, lenth and a link to the syntax */ 
+    /** The syntax section, contains syntax description, lenth and a link to the syntax */
     private Section syntaxSection;
 
     /** The syntax description field */
@@ -106,33 +110,18 @@
     /** The section with other matching rules */
     private Section otherMatchSection;
 
-    /** The links to other matching rules applicaple to the selected attribute */
-    private Hyperlink[] otherMatchLinks;
-
     /** 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;
-
     /** 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;
-
     /** The section with a link to the superior attribute type */
     private Section supertypeSection;
 
-    /** The link to the superior attribute type */
-    private Hyperlink superLink;
-
     /** The section with links to the derived attribute types */
     private Section subtypesSection;
 
-    /** The links to derived attribute types */
-    private Hyperlink[] subAttributeTypeLinks;
-
 
     /**
      * Creates a new instance of AttributeTypeDescriptionDetailsPage.
@@ -358,28 +347,28 @@
         singleValuedText.setEnabled( atd != null && atd.isSingleValued() );
         isObsoleteText.setEnabled( atd != null && atd.isObsolete() );
         collectiveText.setEnabled( atd != null && atd.isCollective() );
-        noUserModificationText.setEnabled( atd != null && atd.isNoUserModification() );
+        noUserModificationText.setEnabled( atd != null && !atd.isUserModifiable() );
         flagSection.layout();
 
         // set syntax content
         String lsdOid = null;
         LdapSyntaxDescription lsd = null;
-        String lsdLength = null;
+        int lsdLength = 0;
         if ( atd != null )
         {
-            lsdOid = atd.getSyntaxDescriptionNumericOIDTransitive();
-            if ( lsdOid != null && atd.getSchema().hasLdapSyntaxDescription( lsdOid ) )
+            lsdOid = SchemaUtils.getSyntaxNumericOidTransitive( atd, getSchema() );
+            if ( lsdOid != null && getSchema().hasLdapSyntaxDescription( lsdOid ) )
             {
-                lsd = atd.getSchema().getLdapSyntaxDescription( lsdOid );
+                lsd = getSchema().getLdapSyntaxDescription( lsdOid );
             }
-            lsdLength = atd.getSyntaxDescriptionLengthTransitive();
+            lsdLength = SchemaUtils.getSyntaxLengthTransitive( atd, getSchema() );
         }
-        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOID() : lsdOid ) );
+        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOid() : lsdOid ) );
         syntaxLink.setHref( lsd );
         syntaxLink.setUnderlined( lsd != null );
         syntaxLink.setEnabled( lsd != null );
-        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
-        lengthText.setText( getNonNullString( lsdLength ) );
+        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDescription() : null ) );
+        lengthText.setText( getNonNullString( lsdLength > 0 ? Integer.toString( lsdLength ) : null ) );
         syntaxSection.layout();
 
         // set matching rules content
@@ -387,13 +376,13 @@
         MatchingRuleDescription emr = null;
         if ( atd != null )
         {
-            emrOid = atd.getEqualityMatchingRuleDescriptionOIDTransitive();
-            if ( emrOid != null && atd.getSchema().hasMatchingRuleDescription( emrOid ) )
+            emrOid = SchemaUtils.getEqualityMatchingRuleNameOrNumericOidTransitive( atd, getSchema() );
+            if ( emrOid != null && getSchema().hasMatchingRuleDescription( emrOid ) )
             {
-                emr = atd.getSchema().getMatchingRuleDescription( emrOid );
+                emr = getSchema().getMatchingRuleDescription( emrOid );
             }
         }
-        equalityLink.setText( getNonNullString( emr != null ? emr.toString() : emrOid ) );
+        equalityLink.setText( getNonNullString( emr != null ? SchemaUtils.toString( emr ) : emrOid ) );
         equalityLink.setHref( emr );
         equalityLink.setUnderlined( emr != null );
         equalityLink.setEnabled( emr != null );
@@ -402,13 +391,13 @@
         MatchingRuleDescription smr = null;
         if ( atd != null )
         {
-            smrOid = atd.getSubstringMatchingRuleDescriptionOIDTransitive();
-            if ( smrOid != null && atd.getSchema().hasMatchingRuleDescription( smrOid ) )
+            smrOid = SchemaUtils.getSubstringMatchingRuleNameOrNumericOidTransitive( atd, getSchema() );
+            if ( smrOid != null && getSchema().hasMatchingRuleDescription( smrOid ) )
             {
-                smr = atd.getSchema().getMatchingRuleDescription( smrOid );
+                smr = getSchema().getMatchingRuleDescription( smrOid );
             }
         }
-        substringLink.setText( getNonNullString( smr != null ? smr.toString() : smrOid ) );
+        substringLink.setText( getNonNullString( smr != null ? SchemaUtils.toString( smr ) : smrOid ) );
         substringLink.setHref( smr );
         substringLink.setUnderlined( smr != null );
         substringLink.setEnabled( smr != null );
@@ -417,13 +406,13 @@
         MatchingRuleDescription omr = null;
         if ( atd != null )
         {
-            omrOid = atd.getOrderingMatchingRuleDescriptionOIDTransitive();
-            if ( omrOid != null && atd.getSchema().hasMatchingRuleDescription( omrOid ) )
+            omrOid = SchemaUtils.getOrderingMatchingRuleNameOrNumericOidTransitive( atd, getSchema() );
+            if ( omrOid != null && getSchema().hasMatchingRuleDescription( omrOid ) )
             {
-                omr = atd.getSchema().getMatchingRuleDescription( omrOid );
+                omr = getSchema().getMatchingRuleDescription( omrOid );
             }
         }
-        orderingLink.setText( getNonNullString( omr != null ? omr.toString() : omrOid ) );
+        orderingLink.setText( getNonNullString( omr != null ? SchemaUtils.toString( omr ) : omrOid ) );
         orderingLink.setHref( omr );
         orderingLink.setUnderlined( omr != null );
         orderingLink.setEnabled( omr != null );
@@ -466,24 +455,25 @@
         if ( atd != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
-            numericOidText = toolkit.createText( mainClient, getNonNullString( atd.getNumericOID() ), 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 );
-            namesText = toolkit.createText( mainClient, getNonNullString( atd.toString() ), SWT.NONE );
+            namesText = toolkit.createText( mainClient, getNonNullString( SchemaUtils.toString( atd ) ), 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 );
+            descText = toolkit.createText( mainClient, getNonNullString( atd.getDescription() ), SWT.WRAP | SWT.MULTI );
             GridData gd = new GridData( GridData.FILL_HORIZONTAL );
             gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
             descText.setLayoutData( gd );
             descText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Usage:", SWT.NONE );
-            usageText = toolkit.createText( mainClient, getNonNullString( atd.getUsage() ), SWT.NONE );
+            usageText = toolkit.createText( mainClient, getNonNullString( UsageEnum.render( atd.getUsage() ) ),
+                SWT.NONE );
             usageText.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL ) );
             usageText.setEditable( false );
 
@@ -517,36 +507,35 @@
         // or a dash if no other matching rules exist.
         if ( atd != null )
         {
-            String[] names = atd.getOtherMatchingRuleDescriptionNames();
-            if ( names != null && names.length > 0 )
+            Collection<String> otherMrdNames = SchemaUtils.getOtherMatchingRuleDescriptionNames( atd, getSchema() );
+            if ( otherMrdNames != null && otherMrdNames.size() > 0 )
             {
-                otherMatchSection.setText( "Other Matching Rules (" + names.length + ")" );
-                otherMatchLinks = new Hyperlink[names.length];
-                for ( int i = 0; i < names.length; i++ )
+                otherMatchSection.setText( "Other Matching Rules (" + otherMrdNames.size() + ")" );
+                for ( String mrdName : otherMrdNames )
                 {
-                    if ( atd.getSchema().hasMatchingRuleDescription( names[i] ) )
+                    if ( getSchema().hasMatchingRuleDescription( mrdName ) )
                     {
-                        MatchingRuleDescription mrd = atd.getSchema().getMatchingRuleDescription( names[i] );
-                        otherMatchLinks[i] = toolkit.createHyperlink( otherMatchClient, mrd.toString(), SWT.WRAP );
-                        otherMatchLinks[i].setHref( mrd );
-                        otherMatchLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                        otherMatchLinks[i].setUnderlined( true );
-                        otherMatchLinks[i].setEnabled( true );
-                        otherMatchLinks[i].addHyperlinkListener( this );
+                        MatchingRuleDescription mrd = getSchema().getMatchingRuleDescription( mrdName );
+                        Hyperlink otherMatchLink = toolkit.createHyperlink( otherMatchClient, SchemaUtils
+                            .toString( mrd ), SWT.WRAP );
+                        otherMatchLink.setHref( mrd );
+                        otherMatchLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        otherMatchLink.setUnderlined( true );
+                        otherMatchLink.setEnabled( true );
+                        otherMatchLink.addHyperlinkListener( this );
                     }
                     else
                     {
-                        otherMatchLinks[i] = toolkit.createHyperlink( otherMatchClient, names[i], SWT.WRAP );
-                        otherMatchLinks[i].setHref( null );
-                        otherMatchLinks[i].setUnderlined( false );
-                        otherMatchLinks[i].setEnabled( false );
+                        Hyperlink otherMatchLink = toolkit.createHyperlink( otherMatchClient, mrdName, SWT.WRAP );
+                        otherMatchLink.setHref( null );
+                        otherMatchLink.setUnderlined( false );
+                        otherMatchLink.setEnabled( false );
                     }
                 }
             }
             else
             {
                 otherMatchSection.setText( "Other Matching Rules (0)" );
-                otherMatchLinks = new Hyperlink[0];
                 Text otherText = toolkit.createText( otherMatchClient, getNonNullString( null ), SWT.NONE );
                 otherText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 otherText.setEditable( false );
@@ -585,14 +574,15 @@
         // or a dash if no supertype exists.
         if ( atd != null )
         {
-            String superName = atd.getSuperiorAttributeTypeDescriptionName();
-            if ( superName != null )
+            String superType = atd.getSuperType();
+            if ( superType != null )
             {
                 supertypeSection.setText( "Supertype (" + "1" + ")" );
-                if ( atd.getSchema().hasAttributeTypeDescription( superName ) )
+                if ( getSchema().hasAttributeTypeDescription( superType ) )
                 {
-                    AttributeTypeDescription supAtd = atd.getSchema().getAttributeTypeDescription( superName );
-                    superLink = toolkit.createHyperlink( superClient, supAtd.toString(), SWT.WRAP );
+                    AttributeTypeDescription supAtd = getSchema().getAttributeTypeDescription( superType );
+                    Hyperlink superLink = toolkit.createHyperlink( superClient, SchemaUtils.toString( supAtd ),
+                        SWT.WRAP );
                     superLink.setHref( supAtd );
                     superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                     superLink.setUnderlined( true );
@@ -601,7 +591,7 @@
                 }
                 else
                 {
-                    superLink = toolkit.createHyperlink( superClient, superName, SWT.WRAP );
+                    Hyperlink superLink = toolkit.createHyperlink( superClient, superType, SWT.WRAP );
                     superLink.setHref( null );
                     superLink.setUnderlined( false );
                     superLink.setEnabled( false );
@@ -610,7 +600,6 @@
             else
             {
                 supertypeSection.setText( "Supertype (0)" );
-                superLink = null;
                 Text supText = toolkit.createText( superClient, getNonNullString( null ), SWT.NONE );
                 supText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 supText.setEditable( false );
@@ -648,25 +637,25 @@
         // 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 )
+            Collection<AttributeTypeDescription> derivedAtds = SchemaUtils.getDerivedAttributeTypeDescriptions( atd,
+                getSchema() );
+            if ( derivedAtds != null && derivedAtds.size() > 0 )
             {
-                subtypesSection.setText( "Subtypes (" + subATDs.length + ")" );
-                subAttributeTypeLinks = new Hyperlink[subATDs.length];
-                for ( int i = 0; i < subATDs.length; i++ )
+                subtypesSection.setText( "Subtypes (" + derivedAtds.size() + ")" );
+                for ( AttributeTypeDescription derivedAtd : derivedAtds )
                 {
-                    subAttributeTypeLinks[i] = toolkit.createHyperlink( subClient, subATDs[i].toString(), SWT.WRAP );
-                    subAttributeTypeLinks[i].setHref( subATDs[i] );
-                    subAttributeTypeLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    subAttributeTypeLinks[i].setUnderlined( true );
-                    subAttributeTypeLinks[i].setEnabled( true );
-                    subAttributeTypeLinks[i].addHyperlinkListener( this );
+                    Hyperlink subAttributeTypeLink = toolkit.createHyperlink( subClient, SchemaUtils
+                        .toString( derivedAtd ), SWT.WRAP );
+                    subAttributeTypeLink.setHref( derivedAtd );
+                    subAttributeTypeLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    subAttributeTypeLink.setUnderlined( true );
+                    subAttributeTypeLink.setEnabled( true );
+                    subAttributeTypeLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 subtypesSection.setText( "Subtypes (0)" );
-                subAttributeTypeLinks = new Hyperlink[0];
                 Text subText = toolkit.createText( subClient, getNonNullString( null ), SWT.NONE );
                 subText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 subText.setEditable( false );
@@ -705,25 +694,24 @@
         // create new content, either links to objectclasses or a dash
         if ( atd != null )
         {
-            ObjectClassDescription[] usedAsMusts = atd.getUsedAsMust();
-            if ( usedAsMusts != null && usedAsMusts.length > 0 )
+            Collection<ObjectClassDescription> usedAsMusts = SchemaUtils.getUsedAsMust( atd, getSchema() );
+            if ( usedAsMusts != null && usedAsMusts.size() > 0 )
             {
-                usedAsMustSection.setText( "Used as MUST (" + usedAsMusts.length + ")" );
-                usedAsMustLinks = new Hyperlink[usedAsMusts.length];
-                for ( int i = 0; i < usedAsMusts.length; i++ )
+                usedAsMustSection.setText( "Used as MUST (" + usedAsMusts.size() + ")" );
+                for ( ObjectClassDescription ocd : usedAsMusts )
                 {
-                    usedAsMustLinks[i] = toolkit.createHyperlink( mustClient, usedAsMusts[i].toString(), SWT.WRAP );
-                    usedAsMustLinks[i].setHref( usedAsMusts[i] );
-                    usedAsMustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    usedAsMustLinks[i].setUnderlined( true );
-                    usedAsMustLinks[i].setEnabled( true );
-                    usedAsMustLinks[i].addHyperlinkListener( this );
+                    Hyperlink usedAsMustLink = toolkit.createHyperlink( mustClient, SchemaUtils.toString( ocd ),
+                        SWT.WRAP );
+                    usedAsMustLink.setHref( ocd );
+                    usedAsMustLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    usedAsMustLink.setUnderlined( true );
+                    usedAsMustLink.setEnabled( true );
+                    usedAsMustLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 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 ) );
                 mustText.setEditable( false );
@@ -762,25 +750,24 @@
         // create new content, either links to objectclasses or a dash
         if ( atd != null )
         {
-            ObjectClassDescription[] usedAsMays = atd.getUsedAsMay();
-            if ( usedAsMays != null && usedAsMays.length > 0 )
+            Collection<ObjectClassDescription> usedAsMays = SchemaUtils.getUsedAsMay( atd, getSchema() );
+            if ( usedAsMays != null && usedAsMays.size() > 0 )
             {
-                usedAsMaySection.setText( "Used as MAY (" + usedAsMays.length + ")" );
-                usedAsMayLinks = new Hyperlink[usedAsMays.length];
-                for ( int i = 0; i < usedAsMays.length; i++ )
+                usedAsMaySection.setText( "Used as MAY (" + usedAsMays.size() + ")" );
+                for ( ObjectClassDescription ocd : usedAsMays )
                 {
-                    usedAsMayLinks[i] = toolkit.createHyperlink( mayClient, usedAsMays[i].toString(), SWT.WRAP );
-                    usedAsMayLinks[i].setHref( usedAsMays[i] );
-                    usedAsMayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    usedAsMayLinks[i].setUnderlined( true );
-                    usedAsMayLinks[i].setEnabled( true );
-                    usedAsMayLinks[i].addHyperlinkListener( this );
+                    Hyperlink usedAsMayLink = toolkit
+                        .createHyperlink( mayClient, SchemaUtils.toString( ocd ), SWT.WRAP );
+                    usedAsMayLink.setHref( ocd );
+                    usedAsMayLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    usedAsMayLink.setUnderlined( true );
+                    usedAsMayLink.setEnabled( true );
+                    usedAsMayLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 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 ) );
                 mayText.setEditable( false );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/AttributeTypeDescriptionPage.java Tue Mar 25 16:05:04 2008
@@ -21,8 +21,10 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -121,7 +123,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class ATDContentProvider implements IStructuredContentProvider
+    class ATDContentProvider implements IStructuredContentProvider
     {
         /**
          * {@inheritDoc}
@@ -133,7 +135,7 @@
                 Schema schema = ( Schema ) inputElement;
                 if ( schema != null )
                 {
-                    return schema.getAttributeTypeDescriptions();
+                    return schema.getAttributeTypeDescriptions().toArray();
                 }
             }
             return new Object[0];
@@ -162,13 +164,17 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class ATDLabelProvider extends LabelProvider implements ITableLabelProvider
+    class ATDLabelProvider extends LabelProvider implements ITableLabelProvider
     {
         /**
          * {@inheritDoc}
          */
         public String getColumnText( Object obj, int index )
         {
+            if ( obj instanceof AttributeTypeDescription )
+            {
+                return SchemaUtils.toString( ( AbstractSchemaDescription ) obj );
+            }
             return obj.toString();
         }
 
@@ -188,13 +194,21 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class ATDViewerSorter extends ViewerSorter
+    class ATDViewerSorter extends ViewerSorter
     {
         /**
          * {@inheritDoc}
          */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
+            if ( e1 instanceof AttributeTypeDescription )
+            {
+                e1 = SchemaUtils.toString( ( AbstractSchemaDescription ) e1 );
+            }
+            if ( e2 instanceof AttributeTypeDescription )
+            {
+                e2 = SchemaUtils.toString( ( AbstractSchemaDescription ) e2 );
+            }
             return e1.toString().compareTo( e2.toString() );
         }
     }
@@ -205,7 +219,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class ATDViewerFilter extends ViewerFilter
+    class ATDViewerFilter extends ViewerFilter
     {
         /**
          * {@inheritDoc}
@@ -215,13 +229,9 @@
             if ( element instanceof AttributeTypeDescription )
             {
                 AttributeTypeDescription atd = ( AttributeTypeDescription ) element;
-                boolean matched = false;
-
-                if ( !matched )
-                    matched = atd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-                if ( !matched )
-                    matched = atd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-
+                boolean matched = SchemaUtils.toString( atd ).toLowerCase()
+                    .indexOf( filterText.getText().toLowerCase() ) != -1
+                    || atd.getNumericOid().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
                 return matched;
             }
             return false;

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,8 +21,11 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -49,18 +52,9 @@
     /** The main section, contains oid and desc */
     private Section mainSection;
 
-    /** 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;
-
 
     /**
      * Creates a new instance of LdapSyntaxDescriptionDetailsPage.
@@ -106,7 +100,7 @@
             }
         } );
 
-        // create raw aection
+        // create raw section
         createRawSection();
     }
 
@@ -155,12 +149,13 @@
         if ( lsd != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
-            numericOidText = toolkit.createText( mainClient, getNonNullString( lsd.getNumericOID() ), SWT.NONE );
+            Text numericOidText = toolkit.createText( mainClient, getNonNullString( lsd.getNumericOid() ), SWT.NONE );
             numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             numericOidText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
-            descText = toolkit.createText( mainClient, getNonNullString( lsd.getDesc() ), SWT.WRAP | SWT.MULTI );
+            Text descText = toolkit.createText( mainClient, getNonNullString( lsd.getDescription() ), SWT.WRAP
+                | SWT.MULTI );
             GridData gd = new GridData( GridData.FILL_HORIZONTAL );
             gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
             descText.setLayoutData( gd );
@@ -194,25 +189,24 @@
         // create content
         if ( lsd != null )
         {
-            AttributeTypeDescription[] usedFromATDs = lsd.getUsedFromAttributeTypeDescription();
-            if ( usedFromATDs != null && usedFromATDs.length > 0 )
+            Collection<AttributeTypeDescription> usedFromATDs = SchemaUtils.getUsedFromAttributeTypeDescriptions( lsd,
+                getSchema() );
+            if ( usedFromATDs != null && !usedFromATDs.isEmpty() )
             {
-                usedFromSection.setText( "Used from (" + usedFromATDs.length + ")" );
-                usedFromLinks = new Hyperlink[usedFromATDs.length];
-                for ( int i = 0; i < usedFromATDs.length; i++ )
+                usedFromSection.setText( "Used from (" + usedFromATDs.size() + ")" );
+                for ( AttributeTypeDescription atd : usedFromATDs )
                 {
-                    usedFromLinks[i] = toolkit.createHyperlink( usedFromClient, usedFromATDs[i].toString(), SWT.WRAP );
-                    usedFromLinks[i].setHref( usedFromATDs[i] );
-                    usedFromLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    usedFromLinks[i].setUnderlined( true );
-                    usedFromLinks[i].setEnabled( true );
-                    usedFromLinks[i].addHyperlinkListener( this );
+                    Hyperlink usedFromLink = toolkit.createHyperlink( usedFromClient, SchemaUtils.toString( atd ), SWT.WRAP );
+                    usedFromLink.setHref( atd );
+                    usedFromLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    usedFromLink.setUnderlined( true );
+                    usedFromLink.setEnabled( true );
+                    usedFromLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 usedFromSection.setText( "Used from (0)" );
-                usedFromLinks = new Hyperlink[0];
                 Text usedFromText = toolkit.createText( usedFromClient, getNonNullString( null ), SWT.NONE );
                 usedFromText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 usedFromText.setEditable( false );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/LdapSyntaxDescriptionPage.java Tue Mar 25 16:05:04 2008
@@ -21,11 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -124,7 +122,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class LSDContentProvider implements IStructuredContentProvider
+    class LSDContentProvider implements IStructuredContentProvider
     {
         /**
          * {@inheritDoc}
@@ -134,10 +132,9 @@
             if ( inputElement instanceof Schema )
             {
                 Schema schema = ( Schema ) inputElement;
-                if ( schema != null && schema.getLsdMapByNumericOID() != null )
+                if ( schema != null && schema.getLdapSyntaxDescriptions() != null )
                 {
-                    Set<Object> set = new HashSet<Object>( schema.getLsdMapByNumericOID().values() );
-                    return set.toArray();
+                    return schema.getLdapSyntaxDescriptions().toArray();
                 }
             }
             return new Object[0];
@@ -166,13 +163,17 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class LSDLabelProvider extends LabelProvider implements ITableLabelProvider
+    class LSDLabelProvider extends LabelProvider implements ITableLabelProvider
     {
         /**
          * {@inheritDoc}
          */
         public String getColumnText( Object obj, int index )
         {
+            if ( obj instanceof LdapSyntaxDescription )
+            {
+                return SchemaUtils.toString( ( LdapSyntaxDescription ) obj );
+            }
             return obj.toString();
         }
 
@@ -192,13 +193,21 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class LSDViewerSorter extends ViewerSorter
+    class LSDViewerSorter extends ViewerSorter
     {
         /**
          * {@inheritDoc}
          */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
+            if ( e1 instanceof LdapSyntaxDescription )
+            {
+                e1 = SchemaUtils.toString( ( LdapSyntaxDescription ) e1 );
+            }
+            if ( e2 instanceof LdapSyntaxDescription )
+            {
+                e2 = SchemaUtils.toString( ( LdapSyntaxDescription ) e2 );
+            }
             return e1.toString().compareTo( e2.toString() );
         }
     }
@@ -209,7 +218,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class LSDViewerFilter extends ViewerFilter
+    class LSDViewerFilter extends ViewerFilter
     {
         /**
          * {@inheritDoc}
@@ -219,13 +228,9 @@
             if ( element instanceof LdapSyntaxDescription )
             {
                 LdapSyntaxDescription lsd = ( LdapSyntaxDescription ) element;
-                boolean matched = false;
-
-                if ( !matched )
-                    matched = lsd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-                if ( !matched )
-                    matched = lsd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-
+                boolean matched = SchemaUtils.toString( lsd ).toLowerCase()
+                    .indexOf( filterText.getText().toLowerCase() ) != -1
+                    || lsd.getNumericOid().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
                 return matched;
             }
             return false;

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,9 +21,13 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+import java.util.Collection;
+
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -78,9 +82,6 @@
     /** The used from section, contains links to attribute types */
     private Section usedFromSection;
 
-    /** The links to attribute types using the matching rule */
-    private Hyperlink[] usedFromLinks;
-
 
     /**
      * Creates a new instance of MatchingRuleDescriptionDetailsPage.
@@ -200,17 +201,18 @@
         LdapSyntaxDescription lsd = null;
         if ( mrd != null )
         {
-            lsdOid = mrd.getSyntaxDescriptionNumericOID();
-            if ( lsdOid != null && mrd.getSchema().hasLdapSyntaxDescription( lsdOid ) )
+            Schema schema = getSchema();
+            lsdOid = mrd.getSyntax();
+            if ( lsdOid != null && schema.hasLdapSyntaxDescription( lsdOid ) )
             {
-                lsd = mrd.getSchema().getLdapSyntaxDescription( lsdOid );
+                lsd = schema.getLdapSyntaxDescription( lsdOid );
             }
         }
-        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOID() : lsdOid ) );
+        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOid() : lsdOid ) );
         syntaxLink.setHref( lsd );
         syntaxLink.setUnderlined( lsd != null );
         syntaxLink.setEnabled( lsd != null );
-        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
+        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDescription() : null ) );
         syntaxSection.layout();
 
         // create contents of dynamic sections
@@ -246,17 +248,17 @@
         if ( mrd != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
-            numericOidText = toolkit.createText( mainClient, getNonNullString( mrd.getNumericOID() ), SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( mrd.getNumericOid() ), SWT.NONE );
             numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             numericOidText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Matching rule names:", SWT.NONE );
-            namesText = toolkit.createText( mainClient, getNonNullString( mrd.toString() ), SWT.NONE );
+            namesText = toolkit.createText( mainClient, getNonNullString( SchemaUtils.toString( mrd ) ), SWT.NONE );
             namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             namesText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
-            descText = toolkit.createText( mainClient, getNonNullString( mrd.getDesc() ), SWT.WRAP | SWT.MULTI );
+            descText = toolkit.createText( mainClient, getNonNullString( mrd.getDescription() ), SWT.WRAP | SWT.MULTI );
             GridData gd = new GridData( GridData.FILL_HORIZONTAL );
             gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
             descText.setLayoutData( gd );
@@ -290,25 +292,23 @@
         // create new content
         if ( mrd != null )
         {
-            AttributeTypeDescription[] usedFromATDs = mrd.getUsedFromAttributeTypeDescriptions();
-            if ( usedFromATDs != null && usedFromATDs.length > 0 )
+            Collection<AttributeTypeDescription> usedFromATDs = SchemaUtils.getUsedFromAttributeTypeDescriptions( mrd, getSchema() );
+            if ( usedFromATDs != null && usedFromATDs.size() > 0 )
             {
-                usedFromSection.setText( "Used from (" + usedFromATDs.length + ")" );
-                usedFromLinks = new Hyperlink[usedFromATDs.length];
-                for ( int i = 0; i < usedFromATDs.length; i++ )
+                usedFromSection.setText( "Used from (" + usedFromATDs.size() + ")" );
+                for ( AttributeTypeDescription atd : usedFromATDs )
                 {
-                    usedFromLinks[i] = toolkit.createHyperlink( usedFromClient, usedFromATDs[i].toString(), SWT.WRAP );
-                    usedFromLinks[i].setHref( usedFromATDs[i] );
-                    usedFromLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    usedFromLinks[i].setUnderlined( true );
-                    usedFromLinks[i].setEnabled( true );
-                    usedFromLinks[i].addHyperlinkListener( this );
+                    Hyperlink usedFromLink = toolkit.createHyperlink( usedFromClient, SchemaUtils.toString( atd ), SWT.WRAP );
+                    usedFromLink.setHref( atd );
+                    usedFromLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    usedFromLink.setUnderlined( true );
+                    usedFromLink.setEnabled( true );
+                    usedFromLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 usedFromSection.setText( "Used from (0)" );
-                usedFromLinks = new Hyperlink[0];
                 Text usedFromText = toolkit.createText( usedFromClient, getNonNullString( null ), SWT.NONE );
                 usedFromText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 usedFromText.setEditable( false );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java Tue Mar 25 16:05:04 2008
@@ -21,11 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -124,7 +122,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class MRDContentProvider implements IStructuredContentProvider
+    class MRDContentProvider implements IStructuredContentProvider
     {
         /**
          * {@inheritDoc}
@@ -134,10 +132,9 @@
             if ( inputElement instanceof Schema )
             {
                 Schema schema = ( Schema ) inputElement;
-                if ( schema != null && schema.getMrdMapByName() != null )
+                if ( schema != null && schema.getMatchingRuleDescriptions() != null )
                 {
-                    Set<Object> set = new HashSet<Object>( schema.getMrdMapByName().values() );
-                    return set.toArray();
+                    return schema.getMatchingRuleDescriptions().toArray();
                 }
             }
             return new Object[0];
@@ -166,13 +163,17 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class MRDLabelProvider extends LabelProvider implements ITableLabelProvider
+    class MRDLabelProvider extends LabelProvider implements ITableLabelProvider
     {
         /**
          * {@inheritDoc}
          */
         public String getColumnText( Object obj, int index )
         {
+            if ( obj instanceof MatchingRuleDescription )
+            {
+                return SchemaUtils.toString( ( MatchingRuleDescription ) obj );
+            }
             return obj.toString();
         }
 
@@ -192,13 +193,21 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class MRDViewerSorter extends ViewerSorter
+    class MRDViewerSorter extends ViewerSorter
     {
         /**
          * {@inheritDoc}
          */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
+            if ( e1 instanceof MatchingRuleDescription )
+            {
+                e1 = SchemaUtils.toString( ( MatchingRuleDescription ) e1 );
+            }
+            if ( e2 instanceof MatchingRuleDescription )
+            {
+                e2 = SchemaUtils.toString( ( MatchingRuleDescription ) e2 );
+            }
             return e1.toString().compareTo( e2.toString() );
         }
     }
@@ -209,7 +218,7 @@
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    private class MRDViewerFilter extends ViewerFilter
+    class MRDViewerFilter extends ViewerFilter
     {
         /**
          * {@inheritDoc}
@@ -219,13 +228,9 @@
             if ( element instanceof MatchingRuleDescription )
             {
                 MatchingRuleDescription mrd = ( MatchingRuleDescription ) element;
-                boolean matched = false;
-
-                if ( !matched )
-                    matched = mrd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-                if ( !matched )
-                    matched = mrd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-
+                boolean matched = SchemaUtils.toString( mrd ).toLowerCase()
+                    .indexOf( filterText.getText().toLowerCase() ) != -1
+                    || mrd.getNumericOid().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
                 return matched;
             }
             return false;

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,9 +21,13 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleUseDescription;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleUseDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -46,10 +50,10 @@
 
     /** The numeric oid field */
     private Text numericOidText;
-    
+
     /** The name link */
     private Hyperlink nameLink;
-    
+
     /** The description field */
     private Text descText;
 
@@ -62,9 +66,6 @@
     /** The applies section, contains links */
     private Section appliesSection;
 
-    /** The links to attribute types the matching rule is applicaple to */
-    private Hyperlink[] appliesLinks;
-
 
     /**
      * Creates a new instance of MatchingRuleUseDescriptionDetailsPage.
@@ -149,10 +150,10 @@
 
         // create main content
         this.createMainContent( mrud );
-        
+
         // set flag
         isObsoleteText.setEnabled( mrud != null && mrud.isObsolete() );
-        
+
         // create contents of dynamic sections
         this.createAppliesContents( mrud );
         super.createRawContents( mrud );
@@ -186,7 +187,7 @@
         if ( mrud != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
-            numericOidText = toolkit.createText( mainClient, getNonNullString( mrud.getNumericOID() ), SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( mrud.getNumericOid() ), SWT.NONE );
             numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             numericOidText.setEditable( false );
 
@@ -195,15 +196,17 @@
             nameLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             nameLink.addHyperlinkListener( this );
 
-            MatchingRuleDescription mrd = mrud.getSchema().hasMatchingRuleDescription( mrud.getNumericOID() ) ? mrud
-                .getSchema().getMatchingRuleDescription( mrud.getNumericOID() ) : null;
-            nameLink.setText( getNonNullString( mrd != null ? mrd.toString() : mrud.toString() ) );
+            Schema schema = getSchema();
+            MatchingRuleDescription mrd = schema.hasMatchingRuleDescription( mrud.getNumericOid() ) ? schema
+                .getMatchingRuleDescription( mrud.getNumericOid() ) : null;
+            nameLink
+                .setText( getNonNullString( mrd != null ? SchemaUtils.toString( mrd ) : SchemaUtils.toString( mrud ) ) );
             nameLink.setHref( mrd );
             nameLink.setUnderlined( mrd != null );
             nameLink.setEnabled( mrd != null );
 
             toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
-            descText = toolkit.createText( mainClient, getNonNullString( mrud.getDesc() ), SWT.WRAP | SWT.MULTI );
+            descText = toolkit.createText( mainClient, getNonNullString( mrud.getDescription() ), SWT.WRAP | SWT.MULTI );
             GridData gd = new GridData( GridData.FILL_HORIZONTAL );
             gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
             descText.setLayoutData( gd );
@@ -237,36 +240,36 @@
         // create content
         if ( mrud != null )
         {
-            String[] names = mrud.getAppliesAttributeTypeDescriptionOIDs();
-            if ( names != null && names.length > 0 )
+            List<String> names = mrud.getApplicableAttributes();
+            if ( names != null && !names.isEmpty() )
             {
-                appliesSection.setText( "Applies (" + names.length + ")" );
-                appliesLinks = new Hyperlink[names.length];
-                for ( int i = 0; i < names.length; i++ )
+                appliesSection.setText( "Applies (" + names.size() + ")" );
+                Schema schema = getSchema();
+                for ( String name : names )
                 {
-                    if ( mrud.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    if ( schema.hasAttributeTypeDescription( name ) )
                     {
-                        AttributeTypeDescription appliesAtd = mrud.getSchema().getAttributeTypeDescription( names[i] );
-                        appliesLinks[i] = toolkit.createHyperlink( appliesClient, appliesAtd.toString(), SWT.WRAP );
-                        appliesLinks[i].setHref( appliesAtd );
-                        appliesLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                        appliesLinks[i].setUnderlined( true );
-                        appliesLinks[i].setEnabled( true );
-                        appliesLinks[i].addHyperlinkListener( this );
+                        AttributeTypeDescription appliesAtd = schema.getAttributeTypeDescription( name );
+                        Hyperlink appliesLink = toolkit.createHyperlink( appliesClient, SchemaUtils
+                            .toString( appliesAtd ), SWT.WRAP );
+                        appliesLink.setHref( appliesAtd );
+                        appliesLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        appliesLink.setUnderlined( true );
+                        appliesLink.setEnabled( true );
+                        appliesLink.addHyperlinkListener( this );
                     }
                     else
                     {
-                        appliesLinks[i] = toolkit.createHyperlink( appliesClient, names[i], SWT.WRAP );
-                        appliesLinks[i].setHref( null );
-                        appliesLinks[i].setUnderlined( false );
-                        appliesLinks[i].setEnabled( false );
+                        Hyperlink appliesLink = toolkit.createHyperlink( appliesClient, name, SWT.WRAP );
+                        appliesLink.setHref( null );
+                        appliesLink.setUnderlined( false );
+                        appliesLink.setEnabled( false );
                     }
                 }
             }
             else
             {
                 appliesSection.setText( "Applies (0)" );
-                appliesLinks = new Hyperlink[0];
                 Text usedFromText = toolkit.createText( appliesClient, getNonNullString( null ), SWT.NONE );
                 usedFromText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 usedFromText.setEditable( false );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java Tue Mar 25 16:05:04 2008
@@ -21,11 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleUseDescription;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleUseDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -135,10 +133,9 @@
             if ( inputElement instanceof Schema )
             {
                 Schema schema = ( Schema ) inputElement;
-                if ( schema != null && schema.getMrudMapByName() != null )
+                if ( schema != null && schema.getMatchingRuleUseDescriptions() != null )
                 {
-                    Set<Object> set = new HashSet<Object>( schema.getMrudMapByName().values() );
-                    return set.toArray();
+                    return schema.getMatchingRuleUseDescriptions().toArray();
                 }
             }
             return new Object[0];
@@ -174,6 +171,10 @@
          */
         public String getColumnText( Object obj, int index )
         {
+            if ( obj instanceof MatchingRuleUseDescription )
+            {
+                return SchemaUtils.toString( ( MatchingRuleUseDescription ) obj );
+            }
             return obj.toString();
         }
 
@@ -200,6 +201,14 @@
          */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
+            if ( e1 instanceof MatchingRuleUseDescription )
+            {
+                e1 = SchemaUtils.toString( ( MatchingRuleUseDescription ) e1 );
+            }
+            if ( e2 instanceof MatchingRuleUseDescription )
+            {
+                e2 = SchemaUtils.toString( ( MatchingRuleUseDescription ) e2 );
+            }
             return e1.toString().compareTo( e2.toString() );
         }
     }
@@ -220,13 +229,8 @@
             if ( element instanceof MatchingRuleUseDescription )
             {
                 MatchingRuleUseDescription mrud = ( MatchingRuleUseDescription ) element;
-                boolean matched = false;
-
-                if ( !matched )
-                    matched = mrud.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-                if ( !matched )
-                    matched = mrud.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-
+                boolean matched = SchemaUtils.toString( mrud ).toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1
+                    || mrud.getNumericOid().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
                 return matched;
             }
             return false;



Mime
View raw message