directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r512282 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ src/main/java/org/apache/dire...
Date Tue, 27 Feb 2007 15:32:05 GMT
Author: pamarcelot
Date: Tue Feb 27 07:32:00 2007
New Revision: 512282

URL: http://svn.apache.org/viewvc?view=rev&rev=512282
Log:
Added a Sort Dialog and a Preference page for the Schemas View.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenHierarchyViewSortDialogAction.java
      - copied, changed from r512192, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSortDialogAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewPreferencesAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewSortDialogAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/preferences/SchemasViewPreferencePage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSortDialog.java
      - copied, changed from r512192, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewSortDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/FirstNameSorter.java
      - copied, changed from r512192, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java
      - copied, changed from r512192, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSortDialogAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewSorter.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml Tue Feb 27 07:32:00 2007
@@ -188,6 +188,10 @@
             class="org.apache.directory.ldapstudio.schemas.view.preferences.HierarchyViewPreferencePage"
             id="org.apache.directory.ldapstudio.schemas.preferences.hierarchyView"
             name="Hierarchy View"/>
+      <page
+            class="org.apache.directory.ldapstudio.schemas.view.preferences.SchemasViewPreferencePage"
+            id="org.apache.directory.ldapstudio.schemas.preferences.schemasView"
+            name="Schemas View"/>
    </extension>
    <extension
          point="org.eclipse.core.runtime.preferences">

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java Tue Feb 27 07:32:00 2007
@@ -27,7 +27,7 @@
 import org.apache.directory.ldapstudio.schemas.controller.actions.HideObjectClassesAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.LinkWithEditorHierarchyView;
 import org.apache.directory.ldapstudio.schemas.controller.actions.OpenHierarchyViewPreferencesAction;
-import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSortDialogAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenHierarchyViewSortDialogAction;
 import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditor;
@@ -71,7 +71,7 @@
     private HideAttributeTypesAction hideAttributeTypes;
     private CollapseAllAction collapseAll;
     private LinkWithEditorHierarchyView linkWithEditor;
-    private OpenSortDialogAction openSortDialog;
+    private OpenHierarchyViewSortDialogAction openSortDialog;
     private OpenHierarchyViewPreferencesAction openPreferencePage;
 
 
@@ -99,7 +99,7 @@
         hideAttributeTypes = new HideAttributeTypesAction( view );
         collapseAll = new CollapseAllAction( view.getViewer() );
         linkWithEditor = new LinkWithEditorHierarchyView( view );
-        openSortDialog = new OpenSortDialogAction();
+        openSortDialog = new OpenHierarchyViewSortDialogAction();
         openPreferencePage = new OpenHierarchyViewPreferencesAction();
     }
 
@@ -206,6 +206,5 @@
                 view.getViewer().refresh();
             }
         } );
-
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java Tue Feb 27 07:32:00 2007
@@ -25,7 +25,9 @@
 import org.apache.directory.ldapstudio.schemas.view.preferences.GeneralPreferencePage;
 import org.apache.directory.ldapstudio.schemas.view.preferences.HierarchyViewPreferencePage;
 import org.apache.directory.ldapstudio.schemas.view.preferences.SchemaPreferencePage;
-import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyViewSorterDialog;
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemasViewPreferencePage;
+import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyViewSortDialog;
+import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasViewSortDialog;
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.core.runtime.preferences.DefaultScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -56,7 +58,7 @@
 
         // Hierarchy View Preference Page
         store.setDefault( HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_LABEL,
-            HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME );
+            HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES );
         store.setDefault( HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_ABBREVIATE, true );
         store.setDefault( HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH, "50" );
         store.setDefault( HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY, true );
@@ -66,11 +68,25 @@
         store.setDefault( HierarchyViewPreferencePage.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH, "50" );
 
         // Hierarchy View Sorting
-        store.setDefault( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING,
-            HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST );
-        store.setDefault( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY,
-            HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME );
-        store.setDefault( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER,
-            HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_ASCENDING );
+        store.setDefault( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING,
+            HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST );
+        store.setDefault( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY,
+            HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME );
+        store.setDefault( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER,
+            HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_ASCENDING );
+
+        // Schemas View Preference Page
+        store.setDefault( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL,
+            SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_ALL_ALIASES );
+        store.setDefault( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_ABBREVIATE, true );
+        store.setDefault( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH, "50" );
+
+        // Schemas View Sorting
+        store.setDefault( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_GROUPING,
+            SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS );
+        store.setDefault( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY,
+            SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME );
+        store.setDefault( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER,
+            SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER_ASCENDING );
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java Tue Feb 27 07:32:00 2007
@@ -21,6 +21,7 @@
 package org.apache.directory.ldapstudio.schemas.controller;
 
 
