directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r521296 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main: java/org/apache/directory/ldapstudio/schemas/view/editors/ resources/org/apache/directory/ldapstudio/schemas/view/editors/
Date Thu, 22 Mar 2007 14:45:19 GMT
Author: pamarcelot
Date: Thu Mar 22 07:45:18 2007
New Revision: 521296

URL: http://svn.apache.org/viewvc?view=rev&rev=521296
Log:
Added a new Dialog to be able to select an Object Class.
Improved Superiors handling in the OC Editor to be able to add multiple superiors.
Added Javadocs.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogLabelProvider.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/editors/messages.properties

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialog.java?view=diff&rev=521296&r1=521295&r2=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialog.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialog.java Thu Mar 22 07:45:18 2007
@@ -41,10 +41,14 @@
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
 
 
 /**
- * This class is Attribute Type Selection Dialog, that allows user to select an attribute type
+ * This class is Attribute Type Selection Dialog, that allows user to select an attribute type.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class AttributeTypeSelectionDialog extends Dialog
 {
@@ -55,12 +59,11 @@
 
 
     /**
-     * Default constructor
-     * @param parentShell
+     * Creates a new instance of AttributeTypeSelectionDialog.
      */
-    public AttributeTypeSelectionDialog( Shell parentShell )
+    public AttributeTypeSelectionDialog()
     {
-        super( parentShell );
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
     }
 
 
@@ -70,7 +73,7 @@
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
-        newShell.setText( Messages.getString( "AttributeTypeSelectionDialog.Attribute_type_Selection" ) ); //$NON-NLS-1$
+        newShell.setText( Messages.getString( "AttributeTypeSelectionDialog.Attribute_Type_Selection" ) ); //$NON-NLS-1$
     }
 
 
@@ -130,7 +133,7 @@
         {
             public void mouseDoubleClick( MouseEvent e )
             {
-                if ( attributeTypes_table.getSelectionIndex() != 1 )
+                if ( attributeTypes_table.getSelectionIndex() != -1 )
                 {
                     okPressed();
                 }
@@ -174,6 +177,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.OK_ID, Messages.getString( "AttributeTypeSelectionDialog.Add" ), true ); //$NON-NLS-1$
@@ -201,8 +207,10 @@
 
 
     /**
-     * Returns the selected attribute type
-     * @return the selected attribute type
+     * Returns the selected attribute type.
+     * 
+     * @return
+     *      the selected attribute type
      */
     public String getSelectedAttributeType()
     {

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java?view=diff&rev=521296&r1=521295&r2=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java Thu Mar 22 07:45:18 2007
@@ -23,9 +23,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
 import java.util.List;
 
 import org.apache.directory.ldapstudio.schemas.Activator;
@@ -34,14 +31,18 @@
 import org.apache.directory.ldapstudio.schemas.model.Schema;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.log4j.Logger;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -96,8 +97,10 @@
     private Hyperlink schemaLink;
     private Label schemaLabel;
     private Text descriptionText;
-    private Hyperlink supLabel;
-    private Combo supCombo;
+    private Table superiorsTable;
+    private TableViewer superiorsTableViewer;
+    private Button addButtonSuperiorsTable;
+    private Button removeButtonSuperiorsTable;
     private Combo classTypeCombo;
     private Button obsoleteCheckbox;
     private Table mandatoryAttributesTable;
@@ -211,49 +214,6 @@
         }
     };
 
