directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r641069 [4/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/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.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/ObjectClassDescriptionDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,8 +21,12 @@
 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.ObjectClassDescription;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+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;
@@ -64,27 +68,15 @@
     /** The section with links to superior object classes */
     private Section superclassesSection;
 
-    /** The links to superior object classes */
-    private Hyperlink[] superLinks;
-
     /** The section with links to derived object classes */
     private Section subclassesSection;
 
-    /** The links to derived object classes */
-    private Hyperlink[] subLinks;
-
     /** The section with links to must attribute types */
     private Section mustSection;
 
-    /** The links to must attribute types */
-    private Hyperlink[] mustLinks;
-
     /** The section with links to may attribute types */
     private Section maySection;
 
-    /** The links to may attribute types */
-    private Hyperlink[] mayLinks;
-
 
     /**
      * Creates a new instance of ObjectClassDescriptionDetailsPage.
@@ -229,34 +221,34 @@
         if ( ocd != null )
         {
             toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
-            numericOidText = toolkit.createText( mainClient, getNonNullString( ocd.getNumericOID() ), SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( ocd.getNumericOid() ), SWT.NONE );
             numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             numericOidText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Objectclass names:", SWT.NONE );
-            namesText = toolkit.createText( mainClient, getNonNullString( ocd.toString() ), SWT.NONE );
+            namesText = toolkit.createText( mainClient, getNonNullString( SchemaUtils.toString( ocd ) ), SWT.NONE );
             namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
             namesText.setEditable( false );
 
             toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
-            descText = toolkit.createText( mainClient, getNonNullString( ocd.getDesc() ), SWT.WRAP | SWT.MULTI );
+            descText = toolkit.createText( mainClient, getNonNullString( ocd.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 );
 
             String kind = "";
-            if ( ocd.isStructural() )
-            {
-                kind = "structural";
-            }
-            else if ( ocd.isAbstract() )
-            {
-                kind = "abstract";
-            }
-            else if ( ocd.isAuxiliary() )
+            switch ( ocd.getKind() )
             {
-                kind = "auxiliary";
+                case STRUCTURAL:
+                    kind = "structural";
+                    break;
+                case ABSTRACT:
+                    kind = "abstract";
+                    break;
+                case AUXILIARY:
+                    kind = "auxiliary";
+                    break;
             }
             if ( ocd.isObsolete() )
             {
@@ -295,36 +287,34 @@
         // create new content
         if ( ocd != null )
         {
-            String[] names = ocd.getMustAttributeTypeDescriptionNamesTransitive();
-            if ( names != null && names.length > 0 )
+            Collection<String> names = SchemaUtils.getMustAttributeTypeDescriptionNamesTransitive( ocd, getSchema() );
+            if ( names != null && names.size() > 0 )
             {
-                mustSection.setText( "MUST Attributes (" + names.length + ")" );
-                mustLinks = new Hyperlink[names.length];
-                for ( int i = 0; i < names.length; i++ )
+                mustSection.setText( "MUST Attributes (" + names.size() + ")" );
+                for ( String name : names )
                 {
-                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    if ( getSchema().hasAttributeTypeDescription( name ) )
                     {
-                        AttributeTypeDescription mustAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
-                        mustLinks[i] = toolkit.createHyperlink( mustClient, mustAtd.toString(), SWT.WRAP );
-                        mustLinks[i].setHref( mustAtd );
-                        mustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                        mustLinks[i].setUnderlined( true );
-                        mustLinks[i].setEnabled( true );
-                        mustLinks[i].addHyperlinkListener( this );
+                        AttributeTypeDescription mustAtd = getSchema().getAttributeTypeDescription( name );
+                        Hyperlink mustLink = toolkit.createHyperlink( mustClient, SchemaUtils.toString( mustAtd ), SWT.WRAP );
+                        mustLink.setHref( mustAtd );
+                        mustLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        mustLink.setUnderlined( true );
+                        mustLink.setEnabled( true );
+                        mustLink.addHyperlinkListener( this );
                     }
                     else
                     {
-                        mustLinks[i] = toolkit.createHyperlink( mustClient, names[i], SWT.WRAP );
-                        mustLinks[i].setHref( null );
-                        mustLinks[i].setUnderlined( false );
-                        mustLinks[i].setEnabled( false );
+                        Hyperlink mustLink = toolkit.createHyperlink( mustClient, name, SWT.WRAP );
+                        mustLink.setHref( null );
+                        mustLink.setUnderlined( false );
+                        mustLink.setEnabled( false );
                     }
                 }
             }
             else
             {
                 mustSection.setText( "MUST Attributes (0)" );
-                mustLinks = new Hyperlink[0];
                 Text mustText = toolkit.createText( mustClient, getNonNullString( null ), SWT.NONE );
                 mustText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 mustText.setEditable( false );
@@ -362,36 +352,34 @@
         // create new content
         if ( ocd != null )
         {
-            String[] names = ocd.getMayAttributeTypeDescriptionNamesTransitive();
-            if ( names != null && names.length > 0 )
+            Collection<String> names = SchemaUtils.getMayAttributeTypeDescriptionNamesTransitive( ocd, getSchema() );
+            if ( names != null && names.size() > 0 )
             {
-                maySection.setText( "MAY Attributes (" + names.length + ")" );
-                mayLinks = new Hyperlink[names.length];
-                for ( int i = 0; i < names.length; i++ )
+                maySection.setText( "MAY Attributes (" + names.size() + ")" );
+                for ( String name : names )
                 {
-                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    if ( getSchema().hasAttributeTypeDescription( name ) )
                     {
-                        AttributeTypeDescription mayAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
-                        mayLinks[i] = toolkit.createHyperlink( mayClient, mayAtd.toString(), SWT.WRAP );
-                        mayLinks[i].setHref( mayAtd );
-                        mayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                        mayLinks[i].setUnderlined( true );
-                        mayLinks[i].setEnabled( true );
-                        mayLinks[i].addHyperlinkListener( this );
+                        AttributeTypeDescription mayAtd = getSchema().getAttributeTypeDescription( name );
+                        Hyperlink mayLink = toolkit.createHyperlink( mayClient, SchemaUtils.toString( mayAtd ), SWT.WRAP );
+                        mayLink.setHref( mayAtd );
+                        mayLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        mayLink.setUnderlined( true );
+                        mayLink.setEnabled( true );
+                        mayLink.addHyperlinkListener( this );
                     }
                     else
                     {
-                        mayLinks[i] = toolkit.createHyperlink( mayClient, names[i], SWT.WRAP );
-                        mayLinks[i].setHref( null );
-                        mayLinks[i].setUnderlined( false );
-                        mayLinks[i].setEnabled( false );
+                        Hyperlink mayLink = toolkit.createHyperlink( mayClient, name, SWT.WRAP );
+                        mayLink.setHref( null );
+                        mayLink.setUnderlined( false );
+                        mayLink.setEnabled( false );
                     }
                 }
             }
             else
             {
                 maySection.setText( "MAY Attributes (0)" );
-                mayLinks = new Hyperlink[0];
                 Text mayText = toolkit.createText( mayClient, getNonNullString( null ), SWT.NONE );
                 mayText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 mayText.setEditable( false );
@@ -406,7 +394,7 @@
 
 
     /**
-     * Creates the content of the must section. 
+     * Creates the content of the sub classes section. 
      * It is newly created on every input change because the content
      * of this section is dynamic.
      *
@@ -428,25 +416,23 @@
         // create new content
         if ( ocd != null )
         {
-            ObjectClassDescription[] subOCDs = ocd.getSubObjectClassDescriptions();
-            if ( subOCDs != null && subOCDs.length > 0 )
+            List<ObjectClassDescription> subOcds = SchemaUtils.getSubObjectClassDescriptions( ocd, getSchema() );
+            if ( subOcds != null && subOcds.size() > 0 )
             {
-                subclassesSection.setText( "Subclasses (" + subOCDs.length + ")" );
-                subLinks = new Hyperlink[subOCDs.length];
-                for ( int i = 0; i < subOCDs.length; i++ )
+                subclassesSection.setText( "Subclasses (" + subOcds.size() + ")" );
+                for ( ObjectClassDescription subOcd : subOcds )
                 {
-                    subLinks[i] = toolkit.createHyperlink( subClient, subOCDs[i].toString(), SWT.WRAP );
-                    subLinks[i].setHref( subOCDs[i] );
-                    subLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                    subLinks[i].setUnderlined( true );
-                    subLinks[i].setEnabled( true );
-                    subLinks[i].addHyperlinkListener( this );
+                    Hyperlink subLink = toolkit.createHyperlink( subClient, SchemaUtils.toString( subOcd ), SWT.WRAP );
+                    subLink.setHref( subOcd );
+                    subLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    subLink.setUnderlined( true );
+                    subLink.setEnabled( true );
+                    subLink.addHyperlinkListener( this );
                 }
             }
             else
             {
                 subclassesSection.setText( "Subclasses (0)" );
-                subLinks = new Hyperlink[0];
                 Text derivedText = toolkit.createText( subClient, getNonNullString( null ), SWT.NONE );
                 derivedText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 derivedText.setEditable( false );
@@ -462,7 +448,7 @@
 
 
     /**
-     * Creates the content of the must section. 
+     * Creates the content of the super classes section. 
      * It is newly created on every input change because the content
      * of this section is dynamic.
      *
@@ -481,44 +467,42 @@
         superClient.setLayout( new GridLayout() );
         superclassesSection.setClient( superClient );
 
-        // craete new content
+        // create new content
         if ( ocd != null )
         {
-            String[] names = ocd.getSuperiorObjectClassDescriptionNames();
-            if ( names != null && names.length > 0 )
+            List<String> names = ocd.getSuperiorObjectClasses();
+            if ( names != null && names.size() > 0 )
             {
-                superclassesSection.setText( "Superclasses (" + names.length + ")" );
+                superclassesSection.setText( "Superclasses (" + names.size() + ")" );
                 Composite supClient = toolkit.createComposite( superClient, SWT.WRAP );
                 GridLayout gl = new GridLayout();
                 gl.marginWidth = 0;
                 gl.marginHeight = 0;
                 supClient.setLayout( gl );
-                superLinks = new Hyperlink[names.length];
-                for ( int i = 0; i < names.length; i++ )
+                for ( String name : names )
                 {
-                    if ( ocd.getSchema().hasObjectClassDescription( names[i] ) )
+                    if ( getSchema().hasObjectClassDescription( name ) )
                     {
-                        ObjectClassDescription supOcd = ocd.getSchema().getObjectClassDescription( names[i] );
-                        superLinks[i] = toolkit.createHyperlink( supClient, supOcd.toString(), SWT.WRAP );
-                        superLinks[i].setHref( supOcd );
-                        superLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-                        superLinks[i].setUnderlined( true );
-                        superLinks[i].setEnabled( true );
-                        superLinks[i].addHyperlinkListener( this );
+                        ObjectClassDescription supOcd = getSchema().getObjectClassDescription( name );
+                        Hyperlink superLink = toolkit.createHyperlink( supClient, SchemaUtils.toString( supOcd ), SWT.WRAP );
+                        superLink.setHref( supOcd );
+                        superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        superLink.setUnderlined( true );
+                        superLink.setEnabled( true );
+                        superLink.addHyperlinkListener( this );
                     }
                     else
                     {
-                        superLinks[i] = toolkit.createHyperlink( supClient, names[i], SWT.WRAP );
-                        superLinks[i].setHref( null );
-                        superLinks[i].setUnderlined( false );
-                        superLinks[i].setEnabled( false );
+                        Hyperlink superLink = toolkit.createHyperlink( supClient, name, SWT.WRAP );
+                        superLink.setHref( null );
+                        superLink.setUnderlined( false );
+                        superLink.setEnabled( false );
                     }
                 }
             }
             else
             {
                 superclassesSection.setText( "Superclasses (0)" );
-                superLinks = new Hyperlink[0];
                 Text superText = toolkit.createText( superClient, getNonNullString( null ), SWT.NONE );
                 superText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                 superText.setEditable( false );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.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/ObjectClassDescriptionPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java Tue Mar 25 16:05:04 2008
@@ -21,8 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 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;
@@ -133,7 +134,7 @@
                 Schema schema = ( Schema ) inputElement;
                 if ( schema != null )
                 {
-                    return schema.getObjectClassDescriptions();
+                    return schema.getObjectClassDescriptions().toArray();
                 }
             }
             return new Object[0];
@@ -169,6 +170,10 @@
          */
         public String getColumnText( Object obj, int index )
         {
+            if ( obj instanceof ObjectClassDescription )
+            {
+                return SchemaUtils.toString( ( ObjectClassDescription ) obj );
+            }
             return obj.toString();
         }
 
@@ -195,6 +200,14 @@
          */
         public int compare( Viewer viewer, Object e1, Object e2 )
         {
+            if ( e1 instanceof ObjectClassDescription )
+            {
+                e1 = SchemaUtils.toString( ( ObjectClassDescription ) e1 );
+            }
+            if ( e2 instanceof ObjectClassDescription )
+            {
+                e2 = SchemaUtils.toString( ( ObjectClassDescription ) e2 );
+            }
             return e1.toString().compareTo( e2.toString() );
         }
     }