+import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewAttributeTypeAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewObjectClassAction;
@@ -29,6 +30,8 @@
 import org.apache.directory.ldapstudio.schemas.controller.actions.LinkWithEditorSchemasView;
 import org.apache.directory.ldapstudio.schemas.controller.actions.OpenLocalFileAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSchemaSourceCode;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSchemasViewPreferencesAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSchemasViewSortDialogAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.RemoveSchemaAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAsAction;
@@ -54,6 +57,8 @@
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelection;
@@ -106,6 +111,8 @@
     private Action openSchemaSourceCode;
     private Action save;
     private Action saveAs;
+    private Action openSortDialog;
+    private Action openPreferencePage;
 
 
     /**
@@ -120,10 +127,12 @@
 
         initActions();
         initToolbar();
+        initMenu();
         initContextMenu();
         initDragAndDrop();
         initDoubleClickListener();
         registerUpdateActions();
+        initPreferencesListener();
     }
 
 
@@ -144,6 +153,8 @@
             "View source code" );
         save = new SaveAction();
         saveAs = new SaveAsAction();
+        openSortDialog = new OpenSchemasViewSortDialogAction();
+        openPreferencePage = new OpenSchemasViewPreferencesAction();
     }
 
 
@@ -167,6 +178,20 @@
 
 
     /**
+     * Initializes the Menu.
+     */
+    private void initMenu()
+    {
+        IMenuManager menu = view.getViewSite().getActionBars().getMenuManager();
+        menu.add( openSortDialog );
+        menu.add( new Separator() );
+        menu.add( linkWithEditor );
+        menu.add( new Separator() );
+        menu.add( openPreferencePage );
+    }
+
+
+    /**
      * Initializes the ContextMenu.
      */
     private void initContextMenu()
@@ -356,8 +381,6 @@
              */
             public void doubleClick( DoubleClickEvent event )
             {
-                // TODO : /!\ Essayer de factoriser le code commun � la fenetre de vue hierarchique dans une classe abstraite
-
                 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
 
                 SchemasView view = ( SchemasView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
@@ -529,6 +552,24 @@
                         }
                     }
                 }
+            }
+        } );
+    }
+
+
+    /**
+     * Initializes the listener on the preferences store
+     */
+    private void initPreferencesListener()
+    {
+        Activator.getDefault().getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener()
+        {
+            /* (non-Javadoc)
+             * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+             */
+            public void propertyChange( PropertyChangeEvent event )
+            {
+                view.getViewer().refresh();
             }
         } );
     }

Copied: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenHierarchyViewSortDialogAction.java (from r512192, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSortDialogAction.java)
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenHierarchyViewSortDialogAction.java?view=diff&rev=512282&p1=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSortDialogAction.java&r1=512192&p2=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenHierarchyViewSortDialogAction.java&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSortDialogAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenHierarchyViewSortDialogAction.java Tue Feb 27 07:32:00 2007
@@ -20,42 +20,45 @@
 
 package org.apache.directory.ldapstudio.schemas.controller.actions;
 
+
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
-import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyViewSorterDialog;
+import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyViewSortDialog;
 import org.eclipse.jface.action.Action;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 
 /**
- * This action opens the Sort Dialog of the Hierchy View.
+ * This action opens the Sort Dialog of the Hierarchy View.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class OpenSortDialogAction extends Action
+public class OpenHierarchyViewSortDialogAction extends Action
 {
-    
+
     /**
      * Creates a new instance of OpenSortDialogAction.
      *
      * @param view
      *      the associated view
      */
-    public OpenSortDialogAction()
+    public OpenHierarchyViewSortDialogAction()
     {
         super( "Sorting..." );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.SORT )  );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.SORT ) );
         setEnabled( true );
     }
