directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r509199 [2/2] - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ ressources/icons/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ src/m...
Date Mon, 19 Feb 2007 13:41:27 GMT
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java?view=auto&rev=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java Mon Feb 19 05:41:26 2007
@@ -0,0 +1,279 @@
+/*
+ *  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.viewers;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class implements the Hierarchy View Sorter Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyViewSorterDialog extends Dialog
+{
+    /** The title of the dialog */
+    private static final String DIALOG_TITLE = "Hierarchy View Sorting";
+
+    /** The Sorting First Name category */
+    private static final String SORTING_FISTNAME = "First Name";
+
+    /** The Sorting OID category */
+    private static final String SORTING_OID = "OID";
+
+    /** The preference ID for Grouping */
+    public static final String PREFS_HIERARCHY_VIEW_GROUPING = Activator.PLUGIN_ID
+        + ".preferences.HierarchyView.grouping";
+
+    /** The preference value for grouping 'attribute types first' */
+    public static final int PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST = 0;
+
+    /** The preference value for grouping 'object classes first' */
+    public static final int PREFS_HIERARCHY_VIEW_GROUPING_OCFIRST = 1;
+
+    /** The preference value for grouping 'mixed' */
+    public static final int PREFS_HIERARCHY_VIEW_GROUPING_MIXED = 2;
+
+    /** The preference ID for Sorting By */
+    public static final String PREFS_HIERARCHY_VIEW_SORTING_BY = Activator.PLUGIN_ID
+        + ".preferences.HierarchyView.sortingBy";
+
+    /** The preference value for sorting 'First Name' */
+    public static final int PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME = 0;
+
+    /** The prefence value for sorting 'OID' */
+    public static final int PREFS_HIERARCHY_VIEW_SORTING_BY_OID = 1;
+
+    /** The preference ID for Sorting Order */
+    public static final String PREFS_HIERARCHY_VIEW_SORTING_ORDER = Activator.PLUGIN_ID
+        + ".preferences.HierarchyView.sortingOrder";
+
+    /** The preference value for sorting 'ascending' */
+    public static final int PREFS_HIERARCHY_VIEW_SORTING_ORDER_ASCENDING = 0;
+
+    /** The prefence value for sorting 'descending' */
+    public static final int PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING = 1;
+
+    // UI Fields
+    private Button atFirstButton;
+    private Button ocFirstButton;
+    private Button mixedButton;
+    private Combo sortingCombo;
+    private Button ascendingButton;
+    private Button descendingButton;
+
+
+    /**
+     * Creates a new instance of HierarchyViewSorterDialog.
+     *
+     * @param parentShell
+     *      the parent shell
+     */
+    public HierarchyViewSorterDialog( Shell parentShell )
+    {
+        super( parentShell );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( DIALOG_TITLE );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+        GridData gd = new GridData( GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL );
+        //        gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+        composite.setLayoutData( gd );
+
+        // Grouping Group
+        Group groupingGroup = new Group( composite, SWT.NONE );
+        groupingGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+        groupingGroup.setText( "Grouping" );
+        groupingGroup.setLayout( new GridLayout() );
+
+        // Attribute Types first Button
+        atFirstButton = new Button( groupingGroup, SWT.RADIO );
+        atFirstButton.setText( "Attribute Types first" );
+        atFirstButton.setEnabled( true );
+
+        // Object Classes first Button
+        ocFirstButton = new Button( groupingGroup, SWT.RADIO );
+        ocFirstButton.setText( "Object Classes first" );
+        ocFirstButton.setEnabled( true );
+
+        // Mixed Button
+        mixedButton = new Button( groupingGroup, SWT.RADIO );
+        mixedButton.setText( "Mixed" );
+        mixedButton.setEnabled( true );
+
+        // Sorting Group
+        Group sortingGroup = new Group( composite, SWT.NONE );
+        sortingGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+        sortingGroup.setText( "Sorting" );
+        sortingGroup.setLayout( new GridLayout() );
+        Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE );
+        GridLayout gl = new GridLayout( 4, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        sortingGroupComposite.setLayout( gl );
+        sortingGroupComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+
+        // Sort by Label
+        Label sortByLabel = new Label( sortingGroupComposite, SWT.NONE );
+        sortByLabel.setText( "Sort by" );
+
+        // Sorting Combo
+        sortingCombo = new Combo( sortingGroupComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
+        sortingCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        sortingCombo.setItems( new String[]
+            { SORTING_FISTNAME, SORTING_OID } );
+        sortingCombo.setEnabled( true );
+
+        // Ascending Button
+        ascendingButton = new Button( sortingGroupComposite, SWT.RADIO );
+        ascendingButton.setText( "Ascending" );
+        ascendingButton.setEnabled( true );
+
+        // Descending Button
+        descendingButton = new Button( sortingGroupComposite, SWT.RADIO );
+        descendingButton.setText( "Descending" );
+        descendingButton.setEnabled( true );
+
+        initFieldsFromPreferences();
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    /**
+     * Initializes the fields for the stored preferences.
+     */
+    private void initFieldsFromPreferences()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        int grouping = store.getInt( PREFS_HIERARCHY_VIEW_GROUPING );
+        if ( grouping == PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST )
+        {
+            atFirstButton.setSelection( true );
+        }
+        else if ( grouping == PREFS_HIERARCHY_VIEW_GROUPING_OCFIRST )
+        {
+            ocFirstButton.setSelection( true );
+        }
+        else if ( grouping == PREFS_HIERARCHY_VIEW_GROUPING_MIXED )
+        {
+            mixedButton.setSelection( true );
+        }
+
+        int sortingBy = store.getInt( PREFS_HIERARCHY_VIEW_SORTING_BY );
+        if ( sortingBy == PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+        {
+            sortingCombo.select( 0 );
+        }
+        else if ( sortingBy == PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+        {
+            sortingCombo.select( 1 );
+        }
+
+        int sortingOrder = store.getInt( PREFS_HIERARCHY_VIEW_SORTING_ORDER );
+        if ( sortingOrder == PREFS_HIERARCHY_VIEW_SORTING_ORDER_ASCENDING )
+        {
+            ascendingButton.setSelection( true );
+        }
+        else if ( sortingOrder == PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+        {
+            descendingButton.setSelection( true );
+        }
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        if ( buttonId == IDialogConstants.OK_ID )
+        {
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            if ( ( atFirstButton.getSelection() ) & ( !ocFirstButton.getSelection() ) & ( !mixedButton.getSelection() ) )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_GROUPING, PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST );
+            }
+            else if ( ( !atFirstButton.getSelection() ) & ( ocFirstButton.getSelection() )
+                & ( !mixedButton.getSelection() ) )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_GROUPING, PREFS_HIERARCHY_VIEW_GROUPING_OCFIRST );
+            }
+            else if ( ( !atFirstButton.getSelection() ) & ( !ocFirstButton.getSelection() )
+                & ( mixedButton.getSelection() ) )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_GROUPING, PREFS_HIERARCHY_VIEW_GROUPING_MIXED );
+            }
+
+            if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_FISTNAME ) )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_SORTING_BY, PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME );
+            }
+            else if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_OID ) )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_SORTING_BY, PREFS_HIERARCHY_VIEW_SORTING_BY_OID );
+            }
+
+            if ( ascendingButton.getSelection() && !descendingButton.getSelection() )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_SORTING_ORDER, PREFS_HIERARCHY_VIEW_SORTING_ORDER_ASCENDING );
+            }
+            else if ( !ascendingButton.getSelection() && descendingButton.getSelection() )
+            {
+                store.setValue( PREFS_HIERARCHY_VIEW_SORTING_ORDER, PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING );
+            }
+        }
+
+        super.buttonPressed( buttonId );
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java Mon Feb 19 05:41:26 2007
@@ -21,8 +21,6 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers;
 
 
-import java.util.Comparator;
-
 import org.apache.directory.ldapstudio.schemas.controller.Application;
 import org.apache.directory.ldapstudio.schemas.controller.PoolManagerController;
 import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
