directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r578192 [1/2] - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: ./ controller/ controller/actions/ model/hierarchy/ view/ view/preferences/ view/views/ view/widget/ view/wrappers/
Date Fri, 21 Sep 2007 16:14:48 GMT
Author: pamarcelot
Date: Fri Sep 21 09:14:46 2007
New Revision: 578192

URL: http://svn.apache.org/viewvc?rev=578192&view=rev
Log:
Part of a fix for DIRSTUDIO-200 (Add an OC and AT hierarchical global view)

Added:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToFlatAction.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToHierarchicalAction.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyWrapper.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/RootObject.java
Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SchemaViewPreferencePage.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewLabelProvider.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java Fri Sep 21 09:14:46 2007
@@ -149,6 +149,8 @@
     public static final String CMD_SHOW_SEARCH_HISTORY = Activator.PLUGIN_ID + ".commands.showSearchHistory";
     public static final String CMD_SHOW_SUBTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSubTypeHierarchy";
     public static final String CMD_SHOW_SUPERTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSuperTypeHierarchy";
+    public static final String CMD_SWITCH_SCHEMA_PRESENTATION_TO_FLAT = Activator.PLUGIN_ID + ".commands.switchSchemaPresentationToFlat";
+    public static final String CMD_SWITCH_SCHEMA_PRESENTATION_TO_HIERARCHICAL = Activator.PLUGIN_ID + ".commands.switchSchemaPresentationToHierarchical";
 
     // Preferences - DifferencesWidget
     /** The preferences ID for DifferencesWidget Grouping */
@@ -160,6 +162,12 @@
     public static final int PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE = 1;
 
     // Preferences - SchemaView
+    /** The preference ID for Schema View Schema Presentation */
+    public static final String PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION = SchemaViewPreferencePage.ID + ".schemaPresentation"; //$NON-NLS-1$
+    /** The preference value for Schema View Schema Presentation 'Flat' */
+    public static final int PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT = 0;
+    /** The preference value for Schema View Schema Presentation 'Hierarchical' */
+    public static final int PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL = 1;
     /** The preference ID for Schema View Label */
     public static final String PREFS_SCHEMA_VIEW_LABEL = SchemaViewPreferencePage.ID + ".label.labelValue"; //$NON-NLS-1$
     /** The preference value for Schema View First Name label */
@@ -185,6 +193,8 @@
     /** The preference ID for Schema View Abbreviate Secondary Label Max Length*/
     public static final String PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH = SchemaViewPreferencePage.ID
         + ".secondaryLabel.abbreviate.maxLength"; //$NON-NLS-1$
+    public static final String PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY = SchemaViewPreferencePage.ID
+    + ".schemaLabel.display"; //$NON-NLS-1$
     /** The preference ID for Schema View Grouping */
     public static final String PREFS_SCHEMA_VIEW_GROUPING = Activator.PLUGIN_ID + ".preferences.SchemaView.grouping"; //$NON-NLS-1$
     /** The preference value for Schema View Grouping 'group ATs and OCs in folders' */

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java Fri Sep 21 09:14:46 2007
@@ -44,6 +44,8 @@
             PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY );
 
         // SchemaView Preference Page
+        store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION,
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT );
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_LABEL, PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES );
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE, true );
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
@@ -52,6 +54,7 @@
             PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID );
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE, false );
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+        store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY, false );
 
         // SchemaView Sorting
         store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING,

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java Fri Sep 21 09:14:46 2007
@@ -41,6 +41,8 @@
 import org.apache.directory.studio.schemaeditor.controller.actions.OpenSchemaViewPreferenceAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.OpenSchemaViewSortingDialogAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.OpenTypeHierarchyAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.SwitchSchemaPresentationToFlatAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.SwitchSchemaPresentationToHierarchicalAction;
 import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
 import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
 import org.apache.directory.studio.schemaeditor.model.Project;
@@ -51,6 +53,7 @@
 import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
 import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
 import org.apache.directory.studio.schemaeditor.view.views.SchemaView;
+import org.apache.directory.studio.schemaeditor.view.views.SchemaViewContentProvider;
 import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