-    
+
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.action.Action#run()
      */
     public void run()
     {
-        HierarchyViewSorterDialog hvsd = new HierarchyViewSorterDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell() );
+        HierarchyViewSortDialog hvsd = new HierarchyViewSortDialog( PlatformUI.getWorkbench().getDisplay()
+            .getActiveShell() );
         hvsd.open();
     }
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewPreferencesAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewPreferencesAction.java?view=auto&rev=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewPreferencesAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewPreferencesAction.java Tue Feb 27 07:32:00 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.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemasViewPreferencePage;
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+
+/**
+ * This action opens the Sort Dialog of the Schemas View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenSchemasViewPreferencesAction extends Action
+{
+    /**
+     * Creates a new instance of OpenSchemasViewPreferencesAction.
+     */
+    public OpenSchemasViewPreferencesAction()
+    {
+        super( "Preferences..." );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        Shell shell = Display.getCurrent().getActiveShell();
+        PreferencesUtil.createPreferenceDialogOn( shell, SchemasViewPreferencePage.ID, new String[]
+            { SchemasViewPreferencePage.ID }, null ).open();
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewSortDialogAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewSortDialogAction.java?view=auto&rev=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewSortDialogAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemasViewSortDialogAction.java Tue Feb 27 07:32:00 2007
@@ -0,0 +1,61 @@
+/*
+ *  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.controller.actions;
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasViewSortDialog;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action opens the Sort Dialog of the Schemas View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenSchemasViewSortDialogAction extends Action
+{
+    
+    /**
+     * Creates a new instance of OpenSortDialogAction.
+     *
+     * @param view
+     *      the associated view
+     */
+    public OpenSchemasViewSortDialogAction()
+    {
+        super( "Sorting..." );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.SORT )  );
+        setEnabled( true );
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        SchemasViewSortDialog svsd = new SchemasViewSortDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell() );
+        svsd.open();
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/preferences/SchemasViewPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/preferences/SchemasViewPreferencePage.java?view=auto&rev=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/preferences/SchemasViewPreferencePage.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/preferences/SchemasViewPreferencePage.java Tue Feb 27 07:32:00 2007
@@ -0,0 +1,278 @@
+/*
+ *  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.preferences;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+/**
+ * This class implements the Preference page for the Schemas View
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemasViewPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+    /** The preference page ID */
+    public static final String ID = Activator.PLUGIN_ID + ".preferences.schemasView";
+
+    /** The First Name category */
+    private static final String FIRST_NAME = "First Name";
+
+    /** The All Aliases category */
+    private static final String ALL_ALIASES = "All Aliases";
+
+    /** The OID category */
+    private static final String OID = "OID";
+
+    /** The preference ID for Label */
+    public static final String PREFS_SCHEMAS_VIEW_LABEL = SchemasViewPreferencePage.ID + ".label.labelValue";
+
+    /** The preference value for First Name label */
+    public static final int PREFS_SCHEMAS_VIEW_LABEL_FIRST_NAME = 0;
+
+    /** The preference value for All Aliases label */
+    public static final int PREFS_SCHEMAS_VIEW_LABEL_ALL_ALIASES = 1;
+
+    /** The preference value for OID label */
+    public static final int PREFS_SCHEMAS_VIEW_LABEL_OID = 2;
+
+    /** The preference ID for Abbreviate */
+    public static final String PREFS_SCHEMAS_VIEW_ABBREVIATE = SchemasViewPreferencePage.ID + ".label.abbreviate";
+
+    /** The preference ID for Abbreviate Max Length*/
+    public static final String PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH = SchemasViewPreferencePage.ID
+        + ".label.abbreviate.maxLength";
+
+    // UI fields
+    private Combo labelCombo;
+    private Button limitButton;
+    private Text lengthText;
+
+
+    /**
+     * Creates a new instance of HierarchyViewPreferencePage.
+     */
+    public SchemasViewPreferencePage()
+    {
+        super();
+        super.setPreferenceStore( Activator.getDefault().getPreferenceStore() );
+        super.setDescription( "General settings for the Schemas Editor Schemas View" );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createContents( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout gl = new GridLayout( 1, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        composite.setLayout( gl );
+        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        composite.setLayoutData( gd );
+
+        // Label Group
+        Group labelGroup = new Group( composite, SWT.NONE );
+        labelGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        labelGroup.setText( "Label" );
+        labelGroup.setLayout( new GridLayout() );
+        Composite labelGroupComposite = new Composite( labelGroup, SWT.NONE );
+        gl = new GridLayout( 1, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        labelGroupComposite.setLayout( gl );
+        labelGroupComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+
+        // Label row composite
+        Composite labelComposite = new Composite( labelGroupComposite, SWT.NONE );
+        gl = new GridLayout( 3, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        labelComposite.setLayout( gl );
+        gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        labelComposite.setLayoutData( gd );
+
+        // Use Label
+        Label useLabel = new Label( labelComposite, SWT.NONE );
+        useLabel.setText( "Use" );
+
+        // Label Combo
+        labelCombo = new Combo( labelComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
+        labelCombo.setLayoutData( new GridData() );
+        labelCombo.setItems( new String[]
+            { FIRST_NAME, ALL_ALIASES, OID } );
+        labelCombo.setEnabled( true );
+
+        // As label Label
+        Label asLabel = new Label( labelComposite, SWT.NONE );
+        asLabel.setText( "as label." );
+
+        // Abbreviate row composite
+        Composite abbreviateComposite = new Composite( labelGroupComposite, SWT.NONE );
+        gl = new GridLayout( 3, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        abbreviateComposite.setLayout( gl );
+        gd = new GridData( GridData.FILL_HORIZONTAL );
+        gd.horizontalSpan = 1;
+        abbreviateComposite.setLayoutData( gd );
+
+        // Limit label lenght to Label
+        limitButton = new Button( abbreviateComposite, SWT.CHECK );
+        limitButton.setText( "Limit label length to" );
+        gd = new GridData();
+        gd.horizontalSpan = 1;
+        limitButton.setLayoutData( gd );
+
+        // Lenght Text
+        lengthText = new Text( abbreviateComposite, SWT.NONE | SWT.BORDER );
+        GridData gridData = new GridData();
+        gridData.horizontalSpan = 1;
+        gridData.widthHint = 9 * 3;
+        lengthText.setLayoutData( gridData );
+        lengthText.setTextLimit( 3 );
+        lengthText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( lengthText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+
+        // Characters Label
+        Label charactersLabel = new Label( abbreviateComposite, SWT.NONE );
+        charactersLabel.setText( "characters." );
+
+        initFieldsFromPreferences();
+
+        initListeners();
+
+        applyDialogFont( parent );
+
+        return parent;
+    }
+
+
+    /**
+     * Initializes the fields from the preferences store.
+     */
+    private void initFieldsFromPreferences()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        labelCombo.select( store.getInt( PREFS_SCHEMAS_VIEW_LABEL ) );
+        limitButton.setSelection( store.getBoolean( PREFS_SCHEMAS_VIEW_ABBREVIATE ) );
+        lengthText.setEnabled( limitButton.getSelection() );
+        lengthText.setText( store.getString( PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH ) );
+    }
+
+
+    /**
+     * Initializes the listeners.
+     */
+    private void initListeners()
+    {
+        limitButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                lengthText.setEnabled( limitButton.getSelection() );
+            }
+        } );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+     */
+    protected void performDefaults()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        labelCombo.select( store.getDefaultInt( PREFS_SCHEMAS_VIEW_LABEL ) );
+        limitButton.setSelection( store.getDefaultBoolean( PREFS_SCHEMAS_VIEW_ABBREVIATE ) );
+        lengthText.setEnabled( limitButton.getSelection() );
+        lengthText.setText( store.getDefaultString( PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH ) );
+
+        super.performDefaults();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.PreferencePage#performOk()
+     */
+    public boolean performOk()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( FIRST_NAME ) )
+        {
+            store.setValue( PREFS_SCHEMAS_VIEW_LABEL, PREFS_SCHEMAS_VIEW_LABEL_FIRST_NAME );
+        }
+        else if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( ALL_ALIASES ) )
+        {
+            store.setValue( PREFS_SCHEMAS_VIEW_LABEL, PREFS_SCHEMAS_VIEW_LABEL_ALL_ALIASES );
+        }
+        else if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( OID ) )
+        {
+            store.setValue( PREFS_SCHEMAS_VIEW_LABEL, PREFS_SCHEMAS_VIEW_LABEL_OID );
+        }
+        store.setValue( PREFS_SCHEMAS_VIEW_ABBREVIATE, limitButton.getSelection() );
+        store.setValue( PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH, lengthText.getText() );
+
+        return true;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+     */
+    public void init( IWorkbench workbench )
+    {
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java Tue Feb 27 07:32:00 2007
@@ -33,8 +33,8 @@
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 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.HierarchyViewFirstNameSorter;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.HierarchyViewOidSorter;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.FirstNameSorter;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.OidSorter;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -55,6 +55,9 @@
     /** The Schema Pool holding all schemas */
     private SchemaPool schemaPool;
 
+    /** The preferences store */
+    IPreferenceStore store;
+
     /** The HashTable containing all the object classes */
     private ObjectClass[] objectClasses;
 
@@ -62,10 +65,10 @@
     private AttributeType[] attributeTypes;
 
     /** The FirstName Sorter */
-    private HierarchyViewFirstNameSorter firstNameSorter;
+    private FirstNameSorter firstNameSorter;
 
     /** The OID Sorter */
-    private HierarchyViewOidSorter oidSorter;
+    private OidSorter oidSorter;
 
 
     /**
@@ -77,12 +80,13 @@
     public HierarchyViewContentProvider()
     {
         this.schemaPool = SchemaPool.getInstance();
+        store = Activator.getDefault().getPreferenceStore();
 
         objectClasses = schemaPool.getObjectClassesAsArray();
         attributeTypes = schemaPool.getAttributeTypesAsArray();
 
-        firstNameSorter = new HierarchyViewFirstNameSorter();
-        oidSorter = new HierarchyViewOidSorter();
+        firstNameSorter = new FirstNameSorter();
+        oidSorter = new OidSorter();
     }
 
 
@@ -102,10 +106,9 @@
     {
         List<DisplayableTreeElement> children = new ArrayList<DisplayableTreeElement>();
 
-        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-        int group = store.getInt( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING );
-        int sortBy = store.getInt( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY );
-        int sortOrder = store.getInt( HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER );
+        int group = store.getInt( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING );
+        int sortBy = store.getInt( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY );
+        int sortOrder = store.getInt( HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER );
 
         if ( parentElement instanceof ObjectClassWrapper )
         {
@@ -139,19 +142,17 @@
             }
 
             // Sort by
-            if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+            if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
             {
-
                 Collections.sort( children, firstNameSorter );
             }
-            else if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+            else if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
             {
-
                 Collections.sort( children, oidSorter );
             }
 
             // Sort order
-            if ( sortOrder == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+            if ( sortOrder == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
             {
                 Collections.reverse( children );
             }
@@ -188,19 +189,17 @@
             }
 
             // Sort by
-            if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+            if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
             {
-
                 Collections.sort( children, firstNameSorter );
             }
-            else if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+            else if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
             {
-
                 Collections.sort( children, oidSorter );
             }
 
             // Sort order
-            if ( sortOrder == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+            if ( sortOrder == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
             {
                 Collections.reverse( children );
             }
@@ -225,7 +224,6 @@
                         ocList.add( topWrapper );
                     }
 
-
                     for ( int i = 0; i < objectClasses.length; i++ )
                     {
                         ObjectClass oClass = objectClasses[i];
@@ -258,7 +256,7 @@
                 if ( !Activator.getDefault().getDialogSettings().getBoolean(
                     HideAttributeTypesAction.HIDE_ATTRIBUTE_TYPES_DS_KEY ) )
                 {
-                    
+
                     for ( int i = 0; i < attributeTypes.length; i++ )
                     {
                         AttributeType aType = attributeTypes[i];
@@ -272,22 +270,22 @@
                     }
                 }
 
-                if ( group == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST )
+                if ( group == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING_ATFIRST )
                 {
                     // Sort by
-                    if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+                    if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
                     {
                         Collections.sort( atList, firstNameSorter );
                         Collections.sort( ocList, firstNameSorter );
                     }
-                    else if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+                    else if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
                     {
                         Collections.sort( atList, oidSorter );
                         Collections.sort( ocList, oidSorter );
                     }
 
                     // Sort Order
-                    if ( sortOrder == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+                    if ( sortOrder == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
                     {
                         Collections.reverse( atList );
                         Collections.reverse( ocList );
@@ -297,22 +295,22 @@
                     children.addAll( atList );
                     children.addAll( ocList );
                 }
-                else if ( group == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING_OCFIRST )
+                else if ( group == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING_OCFIRST )
                 {
                     // Sort by
-                    if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+                    if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
                     {
                         Collections.sort( atList, firstNameSorter );
                         Collections.sort( ocList, firstNameSorter );
                     }
-                    else if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+                    else if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
                     {
                         Collections.sort( atList, oidSorter );
                         Collections.sort( ocList, oidSorter );
                     }
 
                     // Sort Order
-                    if ( sortOrder == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+                    if ( sortOrder == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
                     {
                         Collections.reverse( atList );
                         Collections.reverse( ocList );
@@ -322,26 +320,24 @@
                     children.addAll( ocList );
                     children.addAll( atList );
                 }
-                else if ( group == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_GROUPING_MIXED )
+                else if ( group == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_GROUPING_MIXED )
                 {
                     // Group
                     children.addAll( atList );
                     children.addAll( ocList );
 
                     // Sort by
-                    if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
+                    if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_FIRSTNAME )
                     {
-
                         Collections.sort( children, firstNameSorter );
                     }
-                    else if ( sortBy == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
+                    else if ( sortBy == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_BY_OID )
                     {
-
                         Collections.sort( children, oidSorter );
                     }
 
                     // Sort order
-                    if ( sortOrder == HierarchyViewSorterDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
+                    if ( sortOrder == HierarchyViewSortDialog.PREFS_HIERARCHY_VIEW_SORTING_ORDER_DESCENDING )
                     {
                         Collections.reverse( children );
                     }

Copied: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSortDialog.java (from r512192, 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/HierarchyViewSortDialog.java?view=diff&rev=512282&p1=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java&r1=512192&p2=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSortDialog.java&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSorterDialog.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewSortDialog.java Tue Feb 27 07:32:00 2007
@@ -43,7 +43,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HierarchyViewSorterDialog extends Dialog
+public class HierarchyViewSortDialog extends Dialog
 {
     /** The title of the dialog */
     private static final String DIALOG_TITLE = "Hierarchy View Sorting";
@@ -102,7 +102,7 @@
      * @param parentShell
      *      the parent shell
      */
-    public HierarchyViewSorterDialog( Shell parentShell )
+    public HierarchyViewSortDialog( Shell parentShell )
     {
         super( parentShell );
     }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java Tue Feb 27 07:32:00 2007
@@ -25,17 +25,20 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.directory.ldapstudio.schemas.Activator;
 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.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.FirstNameSorter;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.OidSorter;
 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.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -51,7 +54,16 @@
 public class SchemasViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
 {
     /** The Schema Pool */
-    private SchemaPool pool;
+    private SchemaPool schemaPool;
+
+    /** The preferences store */
+    IPreferenceStore store;
+
+    /** The FirstName Sorter */
+    private FirstNameSorter firstNameSorter;
+
+    /** The OID Sorter */
+    private OidSorter oidSorter;
 
 
     /**
@@ -59,7 +71,11 @@
      */
     public SchemasViewContentProvider()
     {
-        pool = SchemaPool.getInstance();
+        schemaPool = SchemaPool.getInstance();
+        store = Activator.getDefault().getPreferenceStore();
+
+        firstNameSorter = new FirstNameSorter();
+        oidSorter = new OidSorter();
     }
 
 
@@ -79,12 +95,16 @@
     {
         List<DisplayableTreeElement> children = new ArrayList<DisplayableTreeElement>();
 
+        int group = store.getInt( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_GROUPING );
+        int sortBy = store.getInt( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY );
+        int sortOrder = store.getInt( SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER );
+
         if ( parentElement instanceof IntermediateNode )
         {
             IntermediateNode intermediate = ( IntermediateNode ) parentElement;
             if ( intermediate.getName().equals( "**Primary Node**" ) ) //$NON-NLS-1$
             {
-                Schema[] schemas = this.pool.getSchemas();
+                Schema[] schemas = this.schemaPool.getSchemas();
                 for ( int i = 0; i < schemas.length; i++ )
                 {
                     children.add( new SchemaWrapper( schemas[i], ( IntermediateNode ) parentElement ) );
@@ -99,6 +119,22 @@
                 {
                     children.add( new AttributeTypeWrapper( attributeTypeList[i], intermediate ) );
                 }
+
+                // Sort by
+                if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( children, firstNameSorter );
+                }
+                else if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( children, oidSorter );
+                }
+
+                // Sort order
+                if ( sortOrder == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( children );
+                }
             }
             else if ( intermediate.getType().equals( IntermediateNodeType.OBJECT_CLASS_FOLDER ) )
             {
@@ -109,21 +145,69 @@
                 {
                     children.add( new ObjectClassWrapper( objectClassList[i], intermediate ) );
                 }
+
+                // Sort by
+                if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( children, firstNameSorter );
+                }
+                else if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( children, oidSorter );
+                }
+
+                // Sort order
+                if ( sortOrder == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( children );
+                }
             }
         }
         else if ( parentElement instanceof SchemaWrapper )
         {
-            IntermediateNode attributeTypes = new IntermediateNode(
-                "Attribute Types", ( SchemaWrapper ) parentElement, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
-            IntermediateNode objectClasses = new IntermediateNode(
-                "Object Classes", ( SchemaWrapper ) parentElement, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
+            if ( group == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS )
+            {
+                IntermediateNode attributeTypes = new IntermediateNode(
+                    "Attribute Types", ( SchemaWrapper ) parentElement, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
+                IntermediateNode objectClasses = new IntermediateNode(
+                    "Object Classes", ( SchemaWrapper ) parentElement, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
 
-            children.add( attributeTypes );
-            children.add( objectClasses );
-        }
+                children.add( attributeTypes );
+                children.add( objectClasses );
+            }
+            else if ( group == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_GROUPING_MIXED )
+            {
+                Schema schema = ( ( SchemaWrapper ) parentElement ).getMySchema();
+
+                AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
+                for ( int i = 0; i < attributeTypeList.length; i++ )
+                {
+                    children.add( new AttributeTypeWrapper( attributeTypeList[i], ( SchemaWrapper ) parentElement ) );
+                }
+
+                ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
+                for ( int i = 0; i < objectClassList.length; i++ )
+                {
+                    children.add( new ObjectClassWrapper( objectClassList[i], ( SchemaWrapper ) parentElement ) );
+                }
 
-        // Sorting children
-        Collections.sort( children, new SchemasViewSorter() );
+                // Sort by
+                if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( children, firstNameSorter );
+                }
+                else if ( sortBy == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( children, oidSorter );
+                }
+
+                // Sort order
+                if ( sortOrder == SchemasViewSortDialog.PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( children );
+                }
+            }
+        }
 
         return children.toArray();
     }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java?view=diff&rev=512282&r1=512281&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java Tue Feb 27 07:32:00 2007
@@ -21,10 +21,13 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers;
 
 
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemasViewPreferencePage;
 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.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.ISharedImages;
@@ -39,26 +42,87 @@
  */
 public class SchemasViewLabelProvider extends LabelProvider
 {
+    /** The preferences store */
+    private IPreferenceStore store;
+
+
+    /**
+     * Creates a new instance of SchemasViewLabelProvider.
+     */
+    public SchemasViewLabelProvider()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
      */
     public String getText( Object obj )
     {
+        String label = "";
+
+        int labelValue = store.getInt( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL );
+        boolean abbreviate = store.getBoolean( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_ABBREVIATE );
+        int abbreviateMaxLength = store.getInt( SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH );
+
         if ( obj instanceof AttributeTypeWrapper )
         {
-            return ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getNames()[0];
+            if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_FIRST_NAME )
+            {
+                label = ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getNames()[0];
+            }
+            else if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_ALL_ALIASES )
+            {
+                label = concateNames( ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getNames() );
+            }
+            else if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_OID )
+            {
+                label = ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getOid();
+            }
+            else
+            // Default
+            {
+                label = ( ( AttributeTypeWrapper ) obj ).getMyAttributeType().getNames()[0];
+            }
         }
         else if ( obj instanceof ObjectClassWrapper )
         {
-            return ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getNames()[0];
+            if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_FIRST_NAME )
+            {
+                label = ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getNames()[0];
+            }
+            else if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_ALL_ALIASES )
+            {
+                label = concateNames( ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getNames() );
+            }
+            else if ( labelValue == SchemasViewPreferencePage.PREFS_SCHEMAS_VIEW_LABEL_OID )
+            {
+                label = ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getOid();
+            }
+            else
+            // Default
+            {
+                label = ( ( ObjectClassWrapper ) obj ).getMyObjectClass().getNames()[0];
+            }
         }
         else if ( obj instanceof SchemaWrapper )
         {
-            return ( ( SchemaWrapper ) obj ).getMySchema().getName();
+            label = ( ( SchemaWrapper ) obj ).getMySchema().getName();
         }