-    /** The listener for Sup Label Widget */
-    private HyperlinkAdapter supLabelListener = new HyperlinkAdapter()
-    {
-        public void linkActivated( HyperlinkEvent e )
-        {
-            if ( !supCombo.getItem( supCombo.getSelectionIndex() ).equals(
-                Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" ) ) ) { //$NON-NLS-1$
-                SchemaPool pool = SchemaPool.getInstance();
-                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
-                ObjectClassFormEditorInput input = new ObjectClassFormEditorInput( pool.getObjectClass( supCombo
-                    .getItem( supCombo.getSelectionIndex() ) ) );
-                String editorId = ObjectClassFormEditor.ID;
-                try
-                {
-                    page.openEditor( input, editorId );
-                }
-                catch ( PartInitException exception )
-                {
-                    Logger.getLogger( ObjectClassFormEditorOverviewPage.class ).debug( "error when opening the editor" ); //$NON-NLS-1$
-                }
-            }
-        }
-    };
-
-    /** The listener for Sup Combo Widget */
-    private ModifyListener supComboListener = new ModifyListener()
-    {
-        public void modifyText( ModifyEvent e )
-        {
-            if ( supCombo.getItem( supCombo.getSelectionIndex() ).equals(
-                Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" ) ) ) { //$NON-NLS-1$
-                modifiedObjectClass.setSuperiors( new String[0] );
-            }
-            else
-            {
-                modifiedObjectClass.setSuperiors( new String[]
-                    { supCombo.getItem( supCombo.getSelectionIndex() ) } );
-            }
-            setEditorDirty();
-        }
-    };
-
     /** The listener for Class Type Widget */
     private ModifyListener classTypeListener = new ModifyListener()
     {
@@ -326,7 +286,7 @@
     {
         public void widgetSelected( SelectionEvent e )
         {
-            AttributeTypeSelectionDialog selectionDialog = new AttributeTypeSelectionDialog( null );
+            AttributeTypeSelectionDialog selectionDialog = new AttributeTypeSelectionDialog();
             if ( selectionDialog.open() != Window.OK )
             {
                 return;
@@ -391,7 +351,7 @@
     };
 
     /** The listener for Optional Attributes Table Widget */
-    private MouseListener optionalAttributesTableListener = new MouseListener()
+    private MouseListener optionalAttributesTableListener = new MouseAdapter()
     {
         public void mouseDoubleClick( MouseEvent e )
         {
@@ -412,11 +372,6 @@
         }
 
 
-        public void mouseDown( MouseEvent e )
-        {
-        }
-
-
         public void mouseUp( MouseEvent e )
         {
             if ( modifiedObjectClass.getOriginatingSchema().type != Schema.SchemaType.coreSchema )
@@ -431,7 +386,7 @@
     {
         public void widgetSelected( SelectionEvent e )
         {
-            AttributeTypeSelectionDialog selectionDialog = new AttributeTypeSelectionDialog( null );
+            AttributeTypeSelectionDialog selectionDialog = new AttributeTypeSelectionDialog();
             if ( selectionDialog.open() != Window.OK )
             {
                 return;
@@ -469,7 +424,6 @@
                     fillInOptionalAttributesTable();
                     setEditorDirty();
                 }
-
             }
         }
     };
@@ -496,6 +450,129 @@
         }
     };
 
+    /** The listener for Superiors Table Widget */
+    private MouseListener superiorsTableListener = new MouseAdapter()
+    {
+        public void mouseDoubleClick( MouseEvent e )
+        {
+            StructuredSelection selection = ( StructuredSelection ) superiorsTableViewer.getSelection();
+            if ( selection.isEmpty() )
+            {
+                return;
+            }
+
+            ObjectClassWrapper ocw = ( ObjectClassWrapper ) selection.getFirstElement();
+            if ( ocw == null )
+            {
+                return;
+            }
+
+            SchemaPool pool = SchemaPool.getInstance();
+            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+            ObjectClassFormEditorInput input = new ObjectClassFormEditorInput( pool.getObjectClass( ocw
+                .getMyObjectClass().getNames()[0] ) );
+            String editorId = ObjectClassFormEditor.ID;
+            try
+            {
+                page.openEditor( input, editorId );
+            }
+            catch ( PartInitException exception )
+            {
+                Logger.getLogger( ObjectClassFormEditorOverviewPage.class ).debug( "error when opening the editor" ); //$NON-NLS-1$
+            }
+        }
+
+
+        public void mouseUp( MouseEvent e )
+        {
+            if ( modifiedObjectClass.getOriginatingSchema().type != Schema.SchemaType.coreSchema )
+            {
+                removeButtonSuperiorsTable.setEnabled( superiorsTable.getSelection().length != 0 );
+            }
+        }
+    };
+
+    /** The listener for Add Button Widget of the Superiors Table */
+    private SelectionAdapter addButtonSuperiorsTableListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            ObjectClassSelectionDialog dialog = new ObjectClassSelectionDialog();
+            SchemaPool pool = SchemaPool.getInstance();
+            List<ObjectClass> hiddenOCs = new ArrayList<ObjectClass>();
+            for ( String sup : modifiedObjectClass.getSuperiors() )
+            {
+                ObjectClass oc = pool.getObjectClass( sup );
+                if ( oc != null )
+                {
+                    hiddenOCs.add( oc );
+                }
+            }
+            hiddenOCs.add( originalObjectClass );
+            dialog.setHiddenObjectClasses( hiddenOCs.toArray( new ObjectClass[0] ) );
+
+            if ( dialog.open() != Window.OK )
+            {
+                return;
+            }
+
+            ObjectClass oc = dialog.getSelectedObjectClass();
+
+            if ( oc == null )
+            {
+                return;
+            }
+
+            List<String> superiors = new ArrayList<String>();
+            String[] sups = modifiedObjectClass.getSuperiors();
+            for ( String sup : sups )
+            {
+                superiors.add( sup );
+            }
+            superiors.add( oc.getNames()[0] );
+            modifiedObjectClass.setSuperiors( superiors.toArray( new String[0] ) );
+
+            fillInSuperiorsTable();
+            setEditorDirty();
+        }
+    };
+
+    /** The listener for Remove Button Widget of the Superiors Table */
+    private SelectionAdapter removeButtonSuperiorsTableListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            StructuredSelection selection = ( StructuredSelection ) superiorsTableViewer.getSelection();
+            if ( selection.isEmpty() )
+            {
+                return;
+            }
+
+            ObjectClassWrapper ocw = ( ObjectClassWrapper ) selection.getFirstElement();
+            if ( ocw == null )
+            {
+                return;
+            }
+
+            List<String> superiors = new ArrayList<String>();
+            String[] sups = modifiedObjectClass.getSuperiors();
+            for ( String sup : sups )
+            {
+                superiors.add( sup );
+            }
+            for ( String name : ocw.getMyObjectClass().getNames() )
+            {
+                superiors.remove( name );
+            }
+            modifiedObjectClass.setSuperiors( superiors.toArray( new String[0] ) );
+
+            fillInSuperiorsTable();
+            removeButtonSuperiorsTable.setEnabled( superiorsTable.getSelection().length != 0 );
+            setEditorDirty();
+        }
+    };
+
 
     /**
      * Default constructor
@@ -520,17 +597,20 @@
         // Creating the base UI
         ScrolledForm form = managedForm.getForm();
         FormToolkit toolkit = managedForm.getToolkit();
-        GridLayout layout = new GridLayout( 2, true );
-        form.getBody().setLayout( layout );
+        form.getBody().setLayout( new GridLayout() );
 
         // General Information Section
         createGeneralInformationSection( form.getBody(), toolkit );
 
+        Composite bottomComposite = toolkit.createComposite( form.getBody() );
+        bottomComposite.setLayout( new GridLayout( 2, true ) );
+        bottomComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
         // Mandatory Attributes Section
-        createMandatoryAttributesSection( form.getBody(), toolkit );
+        createMandatoryAttributesSection( bottomComposite, toolkit );
 
         // Optionnal Attributes Section
-        createOptionalAttributesSection( form.getBody(), toolkit );
+        createOptionalAttributesSection( bottomComposite, toolkit );
 
         // Enabling or disabling the fields
         setFieldsEditableState();
@@ -559,73 +639,74 @@
             .getString( "ObjectClassFormEditorOverviewPage.General_Information_Section_Description" ) ); //$NON-NLS-1$
         section_general_information.setText( Messages
             .getString( "ObjectClassFormEditorOverviewPage.General_Information_Section_Text" ) ); //$NON-NLS-1$
+        section_general_information.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, true ) );
 
         // Creating the layout of the section
         Composite client_general_information = toolkit.createComposite( section_general_information );
-        GridLayout layout_general_information = new GridLayout();
-        layout_general_information.numColumns = 2;
-        client_general_information.setLayout( layout_general_information );
+        client_general_information.setLayout( new GridLayout( 3, false ) );
         toolkit.paintBordersFor( client_general_information );
         section_general_information.setClient( client_general_information );
-        section_general_information.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true, 2, 1 ) );
 
         // ALIASES Button
         toolkit.createLabel( client_general_information, Messages
             .getString( "ObjectClassFormEditorOverviewPage.Aliases" ) ); //$NON-NLS-1$
         aliasesLabel = toolkit.createLabel( client_general_information, "" );
-        aliasesLabel.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+        aliasesLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
         toolkit.createLabel( client_general_information, "" );
         aliasesButton = toolkit.createButton( client_general_information, Messages
             .getString( "AttributeTypeFormEditorOverviewPage.Manage_Aliases" ), SWT.PUSH ); //$NON-NLS-1$
-        aliasesButton.setLayoutData( new GridData( SWT.NONE, SWT.NONE, false, false ) );
+        aliasesButton.setLayoutData( new GridData( SWT.NONE, SWT.NONE, false, false, 2, 1 ) );
 
         // OID Field
         toolkit.createLabel( client_general_information, Messages.getString( "ObjectClassFormEditorOverviewPage.OID" ) ); //$NON-NLS-1$
         oidText = toolkit.createText( client_general_information, "" ); //$NON-NLS-1$
-        oidText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        oidText.addVerifyListener( new VerifyListener()
-        {
-            public void verifyText( VerifyEvent e )
-            {
-                if ( e.text.length() < 20 && !e.text.matches( "([0-9]+\\.?)*" ) )
-                {
-                    e.doit = false;
-                }
-            }
-        } );
+        oidText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
 
         // SCHEMA Field
         schemaLink = toolkit.createHyperlink( client_general_information, "Schema:", SWT.WRAP );
         schemaLabel = toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
-        schemaLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        schemaLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
 
         // DESCRIPTION Field
         toolkit.createLabel( client_general_information, Messages
             .getString( "ObjectClassFormEditorOverviewPage.Description" ) ); //$NON-NLS-1$
         descriptionText = toolkit.createText( client_general_information, "", SWT.MULTI | SWT.V_SCROLL ); //$NON-NLS-1$
-        GridData descriptionGridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+        GridData descriptionGridData = new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 );
         descriptionGridData.heightHint = 42;
         descriptionText.setLayoutData( descriptionGridData );
 
-        // SUP Combo
-        supLabel = toolkit.createHyperlink( client_general_information, Messages
-            .getString( "ObjectClassFormEditorOverviewPage.Superior_class" ), SWT.WRAP ); //$NON-NLS-1$
-        supCombo = new Combo( client_general_information, SWT.READ_ONLY | SWT.SINGLE );
-        supCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-        initSupCombo();
+        // SUPERIORS Table
+        toolkit.createLabel( client_general_information, Messages
+            .getString( "ObjectClassFormEditorOverviewPage.Superior_classes" ) ); //$NON-NLS-1$
+        superiorsTable = toolkit.createTable( client_general_information, SWT.SINGLE | SWT.V_SCROLL );
+        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+        gridData.heightHint = 45;
+        gridData.minimumHeight = 45;
+        superiorsTable.setLayoutData( gridData );
+        superiorsTableViewer = new TableViewer( superiorsTable );
+        superiorsTableViewer.setContentProvider( new ObjectClassFormEditorSuperiorsTableContentProvider() );
+        superiorsTableViewer.setLabelProvider( new ObjectClassFormEditorSuperiorsTableLabelProvider() );
+        Composite superiorsButtonComposite = toolkit.createComposite( client_general_information );
+        superiorsButtonComposite.setLayout( new GridLayout() );
+        addButtonSuperiorsTable = toolkit.createButton( superiorsButtonComposite, Messages
+            .getString( "ObjectClassFormEditorOverviewPage.Add..." ), SWT.PUSH );
+        addButtonSuperiorsTable.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false, false ) );
+        removeButtonSuperiorsTable = toolkit.createButton( superiorsButtonComposite, Messages
+            .getString( "ObjectClassFormEditorOverviewPage.Remove" ), SWT.PUSH );
+        removeButtonSuperiorsTable.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false, false ) );
 
         // CLASS TYPE Combo
         toolkit.createLabel( client_general_information, Messages
             .getString( "ObjectClassFormEditorOverviewPage.Class_type" ) ); //$NON-NLS-1$
         classTypeCombo = new Combo( client_general_information, SWT.READ_ONLY | SWT.SINGLE );
-        classTypeCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        classTypeCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
         initClassTypeCombo();
 
         // OBSOLETE Checkbox
         toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
         obsoleteCheckbox = toolkit.createButton( client_general_information, Messages
             .getString( "ObjectClassFormEditorOverviewPage.Obsolete" ), SWT.CHECK ); //$NON-NLS-1$
-        obsoleteCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        obsoleteCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
     }
 
 
@@ -647,7 +728,7 @@
         section.setExpanded( true );
         Composite client = toolkit.createComposite( section );
         section.setClient( client );
-        GridData gd = new GridData( GridData.FILL, GridData.FILL, true, true );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
         section.setLayoutData( gd );
         toolkit.paintBordersFor( client );
 
@@ -656,9 +737,9 @@
         client.setLayout( layout );
 
         mandatoryAttributesTable = toolkit.createTable( client, SWT.NULL );
-        gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gd = new GridData( SWT.FILL, SWT.NONE, true, false );
         gd.verticalSpan = 2;
-        gd.heightHint = 100;
+        gd.heightHint = 108;
         mandatoryAttributesTable.setLayoutData( gd );
 
         addButtonMandatoryTable = toolkit.createButton( client, Messages
@@ -692,7 +773,7 @@
         section.setExpanded( true );
         Composite client = toolkit.createComposite( section );
         section.setClient( client );
-        GridData gd = new GridData( GridData.FILL, GridData.FILL, true, true );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
         section.setLayoutData( gd );
         toolkit.paintBordersFor( client );
 
@@ -701,9 +782,9 @@
         client.setLayout( layout );
 
         optionalAttributesTable = toolkit.createTable( client, SWT.SINGLE | SWT.V_SCROLL );
-        gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gd = new GridData( SWT.FILL, SWT.NONE, true, false );
         gd.verticalSpan = 2;
-        gd.heightHint = 100;
+        gd.heightHint = 108;
         optionalAttributesTable.setLayoutData( gd );
 
         addButtonOptionalTable = toolkit.createButton( client, Messages
@@ -775,15 +856,8 @@
             descriptionText.setText( modifiedObjectClass.getDescription() );
         }
 
-        // SUP Combo
-        if ( modifiedObjectClass.getSuperiors().length == 0 )
-        {
-            fillSupCombo( Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" ) );
-        }
-        else
-        {
-            fillSupCombo( modifiedObjectClass.getSuperiors()[0] );
-        }
+        // SUPERIORS Table
+        fillInSuperiorsTable();
 
         // CLASS TYPE Combo
         fillInClassType();
@@ -800,37 +874,11 @@
 
 
     /**
-     * Initializes the Superior Combo box.
+     * Fills in the Superiors Table.
      */