@@ -63,6 +66,7 @@
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -110,43 +114,55 @@
          */
         public void attributeTypeAdded( AttributeTypeImpl at )
         {
-            TreeNode schemaWrapper = findSchemaWrapperInTree( at.getSchema() );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( schemaWrapper != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                AttributeTypeWrapper atw = null;
-                int group = Activator.getDefault().getPreferenceStore().getInt(
-                    PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
-                if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                TreeNode schemaWrapper = findSchemaWrapperInTree( at.getSchema() );
+
+                if ( schemaWrapper != null )
                 {
-                    List<TreeNode> children = schemaWrapper.getChildren();
-                    for ( TreeNode child : children )
+                    AttributeTypeWrapper atw = null;
+                    int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
                     {
-                        Folder folder = ( Folder ) child;
-                        if ( folder.getType() == FolderType.ATTRIBUTE_TYPE )
+                        List<TreeNode> children = schemaWrapper.getChildren();
+                        for ( TreeNode child : children )
                         {
-                            atw = new AttributeTypeWrapper( at, folder );
-                            folder.addChild( atw );
-                            break;
+                            Folder folder = ( Folder ) child;
+                            if ( folder.getType() == FolderType.ATTRIBUTE_TYPE )
+                            {
+                                atw = new AttributeTypeWrapper( at, folder );
+                                folder.addChild( atw );
+                                break;
+                            }
                         }
                     }
-                }
-                else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
-                {
-                    atw = new AttributeTypeWrapper( at, schemaWrapper );
-                    schemaWrapper.addChild( atw );
-                }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        atw = new AttributeTypeWrapper( at, schemaWrapper );
+                        schemaWrapper.addChild( atw );
+                    }
 
-                viewer.refresh( schemaWrapper );
-                if ( atw != null )
+                    viewer.refresh( schemaWrapper );
+                    if ( atw != null )
+                    {
+                        viewer.setSelection( new StructuredSelection( atw ) );
+                    }
+                }
+                else
                 {
-                    viewer.setSelection( new StructuredSelection( atw ) );
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
                 }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
-                view.reloadViewer();
+                //                addAttributeTypeHierchicalPresentation( at, store, contentProvider );
+                contentProvider.attributeTypeAdded( at );
+                view.refresh();
             }
         }
 
@@ -156,16 +172,28 @@
          */
         public void attributeTypeModified( AttributeTypeImpl at )
         {
-            AttributeTypeWrapper atw = findAttributeTypeWrapperInTree( at );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( atw != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                updateNodeAndParents( atw );
+                AttributeTypeWrapper atw = findAttributeTypeWrapperInTree( at );
+
+                if ( atw != null )
+                {
+                    updateNodeAndParents( atw );
+                }
+                else
+                {
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
+                }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
-                view.reloadViewer();
+                contentProvider.attributeTypeModified( at );
+                view.refresh();
             }
         }
 
@@ -175,17 +203,29 @@
          */
         public void attributeTypeRemoved( AttributeTypeImpl at )
         {
-            AttributeTypeWrapper atw = findAttributeTypeWrapperInTree( at );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( atw != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                atw.getParent().removeChild( atw );
-                viewer.refresh( atw.getParent() );
+                AttributeTypeWrapper atw = findAttributeTypeWrapperInTree( at );
+
+                if ( atw != null )
+                {
+                    atw.getParent().removeChild( atw );
+                    viewer.refresh( atw.getParent() );
+                }
+                else
+                {
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
+                }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
-                view.reloadViewer();
+                contentProvider.attributeTypeRemoved( at );
+                view.refresh();
             }
         }
 
@@ -195,42 +235,53 @@
          */
         public void objectClassAdded( ObjectClassImpl oc )
         {
-            TreeNode schemaWrapper = findSchemaWrapperInTree( oc.getSchema() );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( schemaWrapper != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                ObjectClassWrapper ocw = null;
-                int group = Activator.getDefault().getPreferenceStore().getInt(
-                    PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
-                if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                TreeNode schemaWrapper = findSchemaWrapperInTree( oc.getSchema() );
+
+                if ( schemaWrapper != null )
                 {
-                    List<TreeNode> children = schemaWrapper.getChildren();
-                    for ( TreeNode child : children )
+                    ObjectClassWrapper ocw = null;
+                    int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
                     {
-                        Folder folder = ( Folder ) child;
-                        if ( folder.getType() == FolderType.OBJECT_CLASS )
+                        List<TreeNode> children = schemaWrapper.getChildren();
+                        for ( TreeNode child : children )
                         {
-                            ocw = new ObjectClassWrapper( oc, folder );
-                            folder.addChild( ocw );
-                            break;
+                            Folder folder = ( Folder ) child;
+                            if ( folder.getType() == FolderType.OBJECT_CLASS )
+                            {
+                                ocw = new ObjectClassWrapper( oc, folder );
+                                folder.addChild( ocw );
+                                break;
+                            }
                         }
                     }
-                }
-                else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
-                {
-                    ocw = new ObjectClassWrapper( oc, schemaWrapper );
-                    schemaWrapper.addChild( ocw );
-                }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        ocw = new ObjectClassWrapper( oc, schemaWrapper );
+                        schemaWrapper.addChild( ocw );
+                    }
 
-                viewer.refresh( schemaWrapper );
-                if ( ocw != null )
+                    viewer.refresh( schemaWrapper );
+                    if ( ocw != null )
+                    {
+                        viewer.setSelection( new StructuredSelection( ocw ) );
+                    }
+                }
+                else
                 {
-                    viewer.setSelection( new StructuredSelection( ocw ) );
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
                 }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
+                contentProvider.objectClassAdded( oc );
                 view.reloadViewer();
             }
         }