-
+        else
         // Default
-        return obj.toString();
+        {
+            label = obj.toString();
+        }
+
+        if ( abbreviate && ( abbreviateMaxLength < label.length() )
+            && ( ( obj instanceof ObjectClassWrapper ) || ( obj instanceof AttributeTypeWrapper ) ) )
+        {
+            label = label.substring( 0, abbreviateMaxLength ) + "...";
+        }
+
+        return label;
     }
 
 
@@ -74,5 +138,29 @@
 
         // Default
         return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_WARN_TSK );
+    }
+
+
+    /**
+     * Concatenates all aliases in a String format
+     *
+     * @param aliases
+     *      the aliases to concatenate
+     * @return
+     *      a String representing all aliases
+     */
+    private String concateNames( String[] aliases )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( aliases[0] );
+
+        for ( int i = 1; i < aliases.length; i++ )
+        {
+            sb.append( ", " );
+            sb.append( aliases[i] );
+        }
+
+        return sb.toString();
     }
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewSortDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewSortDialog.java?view=auto&rev=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewSortDialog.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewSortDialog.java Tue Feb 27 07:32:00 2007
@@ -0,0 +1,259 @@
+/*
+ *  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 SchemasViewSortDialog extends Dialog
+{
+    /** The title of the dialog */
+    private static final String DIALOG_TITLE = "Schemas 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_SCHEMAS_VIEW_GROUPING = Activator.PLUGIN_ID + ".preferences.SchemasView.grouping";
+
+    /** The preference value for grouping 'group ATs and OCs in folders' */
+    public static final int PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS = 0;
+
+    /** The preference value for grouping 'mixed' */
+    public static final int PREFS_SCHEMAS_VIEW_GROUPING_MIXED = 1;
+
+    /** The preference ID for Sorting By */
+    public static final String PREFS_SCHEMAS_VIEW_SORTING_BY = Activator.PLUGIN_ID
+        + ".preferences.SchemasView.sortingBy";
+
+    /** The preference value for sorting 'First Name' */
+    public static final int PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME = 0;
+
+    /** The prefence value for sorting 'OID' */
+    public static final int PREFS_SCHEMAS_VIEW_SORTING_BY_OID = 1;
+
+    /** The preference ID for Sorting Order */
+    public static final String PREFS_SCHEMAS_VIEW_SORTING_ORDER = Activator.PLUGIN_ID
+        + ".preferences.SchemasView.sortingOrder";
+
+    /** The preference value for sorting 'ascending' */
+    public static final int PREFS_SCHEMAS_VIEW_SORTING_ORDER_ASCENDING = 0;
+
+    /** The prefence value for sorting 'descending' */
+    public static final int PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING = 1;
+
+    // UI Fields
+    private Button inFoldersButton;
+    private Button mixedButton;
+    private Combo sortingCombo;
+    private Button ascendingButton;
+    private Button descendingButton;
+
+
+    /**
+     * Creates a new instance of HierarchyViewSorterDialog.
+     *
+     * @param parentShell
+     *      the parent shell
+     */
+    public SchemasViewSortDialog( 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
+        inFoldersButton = new Button( groupingGroup, SWT.RADIO );
+        inFoldersButton.setText( "Group attribute types and object classes in folders" );
+        inFoldersButton.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_SCHEMAS_VIEW_GROUPING );
+        if ( grouping == PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS )
+        {
+            inFoldersButton.setSelection( true );
+        }
+        else if ( grouping == PREFS_SCHEMAS_VIEW_GROUPING_MIXED )
+        {
+            mixedButton.setSelection( true );
+        }
+
+        int sortingBy = store.getInt( PREFS_SCHEMAS_VIEW_SORTING_BY );
+        if ( sortingBy == PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME )
+        {
+            sortingCombo.select( 0 );
+        }
+        else if ( sortingBy == PREFS_SCHEMAS_VIEW_SORTING_BY_OID )
+        {
+            sortingCombo.select( 1 );
+        }
+
+        int sortingOrder = store.getInt( PREFS_SCHEMAS_VIEW_SORTING_ORDER );
+        if ( sortingOrder == PREFS_SCHEMAS_VIEW_SORTING_ORDER_ASCENDING )
+        {
+            ascendingButton.setSelection( true );
+        }
+        else if ( sortingOrder == PREFS_SCHEMAS_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 ( ( inFoldersButton.getSelection() ) & ( !mixedButton.getSelection() ) )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_GROUPING, PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS );
+            }
+            else if ( ( !inFoldersButton.getSelection() ) & ( mixedButton.getSelection() ) )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_GROUPING, PREFS_SCHEMAS_VIEW_GROUPING_MIXED );
+            }
+
+            if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_FISTNAME ) )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_SORTING_BY, PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME );
+            }
+            else if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_OID ) )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_SORTING_BY, PREFS_SCHEMAS_VIEW_SORTING_BY_OID );
+            }
+
+            if ( ascendingButton.getSelection() && !descendingButton.getSelection() )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_SORTING_ORDER, PREFS_SCHEMAS_VIEW_SORTING_ORDER_ASCENDING );
+            }
+            else if ( !ascendingButton.getSelection() && descendingButton.getSelection() )
+            {
+                store.setValue( PREFS_SCHEMAS_VIEW_SORTING_ORDER, PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING );
+            }
+        }
+
+        super.buttonPressed( buttonId );
+    }
+}