-    private void initSupCombo()
+    private void fillInSuperiorsTable()
     {
-        SchemaPool pool = SchemaPool.getInstance();
-        List<ObjectClass> ocList = pool.getObjectClasses();
-
-        //remove duplicate entries
-        HashSet<ObjectClass> set = new HashSet<ObjectClass>( ocList );
-        ocList = new ArrayList<ObjectClass>( set );
-
-        // Sorting the list
-        Collections.sort( ocList, new Comparator<ObjectClass>()
-        {
-            public int compare( ObjectClass arg0, ObjectClass arg1 )
-            {
-                String oneName = arg0.getNames()[0];
-                String twoName = arg1.getNames()[0];
-                return oneName.compareTo( twoName );
-            }
-        } );
-
-        // Creating the UI
-        supCombo.add( Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" ) ); //$NON-NLS-1$
-        supCombo.select( 0 );
-        int counter = 1;
-        for ( ObjectClass oc : ocList )
-        {
-            supCombo.add( oc.getNames()[0], counter );
-            counter++;
-        }
+        superiorsTableViewer.setInput( modifiedObjectClass.getSuperiors() );
     }
 
 
@@ -933,7 +981,7 @@
             // If the object class is in a core-schema file, we disable editing
             oidText.setEditable( false );
             descriptionText.setEditable( false );
-            supCombo.setEnabled( false );
+            addButtonSuperiorsTable.setEnabled( false );
             classTypeCombo.setEnabled( false );
             obsoleteCheckbox.setEnabled( false );
             addButtonMandatoryTable.setEnabled( false );
@@ -943,6 +991,7 @@
         }
         else
         {
+            removeButtonSuperiorsTable.setEnabled( superiorsTable.getSelectionIndex() != -1 );
             removeButtonMandatoryTable.setEnabled( mandatoryAttributesTable.getSelectionIndex() != -1 );
             removeButtonOptionalTable.setEnabled( optionalAttributesTable.getSelectionIndex() != -1 );
         }