@@ -241,15 +292,27 @@
          */
         public void objectClassModified( ObjectClassImpl oc )
         {
-            ObjectClassWrapper ocw = findObjectClassWrapperInTree( oc );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( ocw != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                updateNodeAndParents( ocw );
+                ObjectClassWrapper ocw = findObjectClassWrapperInTree( oc );
+
+                if ( ocw != null )
+                {
+                    updateNodeAndParents( ocw );
+                }
+                else
+                {
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
+                }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
+                contentProvider.objectClassModified( oc );
                 view.reloadViewer();
             }
         }
@@ -260,16 +323,28 @@
          */
         public void objectClassRemoved( ObjectClassImpl oc )
         {
-            ObjectClassWrapper ocw = findObjectClassWrapperInTree( oc );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider();
 
-            if ( ocw != null )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                ocw.getParent().removeChild( ocw );
-                viewer.refresh( ocw.getParent() );
+                ObjectClassWrapper ocw = findObjectClassWrapperInTree( oc );
+
+                if ( ocw != null )
+                {
+                    ocw.getParent().removeChild( ocw );
+                    viewer.refresh( ocw.getParent() );
+                }
+                else
+                {
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
+                }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
+                contentProvider.objectClassRemoved( oc );
                 view.reloadViewer();
             }
         }
@@ -280,50 +355,62 @@
          */
         public void schemaAdded( Schema schema )
         {
-            final TreeNode rootNode = ( TreeNode ) viewer.getInput();
-            final SchemaWrapper schemaWrapper = new SchemaWrapper( schema, rootNode );
-            rootNode.addChild( schemaWrapper );
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
 
-            int group = Activator.getDefault().getPreferenceStore().getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
-            if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE, schemaWrapper );
-                schemaWrapper.addChild( atFolder );
+                final TreeNode rootNode = ( TreeNode ) viewer.getInput();
+                final SchemaWrapper schemaWrapper = new SchemaWrapper( schema, rootNode );
+                rootNode.addChild( schemaWrapper );
 
-                for ( AttributeTypeImpl attributeType : schema.getAttributeTypes() )
+                int group = Activator.getDefault().getPreferenceStore().getInt(
+                    PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+                if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
                 {
-                    atFolder.addChild( new AttributeTypeWrapper( attributeType, atFolder ) );
-                }
+                    Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE, schemaWrapper );
+                    schemaWrapper.addChild( atFolder );
+
+                    for ( AttributeTypeImpl attributeType : schema.getAttributeTypes() )
+                    {
+                        atFolder.addChild( new AttributeTypeWrapper( attributeType, atFolder ) );
+                    }
 
-                Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper );
-                schemaWrapper.addChild( ocFolder );
+                    Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper );
+                    schemaWrapper.addChild( ocFolder );
 
-                for ( ObjectClassImpl objectClass : schema.getObjectClasses() )
-                {
-                    ocFolder.addChild( new ObjectClassWrapper( objectClass, ocFolder ) );
+                    for ( ObjectClassImpl objectClass : schema.getObjectClasses() )
+                    {
+                        ocFolder.addChild( new ObjectClassWrapper( objectClass, ocFolder ) );
+                    }
                 }
-            }
-            else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
-            {
-                for ( AttributeTypeImpl attributeType : schema.getAttributeTypes() )
+                else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
                 {
-                    schemaWrapper.addChild( new AttributeTypeWrapper( attributeType, schemaWrapper ) );
+                    for ( AttributeTypeImpl attributeType : schema.getAttributeTypes() )
+                    {
+                        schemaWrapper.addChild( new AttributeTypeWrapper( attributeType, schemaWrapper ) );
+                    }
+
+                    for ( ObjectClassImpl objectClass : schema.getObjectClasses() )
+                    {
+                        schemaWrapper.addChild( new ObjectClassWrapper( objectClass, schemaWrapper ) );
+                    }
                 }
 
-                for ( ObjectClassImpl objectClass : schema.getObjectClasses() )
+                Display.getDefault().asyncExec( new Runnable()
                 {
-                    schemaWrapper.addChild( new ObjectClassWrapper( objectClass, schemaWrapper ) );
-                }
+                    public void run()
+                    {
+                        viewer.refresh( rootNode );
+                        viewer.setSelection( new StructuredSelection( schemaWrapper ) );
+                    }
+                } );
             }
-
-            Display.getDefault().asyncExec( new Runnable()
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                public void run()
-                {
-                    viewer.refresh( rootNode );
-                    viewer.setSelection( new StructuredSelection( schemaWrapper ) );
-                }
-            } );
+                // TODO Change this
+                view.reloadViewer();
+            }
         }
 
 