Copied: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/FirstNameSorter.java (from r512192, 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/FirstNameSorter.java?view=diff&rev=512282&p1=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java&r1=512192&p2=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/FirstNameSorter.java&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewFirstNameSorter.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/FirstNameSorter.java Tue Feb 27 07:32:00 2007
@@ -30,7 +30,7 @@
 /**
  * This class is used to compare and sort ascending two DisplayableTreeElement
  */
-public class HierarchyViewFirstNameSorter implements Comparator<DisplayableTreeElement>
+public class FirstNameSorter implements Comparator<DisplayableTreeElement>
 {
     /* (non-Javadoc)
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
@@ -53,6 +53,6 @@
         }
 
         // Default
-        return 0;
+        return o1.toString().compareToIgnoreCase( o2.toString() );
     }
 }

Copied: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java (from r512192, 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/OidSorter.java?view=diff&rev=512282&p1=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java&r1=512192&p2=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java&r2=512282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewOidSorter.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java Tue Feb 27 07:32:00 2007
@@ -30,7 +30,7 @@
 /**
  * This class is used to compare and sort ascending two DisplayableTreeElement
  */
-public class HierarchyViewOidSorter implements Comparator<DisplayableTreeElement>
+public class OidSorter implements Comparator<DisplayableTreeElement>
 {
     /* (non-Javadoc)
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
@@ -53,6 +53,6 @@
         }
 
         // Default
-        return 0;
+        return o1.toString().compareToIgnoreCase( o2.toString() );
     }
 }



Mime
View raw message