@@ -111,17 +109,6 @@
         {
             viewer.setExpandedState( object, true );
         }
-    }
-
-
-    /**
-     * Specify the comparator that will be used to sort the elements in that viewer
-     * @param order the comparator
-     */
-    public void setOrder( Comparator order )
-    {
-        contentProvider.setOrder( order );
-        refresh();
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java Mon Feb 19 05:41:26 2007
@@ -21,17 +21,20 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers;
 
 
-import java.util.Comparator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.model.Schema;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AlphabeticalOrderComparator;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.PoolManagerAttributeTypeWrapper;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.PoolManagerObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemasViewSorter;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode.IntermediateNodeType;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -40,15 +43,15 @@
 
 
 /**
- * Content provider for the schema-pool manager
+ * This class implements the Content Provider for the Schemas View.
  *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
-public class PoolManagerContentProvider implements SortableContentProvider, IStructuredContentProvider,
-    ITreeContentProvider
+public class PoolManagerContentProvider implements IStructuredContentProvider, ITreeContentProvider
 {
-
+    /** The Schema Pool */
     private SchemaPool pool;
-    private Comparator order = new AlphabeticalOrderComparator();
 
 
     /**
@@ -70,79 +73,59 @@
 
 
     /* (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 )
-    {
-    }
-
-
-    /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
      */
     public Object[] getChildren( Object parentElement )
     {
+        List<DisplayableTreeElement> children = new ArrayList<DisplayableTreeElement>();
+
         if ( parentElement instanceof IntermediateNode )
         {
             IntermediateNode intermediate = ( IntermediateNode ) parentElement;
-
-            if ( intermediate.getName().equals( "**Primary Node**" ) ) { //$NON-NLS-1$
-                // clear the primary node (because it's always the same instance we need to
-                //refresh it manually)
-                intermediate.clearChildrens();
-
+            if ( intermediate.getName().equals( "**Primary Node**" ) ) //$NON-NLS-1$
+            {
                 Schema[] schemas = this.pool.getSchemas();
                 for ( int i = 0; i < schemas.length; i++ )
                 {
-                    Schema schema = schemas[i];
-                    SchemaWrapper schemaWrapper = new SchemaWrapper( schema, ( IntermediateNode ) parentElement );
-                    intermediate.addElement( schemaWrapper );
+                    children.add( new SchemaWrapper( schemas[i], ( IntermediateNode ) parentElement ) );
                 }
             }
+            else if ( intermediate.getType().equals( IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ) )
+            {
+                Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();
 
-            Object[] temp = intermediate.getChildren();
-            return temp;
-        }
+                AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
+                for ( int i = 0; i < attributeTypeList.length; i++ )
+                {
+                    children.add( new AttributeTypeWrapper( attributeTypeList[i], intermediate ) );
+                }
+            }
+            else if ( intermediate.getType().equals( IntermediateNodeType.OBJECT_CLASS_FOLDER ) )
+            {
+                Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();
 
+                ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
+                for ( int i = 0; i < objectClassList.length; i++ )
+                {
+                    children.add( new ObjectClassWrapper( objectClassList[i], intermediate ) );
+                }
+            }
+        }
         else if ( parentElement instanceof SchemaWrapper )
         {
-            //we are looking for the childrens of the contained objectClass
-            Schema schema = ( ( ( SchemaWrapper ) parentElement ).getMySchema() );
-
             IntermediateNode attributeTypes = new IntermediateNode(
-                "Attribute Types", ( SchemaWrapper ) parentElement, this, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
+                "Attribute Types", ( SchemaWrapper ) parentElement, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
             IntermediateNode objectClasses = new IntermediateNode(
-                "Object Classes", ( SchemaWrapper ) parentElement, this, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
-
-            // Let's get all Attribute Types defined in the schema
-            AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
-            for ( int i = 0; i < attributeTypeList.length; i++ )
-            {
-                AttributeType attributeType = attributeTypeList[i];
-                attributeTypes.addElement( new PoolManagerAttributeTypeWrapper( attributeType, attributeTypes ) );
-            }
+                "Object Classes", ( SchemaWrapper ) parentElement, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
 
-            // Let's get all Object Classes defined in the schema
-            ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
-            for ( int i = 0; i < objectClassList.length; i++ )
-            {
-                ObjectClass objectClass = objectClassList[i];
-                objectClasses.addElement( new PoolManagerObjectClassWrapper( objectClass, objectClasses ) );
-            }
-
-            return new Object[]
-                { attributeTypes, objectClasses };
+            children.add( attributeTypes );
+            children.add( objectClasses );
         }
 
-        return new Object[0];
+        // Sorting children
+        Collections.sort( children, new SchemasViewSorter() );
+
+        return children.toArray();
     }
 
 
@@ -151,14 +134,11 @@
      */
     public Object getParent( Object element )
     {
-        if ( element instanceof SchemaWrapper )
+        if ( element instanceof DisplayableTreeElement )
         {
-            return ( ( SchemaWrapper ) element ).getParent();
-        }
-        else if ( element instanceof IntermediateNode )
-        {
-            return ( ( IntermediateNode ) element ).getParent();
+            return ( ( DisplayableTreeElement ) element ).getParent();
         }
+
         return null;
     }
 
@@ -168,54 +148,42 @@
      */
     public boolean hasChildren( Object element )
     {
-        if ( element instanceof IntermediateNode )
+        if ( element instanceof DisplayableTreeElement )
         {
-            if ( ( ( IntermediateNode ) element ).getChildren().length > 0 )
-                return true;
-        }
-        else if ( element instanceof SchemaWrapper )
-        {
-            return true;
+            return getChildren( element ).length > 0;
         }
+
         return false;
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
-     * Specify the comparator that will be used to sort the elements in the view
-     * @param order the comparator
+     * Initialize a tree viewer to display the information provided by the specified content
+     * provider
+     * @param viewer the tree viewer
      */
-    public void setOrder( Comparator order )
+    public void bindToTreeViewer( TreeViewer viewer )
     {
-        this.order = order;
+        viewer.setContentProvider( this );
+        viewer.setLabelProvider( new PoolManagerLabelProvider() );
+
+        IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null ); //$NON-NLS-1$
+        viewer.setInput( invisibleNode );
     }
 
 
-    /**
-     * Returns the comparator used to sort the elements in the view
-     * @return
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
      */
-    public Comparator getOrder()
+    public void dispose()
     {
-        return order;
     }
 
 
-    /**
-     * Initialize a tree viewer to display the information provided by the specified content
-     * provider
-     * @param viewer the tree viewer
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
      */
-    public void bindToTreeViewer( TreeViewer viewer )
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
     {
-        viewer.setContentProvider( this );
-        viewer.setLabelProvider( new HierarchicalLabelProvider() );
-
-        IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null, this ); //$NON-NLS-1$
-        viewer.setInput( invisibleNode );
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java Mon Feb 19 05:41:26 2007
@@ -21,7 +21,10 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers;
 
 
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.ISharedImages;
@@ -29,21 +32,32 @@
 
 
 /**
- * Label provider for the schema-pool manager
+ * This class implements the LabelProvider for the Schemas View.
  *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class PoolManagerLabelProvider extends LabelProvider
 {
-
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
      */
     public String getText( Object obj )
     {
-        if ( obj instanceof DisplayableTreeElement )
-            return ( ( DisplayableTreeElement ) obj ).getDisplayName();
+        if ( obj instanceof AttributeTypeWrapper )
+        {
+            return ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getNames()[0];
+        }
+        else if ( obj instanceof ObjectClassWrapper )
+        {
+            return ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getNames()[0];
+        }
+        else if ( obj instanceof SchemaWrapper )
+        {
+            return ( ( SchemaWrapper ) obj ).getMySchema().getName();
+        }
 
-        //default
+        // Default
         return obj.toString();
     }
 
@@ -54,10 +68,11 @@
     public Image getImage( Object obj )
     {
         if ( obj instanceof DisplayableTreeElement )
+        {
             return ( ( DisplayableTreeElement ) obj ).getDisplayImage();
+        }
 
-        //default
+        // Default
         return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_WARN_TSK );
-
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java Mon Feb 19 05:41:26 2007
@@ -59,30 +59,6 @@
 
 
     /**
-     * Gets the name of the associated attribute type.
-     * 
-     * @return
-     *      the name of the associated attribute type
-     */
-    public String getName()
-    {
-        return myAttributeType.getNames()[0];
-    }
-
-
-    /**
-     * Gets the OID of the associated attribute type.
-     * 
-     * @return
-     *      the OID of the associated attribute type
-     */
-    public String getOid()
-    {
-        return myAttributeType.getOid();
-    }
-
-
-    /**
      * Gets the associated attribute type.
      * 
      * @return 
@@ -117,15 +93,6 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
-     */
-    public String getDisplayName()
-    {
-        return getName() + "  [" + myAttributeType.getOriginatingSchema().getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-
-    /* (non-Javadoc)
      * @see java.lang.Object#equals(java.lang.Object)
      */
     public boolean equals( Object obj )
@@ -133,8 +100,9 @@
         if ( obj instanceof AttributeTypeWrapper )
         {
             AttributeTypeWrapper compared = ( AttributeTypeWrapper ) obj;
-            return compared.getOid().equals( this.getOid() );
+            return compared.getMyAttributeType().getOid().equals( getMyAttributeType().getOid() );
         }
+
         return false;
     }
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java Mon Feb 19 05:41:26 2007
@@ -40,13 +40,5 @@
     public Image getDisplayImage();
 
 
-    /**
-     * Use this method to get the name that should be displayed in
-     * the tree view.
-     * @return the display name
-     */
-    public String getDisplayName();
-
-
     public DisplayableTreeElement getParent();
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java?view=auto&rev=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java Mon Feb 19 05:41:26 2007
@@ -0,0 +1,58 @@
+/*
+ *  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.viewers.wrappers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+
+
+/**
+ * This class is used to compare and sort ascending two DisplayableTreeElement
+ */
+public class HierarchyViewFirstNameSorter implements Comparator<DisplayableTreeElement>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( DisplayableTreeElement o1, DisplayableTreeElement o2 )
+    {
+        if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper ) )
+        {
+            AttributeType at1 = ( ( AttributeTypeWrapper ) o1 ).getMyAttributeType();
+            AttributeType at2 = ( ( AttributeTypeWrapper ) o2 ).getMyAttributeType();
+
+            return at1.getNames()[0].compareToIgnoreCase( at2.getNames()[0] );
+        }
+        else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof ObjectClassWrapper ) )
+        {
+            ObjectClass oc1 = ( ( ObjectClassWrapper ) o1 ).getMyObjectClass();
+            ObjectClass oc2 = ( ( ObjectClassWrapper ) o2 ).getMyObjectClass();
+
+            return oc1.getNames()[0].compareToIgnoreCase( oc2.getNames()[0] );
+        }
+
+        // Default
+        return 0;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java?view=auto&rev=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java Mon Feb 19 05:41:26 2007
@@ -0,0 +1,58 @@
+/*
+ *  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.viewers.wrappers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+
+
+/**
+ * This class is used to compare and sort ascending two DisplayableTreeElement
+ */
+public class HierarchyViewOidSorter implements Comparator<DisplayableTreeElement>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( DisplayableTreeElement o1, DisplayableTreeElement o2 )
+    {
+        if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper ) )
+        {
+            AttributeType at1 = ( ( AttributeTypeWrapper ) o1 ).getMyAttributeType();
+            AttributeType at2 = ( ( AttributeTypeWrapper ) o2 ).getMyAttributeType();
+
+            return at1.getOid().compareToIgnoreCase( at2.getOid() );
+        }
+        else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof ObjectClassWrapper ) )
+        {
+            ObjectClass oc1 = ( ( ObjectClassWrapper ) o1 ).getMyObjectClass();
+            ObjectClass oc2 = ( ( ObjectClassWrapper ) o2 ).getMyObjectClass();
+
+            return oc1.getOid().compareToIgnoreCase( oc2.getOid() );
+        }
+
+        // Default
+        return 0;
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java Mon Feb 19 05:41:26 2007
@@ -21,12 +21,8 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
 
 
-import java.util.ArrayList;
-import java.util.Collections;
-
 import org.apache.directory.ldapstudio.schemas.controller.Application;
 import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