@@ -332,15 +419,26 @@
          */
         public void schemaRemoved( Schema schema )
         {
-            TreeNode schemaWrapper = findSchemaWrapperInTree( schema.getName() );
-            if ( schemaWrapper != null )
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+            int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
             {
-                schemaWrapper.getParent().removeChild( schemaWrapper );
-                viewer.refresh( viewer.getInput() );
+                TreeNode schemaWrapper = findSchemaWrapperInTree( schema.getName() );
+                if ( schemaWrapper != null )
+                {
+                    schemaWrapper.getParent().removeChild( schemaWrapper );
+                    viewer.refresh( viewer.getInput() );
+                }
+                else
+                {
+                    // An error has occurred we need to reload the view.
+                    view.reloadViewer();
+                }
             }
-            else
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
             {
-                // An error has occurred we need to reload the view.
+                // TODO Change this
                 view.reloadViewer();
             }
         }
@@ -363,6 +461,8 @@
     private ExportSchemasForADSAction exportSchemasForADS;
     private CollapseAllAction collapseAll;
     private OpenSchemaViewSortingDialogAction openSchemaViewSortingDialog;
+    private SwitchSchemaPresentationToFlatAction switchSchemaPresentationToFlat;
+    private SwitchSchemaPresentationToHierarchicalAction switchSchemaPresentationToHierarchical;
     private OpenSchemaViewPreferenceAction openSchemaViewPreference;
     private LinkWithEditorSchemaViewAction linkWithEditor;
 
@@ -411,6 +511,8 @@
         exportSchemasForADS = new ExportSchemasForADSAction( viewer );
         collapseAll = new CollapseAllAction( viewer );
         openSchemaViewSortingDialog = new OpenSchemaViewSortingDialogAction();
+        switchSchemaPresentationToFlat = new SwitchSchemaPresentationToFlatAction();
+        switchSchemaPresentationToHierarchical = new SwitchSchemaPresentationToHierarchicalAction();
         openSchemaViewPreference = new OpenSchemaViewPreferenceAction();
         linkWithEditor = new LinkWithEditorSchemaViewAction( view );
         //        commitChanges = new CommitChangesAction();
@@ -442,6 +544,11 @@
         IMenuManager menu = view.getViewSite().getActionBars().getMenuManager();
         menu.add( openSchemaViewSortingDialog );
         menu.add( new Separator() );
+        IMenuManager schemaPresentationMenu = new MenuManager( "S&chema Presentation" );
+        schemaPresentationMenu.add( switchSchemaPresentationToFlat );
+        schemaPresentationMenu.add( switchSchemaPresentationToHierarchical );
+        menu.add( schemaPresentationMenu );
+        menu.add( new Separator() );
         menu.add( linkWithEditor );
         menu.add( new Separator() );
         menu.add( openSchemaViewPreference );
@@ -516,6 +623,8 @@
                     collapseAll.setEnabled( true );
                     linkWithEditor.setEnabled( true );
                     openSchemaViewSortingDialog.setEnabled( true );
+                    switchSchemaPresentationToFlat.setEnabled( true );
+                    switchSchemaPresentationToHierarchical.setEnabled( true );
                     openSchemaViewPreference.setEnabled( true );
                     //                    commitChanges.setEnabled( true );
 
@@ -532,6 +641,8 @@
                     collapseAll.setEnabled( false );
                     linkWithEditor.setEnabled( false );
                     openSchemaViewSortingDialog.setEnabled( false );
+                    switchSchemaPresentationToFlat.setEnabled( false );
+                    switchSchemaPresentationToHierarchical.setEnabled( false );
                     openSchemaViewPreference.setEnabled( false );
                     //                    commitChanges.setEnabled( false );
                 }
@@ -645,6 +756,8 @@
         authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
         authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY );
         authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY );
     }
 
 