@@ -959,7 +1008,8 @@
             oidText.addModifyListener( oidTextModifyListener );
             oidText.addVerifyListener( oidTextVerifyListener );
             descriptionText.addModifyListener( descriptionTextListener );
-            supCombo.addModifyListener( supComboListener );
+            addButtonSuperiorsTable.addSelectionListener( addButtonSuperiorsTableListener );
+            removeButtonSuperiorsTable.addSelectionListener( removeButtonSuperiorsTableListener );
             classTypeCombo.addModifyListener( classTypeListener );
             obsoleteCheckbox.addSelectionListener( obsoleteListener );
             addButtonMandatoryTable.addSelectionListener( addButtonMandatoryTableListener );
@@ -972,7 +1022,9 @@
         aliasesButton.addSelectionListener( aliasesButtonListener );
 
         schemaLink.addHyperlinkListener( schemaLinkListener );
-        supLabel.addHyperlinkListener( supLabelListener );
+
+        // This listener needs to be outside of the 'if' so that attribute type editor can be opened from any object class (in a core or a user schema)
+        superiorsTable.addMouseListener( superiorsTableListener );
 
         // This listener needs to be outside of the 'if' so that attribute type editor can be opened from any object class (in a core or a user schema)
         mandatoryAttributesTable.addMouseListener( mandatoryAttributesTableListener );