-import org.apache.directory.ldapstudio.schemas.view.viewers.SortableContentProvider;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
@@ -42,26 +38,21 @@
  */
 public class IntermediateNode implements DisplayableTreeElement
 {
-
     /** This enum represent the different types of IntermediateNodes */
     public enum IntermediateNodeType
     {
         NONE, OBJECT_CLASS_FOLDER, ATTRIBUTE_TYPE_FOLDER
     }
 
-    /******************************************
-     *               Fields                   *
-     ******************************************/
-    private SortableContentProvider contentProvider;
+    /** The name */
     private String name;
+
+    /** The parent element */
     private DisplayableTreeElement parent;
-    private ArrayList<DisplayableTreeElement> elements;
-    private IntermediateNodeType type;
 
+    /** The type */
+    private IntermediateNodeType type;
 
-    /******************************************
-     *              Constructors              *
-     ******************************************/
 
     /**
      * Default constructor
@@ -69,12 +60,10 @@
      * @param parent the parent DisplayableTreeElement in the schema relationship
      * hierarchy
      */
-    public IntermediateNode( String name, DisplayableTreeElement parent, SortableContentProvider contentProvider )
+    public IntermediateNode( String name, DisplayableTreeElement parent )
     {
         this.name = name;
         this.parent = parent;
-        this.contentProvider = contentProvider;
-        elements = new ArrayList<DisplayableTreeElement>();
         this.type = IntermediateNodeType.NONE;
     }
 
@@ -89,13 +78,10 @@
      * @param type 
      *      the type of IntermediateNode
      */
-    public IntermediateNode( String name, DisplayableTreeElement parent, SortableContentProvider contentProvider,
-        IntermediateNodeType type )
+    public IntermediateNode( String name, DisplayableTreeElement parent, IntermediateNodeType type )
     {
         this.name = name;
         this.parent = parent;
-        this.contentProvider = contentProvider;
-        elements = new ArrayList<DisplayableTreeElement>();
         this.type = type;
     }
 
@@ -122,112 +108,6 @@
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
-    /**
-     * Adds a 'child' element to the node only if it's not already under the node.
-     * @param o usually AttributeTypeWrappers, SchemaWrapper or ObjectClassWrappers.
-     */
-    public void addElement( DisplayableTreeElement o )
-    {
-        if ( o instanceof AttributeTypeWrapper )
-        {
-            //initial case
-            if ( elements.size() == 0 )
-                elements.add( o );
-
-            AttributeTypeWrapper toAdd = ( AttributeTypeWrapper ) o;
-            for ( DisplayableTreeElement element : elements )
-            {
-                if ( element instanceof AttributeTypeWrapper )
-                {
-                    AttributeTypeWrapper alreadyThere = ( AttributeTypeWrapper ) element;
-                    //check if the attributeType instance has already been added
-                    if ( toAdd.getMyAttributeType().equals( alreadyThere.getMyAttributeType() ) )
-                        return;
-                }
-            }
-            elements.add( o );
-        }
-        else if ( o instanceof ObjectClassWrapper )
-        {
-            //initial case
-            if ( elements.size() == 0 )
-                elements.add( o );
-
-            ObjectClassWrapper toAdd = ( ObjectClassWrapper ) o;
-            for ( DisplayableTreeElement element : elements )
-            {
-                if ( element instanceof ObjectClassWrapper )
-                {
-                    ObjectClassWrapper alreadyThere = ( ObjectClassWrapper ) element;
-
-                    //check if the objectClass instance has already been added
-                    if ( toAdd.getMyObjectClass().equals( alreadyThere.getMyObjectClass() ) )
-                        return;
-                }
-            }
-            elements.add( o );
-        }
-        else if ( o instanceof SchemaWrapper )
-        {
-            //initial case
-            if ( elements.size() == 0 )
-                elements.add( o );
-
-            SchemaWrapper toAdd = ( SchemaWrapper ) o;
-            for ( DisplayableTreeElement element : elements )
-            {
-                if ( element instanceof SchemaWrapper )
-                {
-                    SchemaWrapper alreadyThere = ( SchemaWrapper ) element;
-
-                    if ( toAdd.getMySchema().getName().equals( alreadyThere.getMySchema().getName() ) )
-                        return;
-                }
-            }
-            elements.add( o );
-        }
-    }
-
-
-    /**
-     * Clears the list of childrens from the intermediate nodes
-     */
-    public void clearChildrens()
-    {
-        elements = new ArrayList<DisplayableTreeElement>();
-    }
-
-
-    /**
-     * Returns the child elements in the form of an array of objects
-     * @return
-     */
-    @SuppressWarnings("unchecked")//$NON-NLS-1$
-    public Object[] getChildren()
-    {
-        Collections.sort( elements, contentProvider.getOrder() );
-        return elements.toArray( new Object[]
-            {} );
-    }
-
-
-    /******************************************
-     *       DisplayableTreeElement Impl.     *
-     ******************************************/
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
-     */
-    public String getDisplayName()
-    {
-        return getName();
-    }
-
-
     /* (non-Javadoc)
      * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
      */
@@ -239,13 +119,13 @@
                 String imageKey = ISharedImages.IMG_OBJ_FOLDER;
                 return PlatformUI.getWorkbench().getSharedImages().getImage( imageKey );
             case ATTRIBUTE_TYPE_FOLDER:
-                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.FOLDER_ATTRIBUTE_TYPE )
-                .createImage();
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+                    IImageKeys.FOLDER_ATTRIBUTE_TYPE ).createImage();
             case OBJECT_CLASS_FOLDER:
-                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.FOLDER_OBJECT_CLASS )
-                .createImage();
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+                    IImageKeys.FOLDER_OBJECT_CLASS ).createImage();
         }
-        
+
         String imageKey = ISharedImages.IMG_OBJ_FOLDER;
         return PlatformUI.getWorkbench().getSharedImages().getImage( imageKey );
     }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java?view=diff&rev=509199&r1=509198&r2=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java Mon Feb 19 05:41:26 2007
@@ -76,30 +76,6 @@
 
 
     /**
-     * Gets the names of the associated object class.
-     *
-     * @return
-     *      the names of the associated object class
-     */
-    public String[] getNames()
-    {
-        return myObjectClass.getNames();
-    }
-
-
-    /**
-     * Gets the OID of the associated object class.
-     * 
-     * @return 
-     *      the oid of the associated object class
-     */
-    public String getOid()
-    {
-        return myObjectClass.getOid();
-    }
-
-
-    /**
      * Gets the associated object class
      * 
      * @return 
@@ -163,15 +139,6 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
-     */
-    public String getDisplayName()
-    {
-        return getNames()[0] + "  [" + myObjectClass.getOriginatingSchema().getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-
-    /* (non-Javadoc)
      * @see java.lang.Object#equals(java.lang.Object)
      */
     public boolean equals( Object obj )
@@ -179,7 +146,7 @@
         if ( obj instanceof ObjectClassWrapper )
         {
             ObjectClassWrapper compared = ( ObjectClassWrapper ) obj;
-            return compared.getOid().equals( this.getOid() );
+            return compared.getMyObjectClass().getOid().equals( this.getMyObjectClass().getOid() );
         }
         return false;
     }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewSorter.java?view=auto&rev=509199
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewSorter.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewSorter.java Mon Feb 19 05:41:26 2007
@@ -0,0 +1,66 @@
+/*
+ *  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.viewers.wrappers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+
+
+/**
+ * This class is used to compare and sort ascending two DisplayableTreeElement
+ */
+public class SchemasViewSorter implements Comparator<DisplayableTreeElement>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( DisplayableTreeElement o1, DisplayableTreeElement o2 )
+    {
+        if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper ) )
+        {
+            AttributeType at1 = ( ( AttributeTypeWrapper ) o1 ).getMyAttributeType();
+            AttributeType at2 = ( ( AttributeTypeWrapper ) o2 ).getMyAttributeType();
+
+            return at1.getNames()[0].compareToIgnoreCase( at2.getNames()[0] );
+        }
+        else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof ObjectClassWrapper ) )
+        {
+            ObjectClass oc1 = ( ( ObjectClassWrapper ) o1 ).getMyObjectClass();
+            ObjectClass oc2 = ( ( ObjectClassWrapper ) o2 ).getMyObjectClass();
+
+            return oc1.getNames()[0].compareToIgnoreCase( oc2.getNames()[0] );
+        }
+        else if ( ( o1 instanceof SchemaWrapper ) && ( o2 instanceof SchemaWrapper ) )
+        {
+            Schema s1 = ( ( SchemaWrapper ) o1 ).getMySchema();
+            Schema s2 = ( ( SchemaWrapper ) o2 ).getMySchema();
+
+            return s1.getName().compareToIgnoreCase( s2.getName() );
+        }
+
+        // Default
+        return 0;
+    }
+}



Mime
View raw message