@@ -662,7 +775,8 @@
             {
                 if ( authorizedPrefs.contains( event.getProperty() ) )
                 {
-                    if ( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING == event.getProperty() )
+                    if ( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING == event.getProperty()
+                        || PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION == event.getProperty() )
                     {
                         view.reloadViewer();
                     }
@@ -844,6 +958,8 @@
             collapseAll.setEnabled( true );
             linkWithEditor.setEnabled( true );
             openSchemaViewSortingDialog.setEnabled( true );
+            switchSchemaPresentationToFlat.setEnabled( true );
+            switchSchemaPresentationToHierarchical.setEnabled( true );
             openSchemaViewPreference.setEnabled( true );
             //            commitChanges.setEnabled( true );
 
@@ -859,6 +975,8 @@
             collapseAll.setEnabled( false );
             linkWithEditor.setEnabled( false );
             openSchemaViewSortingDialog.setEnabled( false );
+            switchSchemaPresentationToFlat.setEnabled( false );
+            switchSchemaPresentationToHierarchical.setEnabled( false );
             openSchemaViewPreference.setEnabled( false );
             //            commitChanges.setEnabled( false );
         }

Added: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToFlatAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToFlatAction.java?rev=578192&view=auto
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToFlatAction.java (added)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToFlatAction.java Fri Sep 21 09:14:46 2007
@@ -0,0 +1,102 @@
+/*
+ *  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.studio.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This action launches the SwitchSchemaPresentationToFlatAction.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SwitchSchemaPresentationToFlatAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of SwitchSchemaPresentationToFlatAction.
+     */
+    public SwitchSchemaPresentationToFlatAction()
+    {
+        super( "&Flat", AS_RADIO_BUTTON );
+        setToolTipText( "Flat" );
+        setId( PluginConstants.CMD_SWITCH_SCHEMA_PRESENTATION_TO_FLAT );
+        setEnabled( false );
+
+        // Setting up the state of the action
+        if ( Activator.getDefault().getPreferenceStore().getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ) == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
+        {
+            setChecked( true );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        Activator.getDefault().getPreferenceStore().setValue( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION,
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Added: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToHierarchicalAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToHierarchicalAction.java?rev=578192&view=auto
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToHierarchicalAction.java (added)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/SwitchSchemaPresentationToHierarchicalAction.java Fri Sep 21 09:14:46 2007
@@ -0,0 +1,102 @@
+/*
+ *  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.studio.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This action launches the SwitchSchemaPresentationToHierarchicalAction.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SwitchSchemaPresentationToHierarchicalAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of SwitchSchemaPresentationToHierarchicalAction.
+     */
+    public SwitchSchemaPresentationToHierarchicalAction()
+    {
+        super( "&Hierarchical", AS_RADIO_BUTTON );
+        setToolTipText( "Hierarchical" );
+        setId( PluginConstants.CMD_SWITCH_SCHEMA_PRESENTATION_TO_HIERARCHICAL );
+        setEnabled( false );
+
+        // Setting up the state of the action
+        if ( Activator.getDefault().getPreferenceStore().getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ) == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL )
+        {
+            setChecked( true );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        Activator.getDefault().getPreferenceStore().setValue( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION,
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Added: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java?rev=578192&view=auto
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java (added)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyManager.java Fri Sep 21 09:14:46 2007
@@ -0,0 +1,324 @@
+/*
+ *  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.studio.schemaeditor.model.hierarchy;
+
+
+import java.util.List;
+
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+
+
+/**
+ * This class represents the HierarchyManager.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyManager
+{
+    /** The parents map is used to store for each element its parents */
+    private MultiValueMap parentsMap;
+
+    /** The parents map is used to store for each element its children */
+    private MultiValueMap childrenMap;
+
+    /** The SchemaHandler */
+    private SchemaHandler schemaHandler;
+
+    private RootObject root;
+
+
+    /**
+     * Creates a new instance of HierarchyManager.
+     */
+    public HierarchyManager()
+    {
+        // Initializing the maps
+        parentsMap = new MultiValueMap();
+        childrenMap = new MultiValueMap();
+
+        schemaHandler = Activator.getDefault().getSchemaHandler();
+
+        loadSchema();
+    }
+
+
+    /**
+     * Loads the Schema.
+     */
+    private void loadSchema()
+    {
+        if ( schemaHandler != null )
+        {
+            // Creating the root element
+            root = new RootObject();
+
+            // Looping on the schemas
+            for ( Schema schema : schemaHandler.getSchemas() )
+            {
+                // Looping on the attribute types
+                for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+                {
+                    addAttributeType( at );
+                }
+
+                // Looping on the object classes
+                for ( ObjectClassImpl oc : schema.getObjectClasses() )
+                {
+                    addObjectClass( oc );
+                }
+            }
+        }
+    }
+
+
+    private void addAttributeType( AttributeTypeImpl at )
+    {
+        checkAliasesAndOID( at );
+
+        String superiorName = at.getSuperiorName();
+        if ( superiorName != null )
+        {
+            AttributeTypeImpl superior = schemaHandler.getAttributeType( superiorName );
+            if ( superior == null )
+            {
+                parentsMap.put( at, superiorName.toLowerCase() );
+                childrenMap.put( superiorName.toLowerCase(), at );
+                childrenMap.put( root, at );
+            }
+            else
+            {
+                parentsMap.put( at, superior );
+                childrenMap.put( superior, at );
+            }
+        }
+        else
+        {
+            parentsMap.put( at, root );
+            childrenMap.put( root, at );
+        }
+    }
+
+
+    private void addObjectClass( ObjectClassImpl oc )
+    {
+        checkAliasesAndOID( oc );
+
+        String[] superClasseNames = oc.getSuperClassesNames();
+        if ( ( superClasseNames != null ) && ( superClasseNames.length > 0 ) )
+        {
+            for ( String superClassName : superClasseNames )
+            {
+                ObjectClassImpl superClass = schemaHandler.getObjectClass( superClassName );
+                if ( superClass == null )
+                {
+                    parentsMap.put( oc, superClassName.toLowerCase() );
+                    childrenMap.put( superClassName.toLowerCase(), oc );
+                    childrenMap.put( root, oc );
+                }
+                else
+                {
+                    parentsMap.put( oc, superClass );
+                    childrenMap.put( superClass, oc );
+                }
+            }
+        }
+        else
+        {
+            ObjectClassImpl topOC = schemaHandler.getObjectClass( "2.5.6.0" );
+
+            if ( oc.equals( topOC ) )
+            {
+                parentsMap.put( oc, root );
+                childrenMap.put( root, oc );
+            }
+            else
+            {
+                if ( topOC != null )
+                {
+                    parentsMap.put( oc, topOC );
+                    childrenMap.put( topOC, oc );
+                }
+                else
+                {
+                    parentsMap.put( oc, "2.5.6.0" );
+                    childrenMap.put( "2.5.6.0", oc );
+                }
+            }
+        }
+    }
+
+
+    private void checkAliasesAndOID( SchemaObject object )
+    {
+        // Aliases
+        String[] aliases = object.getNames();
+        if ( aliases != null )
+        {
+            for ( String alias : aliases )
+            {
+                @SuppressWarnings("unchecked")
+                List<Object> children = ( List<Object> ) childrenMap.get( alias.toLowerCase() );
+                if ( children != null )
+                {
+                    for ( Object value : children )
+                    {
+                        childrenMap.put( object, value );
+                        parentsMap.remove( value, alias.toLowerCase() );
+                        parentsMap.put( value, object );
+                    }
+                    childrenMap.remove( alias.toLowerCase() );
+                }
+            }
+        }
+
+        // OID
+        String oid = object.getOid();
+        if ( oid != null )
+        {
+            @SuppressWarnings("unchecked")
+            List<Object> children = ( List<Object> ) childrenMap.get( oid.toLowerCase() );
+            if ( children != null )
+            {
+                for ( Object value : children )
+                {
+                    childrenMap.remove( oid.toLowerCase(), value );
+                    childrenMap.put( object, value );
+                    parentsMap.remove( value, object );
+                    parentsMap.put( value, object );
+                }
+            }
+        }
+    }
+
+
+    public RootObject getRootObject()
+    {
+        return root;
+    }
+
+
+    @SuppressWarnings("unchecked")
+    public List<Object> getChildren( Object o )
+    {
+        return ( List<Object> ) childrenMap.get( o );
+    }
+
+
+    @SuppressWarnings("unchecked")
+    public List<Object> getParents( Object o )
+    {
+        return ( List<Object> ) parentsMap.get( o );
+    }
+
+
+    public void attributeTypeAdded( AttributeTypeImpl at )
+    {
+        addAttributeType( at );
+    }
+
+
+    public void attributeTypeModified( AttributeTypeImpl at )
+    {
+    }
+
+
+    public void attributeTypeRemoved( AttributeTypeImpl at )
+    {
+        removeAttributeType( at );
+    }
+
+
+    private void removeAttributeType( AttributeTypeImpl at )
+    {
+        String superiorName = at.getSuperiorName();
+        if ( ( superiorName != null ) && ( !"".equals( superiorName ) ) )
+        {
+            AttributeTypeImpl superiorAT = schemaHandler.getAttributeType( superiorName );
+            if ( superiorAT == null )
+            {
+                childrenMap.remove( superiorName.toLowerCase(), at );
+            }
+            else
+            {
+                childrenMap.remove( superiorAT, at );
+            }
+        }
+        else
+        {
+            childrenMap.remove( root, at );
+        }
+
+        List<Object> children = getChildren( at );
+        if ( children != null )
+        {
+            for ( Object child : children )
+            {
+                AttributeTypeImpl childAT = ( AttributeTypeImpl ) child;
+
+                parentsMap.remove( child, at );
+
+                parentsMap.put( child, root );
+                childrenMap.put( root, child );
+                String childSuperiorName = childAT.getSuperiorName();
+                if ( ( childSuperiorName != null ) && ( !"".equals( childSuperiorName ) ) )
+                {
+                    parentsMap.put( child, childSuperiorName.toLowerCase() );
+                    childrenMap.put( childSuperiorName.toLowerCase(), child );
+                }
+            }
+
+            childrenMap.remove( at );
+            parentsMap.remove( at );
+        }
+    }
+
+
+    public void objectClassAdded( ObjectClassImpl oc )
+    {
+    }
+
+
+    public void objectClassModified( ObjectClassImpl oc )
+    {
+    }
+
+
+    public void objectClassRemoved( ObjectClassImpl oc )
+    {
+    }
+
+
+    public void schemaAdded( Schema schema )
+    {
+    }
+
+
+    public void schemaRemoved( Schema schema )
+    {
+    }
+
+}

Added: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyWrapper.java?rev=578192&view=auto
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyWrapper.java (added)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/HierarchyWrapper.java Fri Sep 21 09:14:46 2007
@@ -0,0 +1,231 @@
+/*
+ *  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.studio.schemaeditor.model.hierarchy;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * This class represents the HierarchyWrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyWrapper
+{
+    /** The wrapped object */
+    private Object wrappedObject;
+
+    /** The parent */
+    private Object parent;
+
+    /** The children */
+    private List<HierarchyWrapper> children = new ArrayList<HierarchyWrapper>();
+
+
+    /**
+     * Creates a new instance of HierarchyWrapper.
+     *
+     * @param obj
+     *      the wrapped object
+     */
+    public HierarchyWrapper( Object obj )
+    {
+        wrappedObject = obj;
+        parent = null;
+    }
+
+
+    /**
+     * Creates a new instance of HierarchyWrapper.
+     *
+     * @param obj
+     *      the wrapped object
+     * @param parent
+     *      the parent
+     */
+    public HierarchyWrapper( Object obj, Object parent )
+    {
+        wrappedObject = obj;
+        this.parent = parent;
+    }
+
+
+    /**
+     * Adds a child.
+     *
+     * @param child
+     *      the child
+     * @return
+     *      true (as per the general contract of the Collection.add method).
+     */
+    public boolean addChild( HierarchyWrapper child )
+    {
+        return children.add( child );
+    }
+
+
+    /**
+     * Appends all of the elements in the specified collection to the end 
+     * of the children, in the order that they are returned by the specified 
+     * collection's iterator (optional operation). 
+     *
+     * @param collection
+     *      the collection
+     * @return
+     *      true if the children changed as a result of the call.
+     */
+    public boolean addChildren( Collection<? extends HierarchyWrapper> children )
+    {
+        return this.children.addAll( children );
+    }
+
+
+    /**
+     * Indicates whether some other object is "equal to" this wrapped object.
+     *
+     * @param o
+     *      the reference object with which to compare.
+     * @return
+     *      true if this object is the same as the obj argument; false otherwise.
+     */
+    public boolean equalsWrappedObject( Object obj )
+    {
+        if ( obj != null )
+        {
+            return obj.equals( wrappedObject );
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Gets the children.
+     *
+     * @return
+     *      the children
+     */
+    public List<HierarchyWrapper> getChildren()
+    {
+        return children;
+    }
+
+
+    /**
+     * Gets the parent.
+     *
+     * @return
+     *      the parent
+     */
+    public Object getParent()
+    {
+        return parent;
+    }
+
+
+    /**
+     * Gets the wrapped object.
+     *
+     * @return
+     *      the wrapped object
+     */
+    public Object getWrappedObject()
+    {
+        return wrappedObject;
+    }
+
+
+    /**
+     * Removes a child.
+     *
+     * @param child
+     *      the child
+     * @return
+     *      true if the children contained the specified element.
+     */
+    public boolean removeChild( HierarchyWrapper child )
+    {
+        return children.remove( child );
+    }
+
+
+    /**
+     * Removes from the children all the elements that are contained in 
+     * the specified collection (optional operation).
+     *
+     * @param collection
+     *      the collection
+     * @return
+     *      true if the children changed as a result of the call.
+     */
+    public boolean removeChildren( Collection<? extends HierarchyWrapper> children )
+    {
+        return this.children.removeAll( children );
+    }
+
+
+    /**
+     * Sets the children.
+     *
+     * @param children
+     *      the children
+     */
+    public void setChildren( List<HierarchyWrapper> children )
+    {
+        this.children = children;
+    }
+
+
+    /**
+     * Sets the parent.
+     *
+     * @param parent
+     *      the parent
+     */
+    public void setParent( Object parent )
+    {
+        this.parent = parent;
+    }
+
+
+    /**
+     * Sets the wrapped object.
+     *
+     * @param wrappedObject
+     *      the wrapped object
+     */
+    public void setWrappedObject( Object wrappedObject )
+    {
+        this.wrappedObject = wrappedObject;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "{|" + wrappedObject + "|" + children + "}";
+    }
+}

Added: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/RootObject.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/RootObject.java?rev=578192&view=auto
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/RootObject.java (added)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/hierarchy/RootObject.java Fri Sep 21 09:14:46 2007
@@ -0,0 +1,7 @@
+package org.apache.directory.studio.schemaeditor.model.hierarchy;
+
+
+    class RootObject
+    {
+
+    }
\ No newline at end of file

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/SchemaEditorSchemaCheckerLabelDecorator.java Fri Sep 21 09:14:46 2007
@@ -125,45 +125,47 @@
         }
         else if ( element instanceof Folder )
         {
-            Folder folder = ( Folder ) element;
-            Schema schema = ( ( SchemaWrapper ) folder.getParent() ).getSchema();
-
-            if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE ) )
-            {
-                for ( AttributeTypeImpl at : schema.getAttributeTypes() )
-                {
-                    if ( schemaChecker.hasErrors( at ) )
-                    {
-                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                            PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
-                        return;
-                    }
-
-                    if ( schemaChecker.hasWarnings( at ) )
-                    {
-                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                            PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
-                    }
-                }
-            }
-            else if ( folder.getType().equals( FolderType.OBJECT_CLASS ) )
-            {
-                for ( ObjectClassImpl oc : schema.getObjectClasses() )
-                {
-                    if ( schemaChecker.hasErrors( oc ) )
-                    {
-                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                            PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
-                        return;
-                    }
-
-                    if ( schemaChecker.hasWarnings( oc ) )
-                    {
-                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                            PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
-                    }
-                }
-            }
+            //TODO Add a workaround
+//            Folder folder = ( Folder ) element;
+//            
+//            Schema schema = ( ( SchemaWrapper ) folder.getParent() ).getSchema();
+//
+//            if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE ) )
+//            {
+//                for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+//                {
+//                    if ( schemaChecker.hasErrors( at ) )
+//                    {
+//                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+//                            PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
+//                        return;
+//                    }
+//
+//                    if ( schemaChecker.hasWarnings( at ) )
+//                    {
+//                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+//                            PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
+//                    }
+//                }
+//            }
+//            else if ( folder.getType().equals( FolderType.OBJECT_CLASS ) )
+//            {
+//                for ( ObjectClassImpl oc : schema.getObjectClasses() )
+//                {
+//                    if ( schemaChecker.hasErrors( oc ) )
+//                    {
+//                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+//                            PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
+//                        return;
+//                    }
+//
+//                    if ( schemaChecker.hasWarnings( oc ) )
+//                    {
+//                        decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+//                            PluginConstants.IMG_OVERLAY_WARNING ), IDecoration.BOTTOM_LEFT );
+//                    }
+//                }
+//            }
         }
     }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SchemaViewPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SchemaViewPreferencePage.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SchemaViewPreferencePage.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SchemaViewPreferencePage.java Fri Sep 21 09:14:46 2007
@@ -70,6 +70,7 @@
     private Combo secondaryLabelCombo;
     private Button secondaryLabelLimitButton;
     private Text secondaryLabelLengthText;
+    private Button schemaLabelButtonDisplay;
 
 
     /**
@@ -245,6 +246,20 @@
             }
         } );
 
+        // Schema Label Group
+        Group schemaLabelGroup = new Group( composite, SWT.NONE );
+        schemaLabelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        schemaLabelGroup.setText( "Schema label" );
+        schemaLabelGroup.setLayout( new GridLayout() );
+        Composite schemaLabelGroupComposite = new Composite( schemaLabelGroup, SWT.NONE );
+        gl = new GridLayout( 1, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        schemaLabelGroupComposite.setLayout( gl );
+        schemaLabelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        schemaLabelButtonDisplay = new Button( schemaLabelGroupComposite, SWT.CHECK );
+        schemaLabelButtonDisplay.setText( "Display schema name in label." );
+
         // Characters Label
         Label secondaryLabelcharactersLabel = new Label( abbreviateComposite2, SWT.NONE );
         secondaryLabelcharactersLabel.setText( "characters." );
@@ -290,6 +305,9 @@
             secondaryLabelLimitButton.setEnabled( false );
             secondaryLabelLengthText.setEnabled( false );
         }
+
+        schemaLabelButtonDisplay.setSelection( store
+            .getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY ) );
     }
 
 
@@ -368,6 +386,9 @@
             secondaryLabelLengthText.setEnabled( false );
         }
 
+        schemaLabelButtonDisplay.setSelection( store
+            .getDefaultBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY ) );
+
         super.performDefaults();
     }
 
@@ -417,6 +438,9 @@
             .getSelection() );
         store.setValue( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH,
             secondaryLabelLengthText.getText() );
+
+        store
+            .setValue( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY, schemaLabelButtonDisplay.getSelection() );
 
         return true;
     }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/HierarchyViewLabelProvider.java Fri Sep 21 09:14:46 2007
@@ -259,7 +259,7 @@
                 secondaryLabel = secondaryLabel.substring( 0, secondaryLabelAbbreviateMaxLength ) + "..."; //$NON-NLS-1$
             }
 
-            label += "   [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+            label += "  [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
         }
 
         return label;



Mime
View raw message