@@ -992,8 +1044,9 @@
         oidText.removeVerifyListener( oidTextVerifyListener );
         schemaLink.removeHyperlinkListener( schemaLinkListener );
         descriptionText.removeModifyListener( descriptionTextListener );
-        supLabel.removeHyperlinkListener( supLabelListener );
-        supCombo.removeModifyListener( supComboListener );
+        superiorsTable.removeMouseListener( superiorsTableListener );
+        addButtonSuperiorsTable.removeSelectionListener( addButtonSuperiorsTableListener );
+        removeButtonSuperiorsTable.removeSelectionListener( removeButtonSuperiorsTableListener );
         classTypeCombo.removeModifyListener( classTypeListener );
         obsoleteCheckbox.removeSelectionListener( obsoleteListener );
         mandatoryAttributesTable.removeMouseListener( mandatoryAttributesTableListener );
@@ -1011,25 +1064,6 @@
     private void setEditorDirty()
     {
         ( ( ObjectClassFormEditor ) getEditor() ).setDirty( true );
-    }
-
-
-    /**
-     * Fills the the Sup Combo with the correct value
-     *
-     * @param name
-     *      the name to select
-     */
-    private void fillSupCombo( String name )
-    {
-        for ( int i = 0; i < supCombo.getItemCount(); i++ )
-        {
-            if ( name.equals( supCombo.getItem( i ) ) )
-            {
-                supCombo.select( i );
-                return;
-            }
-        }
     }
 
 

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableContentProvider.java?view=auto&rev=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableContentProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableContentProvider.java Thu Mar 22 07:45:18 2007
@@ -0,0 +1,104 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.server.core.tools.schema.ObjectClassLiteral;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class is the Content Provider for the Superiors Table of the Object Class Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassFormEditorSuperiorsTableContentProvider implements IStructuredContentProvider
+{
+    /** The Schema Pool */
+    private SchemaPool schemaPool;
+
+
+    /**
+     * Creates a new instance of ObjectClassFormEditorSuperiorsTableContentProvider.
+     */
+    public ObjectClassFormEditorSuperiorsTableContentProvider()
+    {
+        schemaPool = SchemaPool.getInstance();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof String[] )
+        {
+            List<ObjectClassWrapper> results = new ArrayList<ObjectClassWrapper>();
+
+            String[] superiors = ( String[] ) inputElement;
+            for ( String superior : superiors )
+            {
+                ObjectClass oc = schemaPool.getObjectClass( superior );
+                if ( oc != null )
+                {
+                    results.add( new ObjectClassWrapper( oc, null ) );
+                }
+                else
+                {
+                    ObjectClassLiteral ocl = new ObjectClassLiteral( "" );
+                    ocl.setNames( new String[]
+                        { superior } );
+                    ObjectClass newOC = new ObjectClass( ocl, null );
+                    results.add( new ObjectClassWrapper( newOC, null ) );
+                }
+            }
+
+            return results.toArray();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableLabelProvider.java?view=auto&rev=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableLabelProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSuperiorsTableLabelProvider.java Thu Mar 22 07:45:18 2007
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Label Provider for the Superiors Table of the Object Class Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassFormEditorSuperiorsTableLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+     */
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        if ( element instanceof ObjectClassWrapper )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+                .createImage();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+     */
+    public String getColumnText( Object element, int columnIndex )
+    {
+        if ( element instanceof ObjectClassWrapper )
+        {
+            return ViewUtils.concateAliases( ( ( ObjectClassWrapper ) element ).getMyObjectClass().getNames() );
+        }
+
+        // Default
+        return null;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialog.java?view=auto&rev=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialog.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialog.java Thu Mar 22 07:45:18 2007
@@ -0,0 +1,267 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.viewers.TableDecoratingLabelProvider;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class is the Object Class Selection Dialog, that allows user to select an object class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialog extends Dialog
+{
+    /** The selected Object Class*/
+    private ObjectClass selectedObjectClass;
+
+    /** The Schema Pool */
+    private SchemaPool schemaPool;
+
+    /** The hidden Object Classes */
+    private List<ObjectClass> hiddenObjectClasses;
+
+    // UI Fields
+    private Table objectClassesTable;
+    private TableViewer tableViewer;
+    private Text searchText;
+
+
+    /**
+     * Creates a new instance of ObjectClassSelectionDialog.
+     */
+    public ObjectClassSelectionDialog()
+    {
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        schemaPool = SchemaPool.getInstance();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( Messages.getString( "ObjectClassSelectionDialog.Object_Class_Selection" ) ); //$NON-NLS-1$
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout layout = new GridLayout( 1, false );
+        composite.setLayout( layout );
+
+        Label chooseLabel = new Label( composite, SWT.NONE );
+        chooseLabel.setText( Messages.getString( "ObjectClassSelectionDialog.Choose_an_object_class" ) ); //$NON-NLS-1$
+        chooseLabel.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false ) );
+
+        searchText = new Text( composite, SWT.BORDER );
+        searchText.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false ) );
+        searchText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                tableViewer.setInput( searchText.getText() );
+                objectClassesTable.select( 0 );
+            }
+        } );
+        searchText.addKeyListener( new KeyAdapter()
+        {
+            public void keyPressed( KeyEvent e )
+            {
+                if ( e.keyCode == SWT.ARROW_DOWN )
+                {
+                    objectClassesTable.setFocus();
+                }
+            }
+        } );
+
+        Label matchingLabel = new Label( composite, SWT.NONE );
+        matchingLabel.setText( Messages.getString( "ObjectClassSelectionDialog.Matching_object_classes" ) ); //$NON-NLS-1$
+        matchingLabel.setLayoutData( new GridData( GridData.FILL, SWT.None, true, false ) );
+
+        objectClassesTable = new Table( composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+            | SWT.FULL_SELECTION | SWT.HIDE_SELECTION );
+        GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true );
+        gridData.heightHint = 148;
+        gridData.minimumHeight = 148;
+        gridData.widthHint = 350;
+        gridData.minimumWidth = 350;
+        objectClassesTable.setLayoutData( gridData );
+        objectClassesTable.addMouseListener( new MouseAdapter()
+        {
+            public void mouseDoubleClick( MouseEvent e )
+            {
+                if ( objectClassesTable.getSelectionIndex() != -1 )
+                {
+                    okPressed();
+                }
+            }
+        } );
+
+        tableViewer = new TableViewer( objectClassesTable );
+        tableViewer.setUseHashlookup( true );
+
+        tableViewer.setContentProvider( new ObjectClassSelectionDialogContentProvider( hiddenObjectClasses ) );
+        tableViewer.setLabelProvider( new TableDecoratingLabelProvider( new ObjectClassSelectionDialogLabelProvider(),
+            Activator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+
+        // We need to force the input to load the complete list of attribute types
+        tableViewer.setInput( "" ); //$NON-NLS-1$
+        // We also need to force the selection of the first row
+        objectClassesTable.select( 0 );
+
+        return composite;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, Messages.getString( "ObjectClassSelectionDialog.Add" ), true ); //$NON-NLS-1$
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
+    protected void okPressed()
+    {
+        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+
+        if ( selection.isEmpty() )
+        {
+            MessageDialog
+                .openError(
+                    getShell(),
+                    Messages.getString( "ObjectClassSelectionDialog.Invalid_Selection" ), Messages.getString( "ObjectClassSelectionDialog.You_have_to_choose_an_object_class" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+            return;
+        }
+
+        ObjectClassWrapper ocw = ( ObjectClassWrapper ) selection.getFirstElement();
+        if ( ocw != null )
+        {
+            selectedObjectClass = ocw.getMyObjectClass();
+        }
+
+        super.okPressed();
+    }
+
+
+    /**
+     * Returns the selected object class.
+     * 
+     * @return 
+     *      the selected object class
+     */
+    public ObjectClass getSelectedObjectClass()
+    {
+        return selectedObjectClass;
+    }
+
+
+    /**
+     * Set the hidden Object Classes.
+     *
+     * @param list
+     *      a list of Object Classes to hide
+     */
+    public void setHiddenObjectClasses( List<ObjectClass> list )
+    {
+        hiddenObjectClasses = list;
+    }
+
+
+    /**
+     * Sets the hidden Object Classes.
+     *
+     * @param objectClasses
+     *      an array of Object Classes to hide
+     */
+    public void setHiddenObjectClasses( ObjectClass[] objectClasses )
+    {
+        hiddenObjectClasses = new ArrayList<ObjectClass>();
+
+        for ( ObjectClass objectClass : objectClasses )
+        {
+            hiddenObjectClasses.add( objectClass );
+        }
+    }
+
+
+    /**
+     * Sets the hidden Object Classes.
+     *
+     * @param names
+     *      an array of names of Object Classes to hide
+     */
+    public void setHiddenObjectClasses( String[] names )
+    {
+        hiddenObjectClasses = new ArrayList<ObjectClass>();
+
+        for ( String name : names )
+        {
+            ObjectClass oc = schemaPool.getObjectClass( name );
+            if ( oc != null )
+            {
+                hiddenObjectClasses.add( oc );
+            }
+        }
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogContentProvider.java?view=auto&rev=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogContentProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogContentProvider.java Thu Mar 22 07:45:18 2007
@@ -0,0 +1,170 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class is the Content Provider for the Object Class Selection Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialogContentProvider implements IStructuredContentProvider
+{
+    /** The Schema Pool */
+    private SchemaPool schemaPool;
+
+    /** The hidden Object Classes */
+    private List<ObjectClass> hiddenObjectClasses;
+
+
+    /**
+     * Creates a new instance of ObjectClassSelectionDialogContentProvider.
+     */
+    public ObjectClassSelectionDialogContentProvider( List<ObjectClass> hiddenObjectClasses )
+    {
+        schemaPool = SchemaPool.getInstance();
+        this.hiddenObjectClasses = hiddenObjectClasses;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof String )
+        {
+            ArrayList<ObjectClassWrapper> results = new ArrayList<ObjectClassWrapper>();
+
+            String searchText = ( String ) inputElement;
+
+            String searchRegexp;
+            if ( searchText.length() == 0 )
+            {
+                searchRegexp = ".*"; //$NON-NLS-1$
+            }
+            else
+            {
+                searchRegexp = searchText + ".*"; //$NON-NLS-1$
+            }
+            Pattern pattern = Pattern.compile( searchRegexp, Pattern.CASE_INSENSITIVE );
+
+            List<ObjectClass> ocList = schemaPool.getObjectClasses();
+
+            // Sorting the list
+            Collections.sort( ocList, new Comparator<ObjectClass>()
+            {
+                public int compare( ObjectClass oc1, ObjectClass oc2 )
+                {
+                    if ( ( oc1.getNames() == null || oc1.getNames().length == 0 )
+                        && ( oc2.getNames() == null || oc2.getNames().length == 0 ) )
+                    {
+                        return 0;
+                    }
+                    else if ( ( oc1.getNames() == null || oc1.getNames().length == 0 )
+                        && ( oc2.getNames() != null && oc2.getNames().length > 0 ) )
+                    {
+                        return "".compareToIgnoreCase( oc2.getNames()[0] );
+                    }
+                    else if ( ( oc1.getNames() != null && oc1.getNames().length > 0 )
+                        && ( oc2.getNames() == null || oc2.getNames().length == 0 ) )
+                    {
+                        return oc1.getNames()[0].compareToIgnoreCase( "" );
+                    }
+                    else
+                    {
+                        return oc1.getNames()[0].compareToIgnoreCase( oc2.getNames()[0] );
+                    }
+                }
+            } );
+
+            // Searching for all matching elements
+            for ( ObjectClass oc : ocList )
+            {
+                for ( String name : oc.getNames() )
+                {
+                    Matcher m = pattern.matcher( name );
+                    if ( m.matches() )
+                    {
+                        if ( !hiddenObjectClasses.contains( oc ) )
+                        {
+                            ObjectClassWrapper ocw = new ObjectClassWrapper( oc, null );
+                            if ( !results.contains( ocw ) )
+                            {
+                                results.add( new ObjectClassWrapper( oc, null ) );
+                            }
+                        }
+                        break;
+                    }
+                }
+                Matcher m = pattern.matcher( oc.getOid() );
+                if ( m.matches() )
+                {
+                    if ( !hiddenObjectClasses.contains( oc ) )
+                    {
+                        ObjectClassWrapper ocw = new ObjectClassWrapper( oc, null );
+                        if ( !results.contains( ocw ) )
+                        {
+                            results.add( new ObjectClassWrapper( oc, null ) );
+                        }
+                    }
+                }
+            }
+
+            // Returns the results
+            return results.toArray();
+        }
+
+        // Default
+        return new Object[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogLabelProvider.java?view=auto&rev=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogLabelProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassSelectionDialogLabelProvider.java Thu Mar 22 07:45:18 2007
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Label Provider for the Object Class Selection Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialogLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+     */
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        if ( element instanceof ObjectClassWrapper )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+                .createImage();
+        }
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+     */
+    public String getColumnText( Object element, int columnIndex )
+    {
+        if ( element instanceof ObjectClassWrapper )
+        {
+            ObjectClass oc = ( ( ObjectClassWrapper ) element ).getMyObjectClass();
+
+            return ViewUtils.concateAliases( oc.getNames() ) + "   [" + oc.getOid() + "]";
+        }
+
+        // Default
+        return null;
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/editors/messages.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/editors/messages.properties?view=diff&rev=521296&r1=521295&r2=521296
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/editors/messages.properties (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/editors/messages.properties Thu Mar 22 07:45:18 2007
@@ -45,7 +45,7 @@
 AttributeTypeFormEditorOverviewPage.No-User-Modification=No-User-Modification
 AttributeTypeFormEditorOverviewPage.Specify_matching_rules=Specify matching rules (Equality, Ordering & Substring).
 AttributeTypeFormEditorOverviewPage.Matching_Rules=Matching Rules
-AttributeTypeSelectionDialog.Attribute_type_Selection=Attribute type Selection
+AttributeTypeSelectionDialog.Attribute_Type_Selection=Attribute Type Selection
 AttributeTypeSelectionDialog.Choose_an_attribute_type=Choose an attribute type:
 AttributeTypeSelectionDialog.Matching_attribute_types=Matching attribute types:
 AttributeTypeFormEditorOverviewPage.Equility=Equality:
@@ -67,7 +67,7 @@
 ObjectClassFormEditorOverviewPage.Manage_Aliases=Manage aliases
 ObjectClassFormEditorOverviewPage.OID=OID:
 ObjectClassFormEditorOverviewPage.Description=Description:
-ObjectClassFormEditorOverviewPage.Superior_class=Superior class:
+ObjectClassFormEditorOverviewPage.Superior_classes=Superior classes:
 ObjectClassFormEditorOverviewPage.Class_type=Class type:
 ObjectClassFormEditorOverviewPage.Obsolete=Obsolete
 ObjectClassFormEditorOverviewPage.Mandatory_Attribute_Section_Text=Mandatory attributes
@@ -86,3 +86,9 @@
 ObjectClassFormEditorOverviewPage.Structural=Structural
 SchemaFormEditor.Source_code=Source code
 SchemaFormEditorInput.Source_code_of=Source code of 
+ObjectClassSelectionDialog.Object_Class_Selection=Object Class Selection
+ObjectClassSelectionDialog.Choose_an_object_class=Choose an object class:
+ObjectClassSelectionDialog.Matching_object_classes=Matching object classes:
+ObjectClassSelectionDialog.Add=Add
+ObjectClassSelectionDialog.Invalid_Selection=Invalid Selection
+ObjectClassSelectionDialog.You_have_to_choose_an_object_class=You have to choose an object class.



Mime
View raw message