@@ -215,13 +228,9 @@
             if ( element instanceof ObjectClassDescription )
             {
                 ObjectClassDescription ocd = ( ObjectClassDescription ) element;
-                boolean matched = false;
-
-                if ( !matched )
-                    matched = ocd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-                if ( !matched )
-                    matched = ocd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
-
+                boolean matched = SchemaUtils.toString( ocd ).toLowerCase()
+                    .indexOf( filterText.getText().toLowerCase() ) != -1
+                    || ocd.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/SchemaBrowser.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.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/SchemaBrowser.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java Tue Mar 25 16:05:04 2008
@@ -21,13 +21,13 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+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.MatchingRuleUseDescription;
+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.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.MatchingRuleUseDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -204,7 +204,7 @@
             setConnection( connection );
 
             // set schema element and activate tab
-            SchemaPart schemaElement = sbi.getSchemaElement();
+            AbstractSchemaDescription schemaElement = sbi.getSchemaElement();
             if ( schemaElement instanceof ObjectClassDescription )
             {
                 ocdPage.select( schemaElement );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserInput.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/SchemaBrowserInput.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserInput.java Tue Mar 25 16:05:04 2008
@@ -21,10 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -57,7 +55,7 @@
     private IBrowserConnection connection;
     
     /** The schema element */
-    private SchemaPart schemaElement;
+    private AbstractSchemaDescription schemaElement;
     
     /** One instance hack flag */
     private static boolean oneInstanceHackEnabled = true;
@@ -66,10 +64,10 @@
     /**
      * Creates a new instance of SchemaBrowserInput.
      *
-     *@param connection the connection
+     * @param connection the connection
      * @param schemaElement the schema element input
      */
-    public SchemaBrowserInput( IBrowserConnection connection, SchemaPart schemaElement )
+    public SchemaBrowserInput( IBrowserConnection connection, AbstractSchemaDescription schemaElement )
     {
         this.connection = connection;
         this.schemaElement = schemaElement;
@@ -166,7 +164,7 @@
      *
      * @return the schema element or null
      */
-    public SchemaPart getSchemaElement()
+    public AbstractSchemaDescription getSchemaElement()
     {
         return schemaElement;
     }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserManager.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/SchemaBrowserManager.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserManager.java Tue Mar 25 16:05:04 2008
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 
@@ -47,7 +47,7 @@
      * @param connection the connection
      * @param schemaElement the schema element
      */
-    public static void setInput( IBrowserConnection connection, SchemaPart schemaElement )
+    public static void setInput( IBrowserConnection connection, AbstractSchemaDescription schemaElement )
     {
         SchemaBrowserInput input = new SchemaBrowserInput( connection, schemaElement );
         setInput( input );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserNavigationLocation.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/SchemaBrowserNavigationLocation.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowserNavigationLocation.java Tue Mar 25 16:05:04 2008
@@ -21,14 +21,14 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+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.MatchingRuleUseDescription;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 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.MatchingRuleUseDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.INavigationLocation;
@@ -60,32 +60,32 @@
      */
     public String getText()
     {
-        SchemaPart schemaElement = getSchemElement();
+        AbstractSchemaDescription schemaElement = getSchemElement();
         if ( schemaElement != null )
         {
-            if(schemaElement instanceof ObjectClassDescription)
+            if ( schemaElement instanceof ObjectClassDescription )
             {
                 return "Object Class " + schemaElement.toString();
             }
-            else if(schemaElement instanceof AttributeTypeDescription )
+            else if ( schemaElement instanceof AttributeTypeDescription )
             {
                 return "Attribute Type " + schemaElement.toString();
             }
-            else if(schemaElement instanceof LdapSyntaxDescription )
+            else if ( schemaElement instanceof LdapSyntaxDescription )
             {
                 return "Syntax " + schemaElement.toString();
             }
-            else if(schemaElement instanceof MatchingRuleDescription)
+            else if ( schemaElement instanceof MatchingRuleDescription )
             {
                 return "Matching Rule " + schemaElement.toString();
             }
-            else if(schemaElement instanceof MatchingRuleUseDescription )
+            else if ( schemaElement instanceof MatchingRuleUseDescription )
             {
                 return "Matching Rule Use " + schemaElement.toString();
             }
             else
             {
-                return schemaElement.getNumericOID();
+                return schemaElement.getNumericOid();
             }
         }
         else
@@ -101,10 +101,10 @@
     public void saveState( IMemento memento )
     {
         IBrowserConnection connection = getConnection();
-        SchemaPart schemaElement = getSchemElement();
+        AbstractSchemaDescription schemaElement = getSchemElement();
         memento.putString( "CONNECTION", connection.getConnection().getId() );
         memento.putString( "SCHEMAELEMENTYPE", schemaElement.getClass().getName() );
-        memento.putString( "SCHEMAELEMENTOID", schemaElement.getNumericOID() );
+        memento.putString( "SCHEMAELEMENTOID", schemaElement.getNumericOid() );
     }
 
 
@@ -117,29 +117,29 @@
             memento.getString( "CONNECTION" ) );
         String schemaElementType = memento.getString( "SCHEMAELEMENTYPE" );
         String schemaElementOid = memento.getString( "SCHEMAELEMENTOID" );
-        SchemaPart schemaElement = null;
-        if(ObjectClassDescription.class.getName().equals( schemaElementType ) )
+        AbstractSchemaDescription schemaElement = null;
+        if ( ObjectClassDescription.class.getName().equals( schemaElementType ) )
         {
             schemaElement = connection.getSchema().getObjectClassDescription( schemaElementOid );
         }
-        else if(AttributeTypeDescription.class.getName().equals( schemaElementType ) )
+        else if ( AttributeTypeDescription.class.getName().equals( schemaElementType ) )
         {
             schemaElement = connection.getSchema().getAttributeTypeDescription( schemaElementOid );
         }
-        else if(LdapSyntaxDescription.class.getName().equals( schemaElementType ) )
+        else if ( LdapSyntaxDescription.class.getName().equals( schemaElementType ) )
         {
             schemaElement = connection.getSchema().getLdapSyntaxDescription( schemaElementOid );
         }
-        else if(MatchingRuleDescription.class.getName().equals( schemaElementType ) )
+        else if ( MatchingRuleDescription.class.getName().equals( schemaElementType ) )
         {
             schemaElement = connection.getSchema().getMatchingRuleDescription( schemaElementOid );
         }
-        else if(MatchingRuleUseDescription.class.getName().equals( schemaElementType ) )
+        else if ( MatchingRuleUseDescription.class.getName().equals( schemaElementType ) )
         {
             schemaElement = connection.getSchema().getMatchingRuleUseDescription( schemaElementOid );
         }
-        
-        super.setInput( new SchemaBrowserInput( connection, schemaElement  ) );
+
+        super.setInput( new SchemaBrowserInput( connection, schemaElement ) );
     }
 
 
@@ -153,10 +153,10 @@
         {
             SchemaBrowser schemaBrowser = ( SchemaBrowser ) editorPart;
             Object input = getInput();
-            if(input != null && input instanceof SchemaBrowserInput)
+            if ( input != null && input instanceof SchemaBrowserInput )
             {
-                SchemaBrowserInput sbi = (SchemaBrowserInput)input;
-                if(sbi.getConnection() != null && sbi.getSchemaElement() != null) 
+                SchemaBrowserInput sbi = ( SchemaBrowserInput ) input;
+                if ( sbi.getConnection() != null && sbi.getSchemaElement() != null )
                 {
                     schemaBrowser.setInput( sbi );
                 }
@@ -181,8 +181,8 @@
         }
 
         SchemaBrowserNavigationLocation location = ( SchemaBrowserNavigationLocation ) currentLocation;
-        SchemaPart other = location.getSchemElement();
-        SchemaPart element = getSchemElement();
+        AbstractSchemaDescription other = location.getSchemElement();
+        AbstractSchemaDescription element = getSchemElement();
 
         if ( other == null && element == null )
         {
@@ -212,14 +212,14 @@
      *
      * @return the schema element
      */
-    private SchemaPart getSchemElement()
+    private AbstractSchemaDescription getSchemElement()
     {
 
         Object editorInput = getInput();
         if ( editorInput != null && editorInput instanceof SchemaBrowserInput )
         {
             SchemaBrowserInput schemaBrowserInput = ( SchemaBrowserInput ) editorInput;
-            SchemaPart schemaElement = schemaBrowserInput.getSchemaElement();
+            AbstractSchemaDescription schemaElement = schemaBrowserInput.getSchemaElement();
             if ( schemaElement != null )
             {
                 return schemaElement;
@@ -237,18 +237,18 @@
      */
     private IBrowserConnection getConnection()
     {
-        
+
         Object editorInput = getInput();
         if ( editorInput != null && editorInput instanceof SchemaBrowserInput )
         {
             SchemaBrowserInput schemaBrowserInput = ( SchemaBrowserInput ) editorInput;
             return schemaBrowserInput.getConnection();
         }
-        
+
         return null;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaDetailsPage.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/SchemaDetailsPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaDetailsPage.java Tue Mar 25 16:05:04 2008
@@ -21,7 +21,11 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
+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;
@@ -88,10 +92,10 @@
     public void linkActivated( HyperlinkEvent e )
     {
         Object obj = e.getHref();
-        if ( obj instanceof SchemaPart )
+        if ( obj instanceof AbstractSchemaDescription )
         {
             schemaPage.getSchemaBrowser().setInput(
-                new SchemaBrowserInput( schemaPage.getConnection(), ( SchemaPart ) obj ) );
+                new SchemaBrowserInput( schemaPage.getConnection(), ( AbstractSchemaDescription ) obj ) );
         }
     }
 
@@ -154,7 +158,7 @@
      *
      * @param schemaPart the schema part to display
      */
-    protected void createRawContents( SchemaPart schemaPart )
+    protected void createRawContents( AbstractSchemaDescription asd )
     {
 
         if ( rawSection.getClient() != null && !rawSection.getClient().isDisposed() )
@@ -166,9 +170,9 @@
         client.setLayout( new GridLayout() );
         rawSection.setClient( client );
 
-        if ( schemaPart != null )
+        if ( asd != null )
         {
-            rawText = toolkit.createText( client, getNonNullString( schemaPart.getLine().getValueAsString() ), SWT.WRAP
+            rawText = toolkit.createText( client, getNonNullString( SchemaUtils.getLdifLine( asd ) ), SWT.WRAP
                 | SWT.MULTI );
             GridData gd2 = new GridData( GridData.FILL_HORIZONTAL );
             gd2.widthHint = detailForm.getForm().getSize().x - 100 - 60;
@@ -184,6 +188,17 @@
 
 
     /**
+     * Gets the schema.
+     * 
+     * @return the schema
+     */
+    protected Schema getSchema()
+    {
+        return schemaPage.getConnection().getSchema();
+    }
+
+
+    /**
      * Helper method, return a dash "-" if the given string is null. 
      *
      * @param s the string
@@ -192,6 +207,23 @@
     protected String getNonNullString( String s )
     {
         return s == null ? "-" : s;
+    }
+
+
+    /**
+     * Helper method, return a dash "-" if the given string is null. 
+     *
+     * @param s the string
+     * @return the given string or a dash "-" if the given string is null.
+     */
+    private String getNonNullString( List<String> s )
+    {
+        if ( s == null || s.isEmpty() )
+        {
+            return "-";
+        }
+
+        return s.get( 0 );
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaPage.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/SchemaPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaPage.java Tue Mar 25 16:05:04 2008
@@ -21,9 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.viewers.ISelection;
@@ -46,7 +46,7 @@
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.IFormColors;
 import org.eclipse.ui.forms.widgets.Form;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.ScrolledForm;
@@ -324,7 +324,7 @@
         this.detailForm.setExpandHorizontal( true );
         this.detailForm.setExpandVertical( true );
         this.detailForm.setBackground( this.toolkit.getColors().getBackground() );
-        this.detailForm.setForeground( this.toolkit.getColors().getColor( FormColors.TITLE ) );
+        this.detailForm.setForeground( this.toolkit.getColors().getColor( IFormColors.TITLE ) );
         this.detailForm.setFont( JFaceResources.getHeaderFont() );
         this.sashForm.setWeights( new int[]
             { 50, 50 } );
@@ -350,9 +350,9 @@
 
                     // Do not set the input of the schema browser if 
                     // the selection was changed programatically.
-                    if ( !inChange && obj instanceof SchemaPart )
+                    if ( !inChange && obj instanceof AbstractSchemaDescription )
                     {
-                        schemaBrowser.setInput( new SchemaBrowserInput( getConnection(), ( SchemaPart ) obj ) );
+                        schemaBrowser.setInput( new SchemaBrowserInput( getConnection(), ( AbstractSchemaDescription ) obj ) );
                     }
                 }
             }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java Tue Mar 25 16:05:04 2008
@@ -22,11 +22,12 @@
 
 
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
@@ -34,7 +35,8 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
-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.eclipse.jface.fieldassist.DecoratedField;
@@ -112,6 +114,22 @@
     private LabelProvider labelProvider = new LabelProvider()
     {
         /* (non-Javadoc)
+         * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+         */
+        public String getText( Object element )
+        {
+            if ( element instanceof ObjectClassDescription )
+            {
+                ObjectClassDescription ocd = ( ObjectClassDescription ) element;
+                return SchemaUtils.toString( ocd );
+            }
+            
+            // Default
+            return super.getText( element );
+        }
+        
+        
+        /* (non-Javadoc)
          * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
          */
         public Image getImage( Object element )
@@ -119,22 +137,16 @@
             if ( element instanceof ObjectClassDescription )
             {
                 ObjectClassDescription ocd = ( ObjectClassDescription ) element;
-
-                if ( ocd.isAbstract() )
-                {
-                    return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_ABSTRACT );
-                }
-                else if ( ocd.isAuxiliary() )
-                {
-                    return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_AUXILIARY );
-                }
-                else if ( ocd.isStructural() )
-                {
-                    return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_STRUCTURAL );
-                }
-                else
+                switch ( ocd.getKind() )
                 {
-                    return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD );
+                    case STRUCTURAL:
+                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_STRUCTURAL );
+                    case ABSTRACT:
+                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_ABSTRACT );
+                    case AUXILIARY:
+                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_AUXILIARY );
+                    default:
+                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD );
                 }
             }
 
@@ -174,7 +186,7 @@
             boolean hasOneStructuralOC = false;
             for ( ObjectClassDescription ocd : selectedObjectClasses )
             {
-                if ( ocd.isStructural() )
+                if ( ocd.getKind() == ObjectClassTypeEnum.STRUCTURAL )
                 {
                     hasOneStructuralOC = true;
                     break;
@@ -217,8 +229,8 @@
             //                RunnableContextJobAdapter.execute( job, getContainer() );
             //            }
 
-            availableObjectClasses.addAll( Arrays.asList( wizard.getSelectedConnection().getSchema()
-                .getObjectClassDescriptions() ) );
+            availableObjectClasses.addAll( wizard.getSelectedConnection().getSchema()
+                .getObjectClassDescriptions() );
 
             DummyEntry newEntry = wizard.getPrototypeEntry();
             IAttribute ocAttribute = newEntry.getAttribute( IAttribute.OBJECTCLASS_ATTRIBUTE );
@@ -260,14 +272,13 @@
                 newEntry.addAttribute( ocAttribute );
             }
             IValue[] values = ocAttribute.getValues();
-            for ( int i = 0; i < values.length; i++ )
+            for ( IValue value : values )
             {
-                ocAttribute.deleteValue( values[i] );
+                ocAttribute.deleteValue( value );
             }
-            for ( Iterator<ObjectClassDescription> it = selectedObjectClasses.iterator(); it.hasNext(); )
+            for ( ObjectClassDescription ocd : selectedObjectClasses )
             {
-                ObjectClassDescription ocd = it.next();
-                ocAttribute.addValue( new Value( ocAttribute, ocd.getNames()[0] ) );
+                ocAttribute.addValue( new Value( ocAttribute, ocd.getNames().get( 0 ) ) );
             }
         }
         finally
@@ -458,7 +469,8 @@
     private void add( ISelection iselection )
     {
         IStructuredSelection selection = ( IStructuredSelection ) iselection;
-        Iterator it = selection.iterator();
+        Schema schema = wizard.getSelectedConnection().getSchema();
+        Iterator<?> it = selection.iterator();
         while ( it.hasNext() )
         {
             ObjectClassDescription ocd = ( ObjectClassDescription ) it.next();
@@ -468,8 +480,8 @@
                 selectedObjectClasses.add( ocd );
 
                 // recursively add superior object classes
-                ObjectClassDescription[] superiorObjectClassDescriptions = ocd.getSuperiorObjectClassDescriptions();
-                if ( superiorObjectClassDescriptions.length > 0 )
+                List<ObjectClassDescription> superiorObjectClassDescriptions = SchemaUtils.getSuperiorObjectClassDescriptions( ocd, schema );
+                if ( !superiorObjectClassDescriptions.isEmpty() )
                 {
                     add( new StructuredSelection( superiorObjectClassDescriptions ) );
                 }
@@ -497,7 +509,8 @@
     private void remove( ISelection iselection )
     {
         IStructuredSelection selection = ( IStructuredSelection ) iselection;
-        Iterator it = selection.iterator();
+        Schema schema = wizard.getSelectedConnection().getSchema();
+        Iterator<?> it = selection.iterator();
         while ( it.hasNext() )
         {
             ObjectClassDescription ocd = ( ObjectClassDescription ) it.next();
@@ -507,8 +520,8 @@
                 availableObjectClasses.add( ocd );
 
                 // recursively remove sub object classes
-                ObjectClassDescription[] subObjectClassDescriptions = ocd.getSubObjectClassDescriptions();
-                if ( subObjectClassDescriptions.length > 0 )
+                List<ObjectClassDescription> subObjectClassDescriptions = SchemaUtils.getSuperiorObjectClassDescriptions( ocd, schema );
+                if ( !subObjectClassDescriptions.isEmpty() )
                 {
                     remove( new StructuredSelection( subObjectClassDescriptions ) );
                 }
@@ -558,10 +571,9 @@
             if ( element instanceof ObjectClassDescription )
             {
                 ObjectClassDescription ocd = ( ObjectClassDescription ) element;
-                Set<String> lowerCaseIdentifierSet = ocd.getLowerCaseIdentifierSet();
-                for ( Iterator<String> it = lowerCaseIdentifierSet.iterator(); it.hasNext(); )
+                Collection<String> lowerCaseIdentifiers = SchemaUtils.getLowerCaseIdentifiers( ocd );
+                for ( String s : lowerCaseIdentifiers )
                 {
-                    String s = it.next();
                     if ( s.toLowerCase().startsWith( filterText.getText().toLowerCase() ) )
                     {
                         return true;

Modified: directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifCompletionProcessor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifCompletionProcessor.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifCompletionProcessor.java (original)
+++ directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/text/LdifCompletionProcessor.java Tue Mar 25 16:05:04 2008
@@ -27,6 +27,7 @@
 
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 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.ldifeditor.LdifEditorActivator;
 import org.apache.directory.studio.ldifeditor.LdifEditorConstants;
 import org.apache.directory.studio.ldifeditor.editor.ILdifEditor;
@@ -105,7 +106,7 @@
         contentAssistant.setAutoActivationDelay( store
             .getInt( LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_AUTOACTIVATIONDELAY ) );
 
-        List proposalList = new ArrayList();
+        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
 
         LdifFile model = editor.getLdifModel();
         LdifContainer container = LdifFile.getContainer( model, offset );
@@ -224,19 +225,19 @@
                 {
                     Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
                         : Schema.DEFAULT_SCHEMA;
-                    String[] attributeNames = schema.getAttributeTypeDescriptionNames();
+                    String[] attributeNames = SchemaUtils.getNamesAsArray( schema.getAttributeTypeDescriptions() );
                     Arrays.sort( attributeNames );
-                    for ( int a = 0; a < attributeNames.length; a++ )
+                    for ( String attributeName : attributeNames )
                     {
                         if ( rawAttributeDescription.length() == 0
-                            || attributeNames[a].toLowerCase().startsWith( rawAttributeDescription.toLowerCase() ) )
+                            || attributeName.toLowerCase().startsWith( rawAttributeDescription.toLowerCase() ) )
                         {
 
-                            String proposal = attributeNames[a];
+                            String proposal = attributeName;
 
                             if ( rawValueType.length() == 0 )
                             {
-                                if ( schema.getAttributeTypeDescription( proposal ).isBinary() )
+                                if ( SchemaUtils.isBinary( schema.getAttributeTypeDescription( proposal ), schema ) )
                                 {
                                     proposal += ":: ";
                                 }

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassDialog.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassDialog.java (original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassDialog.java Tue Mar 25 16:05:04 2008
@@ -26,6 +26,7 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.ListContentProposalProvider;
 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.valueeditors.ValueEditorsActivator;
 import org.apache.directory.studio.valueeditors.ValueEditorsConstants;
 import org.eclipse.jface.dialogs.Dialog;
@@ -134,7 +135,7 @@
         composite.setLayoutData( gd );
 
         // combo widget
-        String[] allOcNames = schema.getObjectClassDescriptionNames();
+        String[] allOcNames = SchemaUtils.getNamesAsArray( schema.getObjectClassDescriptions() );
         Arrays.sort( allOcNames );
 
         final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java?rev=641069&r1=641068&r2=641069&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java (original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java Tue Mar 25 16:05:04 2008
@@ -21,11 +21,11 @@
 package org.apache.directory.studio.valueeditors.objectclass;
 
 
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-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.valueeditors.AbstractDialogStringValueEditor;
 import org.eclipse.swt.widgets.Shell;
@@ -81,19 +81,19 @@
         {
             Schema schema = value.getAttribute().getEntry().getBrowserConnection().getSchema();
             ObjectClassDescription ocd = schema.getObjectClassDescription( displayValue );
-            if ( ocd.isStructural() )
+            switch ( ocd.getKind() )
             {
-                displayValue = displayValue + " (structural)";
+                case STRUCTURAL:
+                    displayValue = displayValue + " (structural)";
+                    break;
+                case ABSTRACT:
+                    displayValue = displayValue + " (abstract)";
+                    break;
+                case AUXILIARY:
+                    displayValue = displayValue + " (auxiliary)";
+                    break;
             }
-            else if ( ocd.isAbstract() )
-            {
-                displayValue = displayValue + " (abstract)";
-            }
-            else if ( ocd.isAuxiliary() )
-            {
-                displayValue = displayValue + " (auxiliary)";
-            }
-            else if ( ocd.isObsolete() )
+            if ( ocd.isObsolete() )
             {
                 displayValue = displayValue + " (obsolete)";
             }



Mime
View raw message