directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r578192 [2/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
Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java
Fri Sep 21 09:14:46 2007
@@ -24,12 +24,14 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.commons.collections.map.MultiValueMap;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
 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;
+import org.apache.directory.studio.schemaeditor.model.hierarchy.HierarchyManager;
 import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.FirstNameSorter;
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
@@ -66,6 +68,14 @@
     /** The Schema Sorter */
     private SchemaSorter schemaSorter;
 
+    /** The RootWrapper */
+    private SchemaViewRoot root;
+
+    /** The 'Elements To Wrappers' Map */
+    private MultiValueMap elementsToWrappersMap;
+
+    private HierarchyManager hierarchyManager;
+
 
     /**
      * Creates a new instance of DifferencesWidgetSchemaContentProvider.
@@ -77,6 +87,8 @@
         firstNameSorter = new FirstNameSorter();
         oidSorter = new OidSorter();
         schemaSorter = new SchemaSorter();
+
+        elementsToWrappersMap = new MultiValueMap();
     }
 
 
@@ -114,66 +126,162 @@
     {
         List<TreeNode> children = new ArrayList<TreeNode>();
 
+        int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION
);
         int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
         int sortBy = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY );
         int sortOrder = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER );
 
         if ( parentElement instanceof SchemaViewRoot )
         {
-            SchemaViewRoot root = ( SchemaViewRoot ) parentElement;
+            root = ( SchemaViewRoot ) parentElement;
 
-            if ( root.getChildren().isEmpty() )
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT
)
             {
-                SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
-                if ( schemaHandler != null )
+                if ( root.getChildren().isEmpty() )
                 {
-                    List<Schema> schemas = schemaHandler.getSchemas();
-                    for ( Schema schema : schemas )
+                    SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
+                    if ( schemaHandler != null )
                     {
-                        SchemaWrapper schemaWrapper = new SchemaWrapper( schema, root );
-                        root.addChild( schemaWrapper );
-
-                        if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS
)
+                        List<Schema> schemas = schemaHandler.getSchemas();
+                        for ( Schema schema : schemas )
                         {
-                            Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE, schemaWrapper
);
-                            schemaWrapper.addChild( atFolder );
+                            SchemaWrapper schemaWrapper = new SchemaWrapper( schema, root
);
+                            root.addChild( schemaWrapper );
 
-                            for ( AttributeTypeImpl attributeType : schema.getAttributeTypes()
)
+                            if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS
)
                             {
-                                atFolder.addChild( new AttributeTypeWrapper( attributeType,
atFolder ) );
-                            }
-
-                            Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper
);
-                            schemaWrapper.addChild( ocFolder );
+                                Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE,
schemaWrapper );
+                                schemaWrapper.addChild( atFolder );
 
-                            for ( ObjectClassImpl objectClass : schema.getObjectClasses()
)
+                                for ( AttributeTypeImpl attributeType : schema.getAttributeTypes()
)
+                                {
+                                    atFolder.addChild( new AttributeTypeWrapper( attributeType,
atFolder ) );
+                                }
+
+                                Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper
);
+                                schemaWrapper.addChild( ocFolder );
+
+                                for ( ObjectClassImpl objectClass : schema.getObjectClasses()
)
+                                {
+                                    ocFolder.addChild( new ObjectClassWrapper( objectClass,
ocFolder ) );
+                                }
+                            }
+                            else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED
)
                             {
-                                ocFolder.addChild( new ObjectClassWrapper( objectClass, ocFolder
) );
+                                for ( AttributeTypeImpl attributeType : schema.getAttributeTypes()
)
+                                {
+                                    schemaWrapper.addChild( new AttributeTypeWrapper( attributeType,
schemaWrapper ) );
+                                }
+
+                                for ( ObjectClassImpl objectClass : schema.getObjectClasses()
)
+                                {
+                                    schemaWrapper.addChild( new ObjectClassWrapper( objectClass,
schemaWrapper ) );
+                                }
                             }
                         }
-                        else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED
)
+                    }
+                }
+
+                children = root.getChildren();
+
+                Collections.sort( children, schemaSorter );
+            }
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL
)
+            {
+                if ( root.getChildren().isEmpty() )
+                {
+                    hierarchyManager = new HierarchyManager();
+
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                    {
+                        Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE, root );
+                        Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, root );
+                        root.addChild( atFolder );
+                        root.addChild( ocFolder );
+
+                        List<Object> rootChildren = hierarchyManager.getChildren( hierarchyManager.getRootObject()
);
+                        if ( ( rootChildren != null ) && ( rootChildren.size() >
0 ) )
                         {
-                            for ( AttributeTypeImpl attributeType : schema.getAttributeTypes()
)
+                            for ( Object rootChild : rootChildren )
                             {
-                                schemaWrapper.addChild( new AttributeTypeWrapper( attributeType,
schemaWrapper ) );
-                            }
+                                TreeNode childNode = null;
 
-                            for ( ObjectClassImpl objectClass : schema.getObjectClasses()
)
-                            {
-                                schemaWrapper.addChild( new ObjectClassWrapper( objectClass,
schemaWrapper ) );
+                                // Creating the wrapper
+                                if ( rootChild instanceof AttributeTypeImpl )
+                                {
+                                    AttributeTypeImpl at = ( AttributeTypeImpl ) rootChild;
+                                    childNode = new AttributeTypeWrapper( at, atFolder );
+                                    atFolder.addChild( childNode );
+                                }
+                                else if ( rootChild instanceof ObjectClassImpl )
+                                {
+                                    ObjectClassImpl oc = ( ObjectClassImpl ) rootChild;
+                                    childNode = new ObjectClassWrapper( oc, ocFolder );
+                                    ocFolder.addChild( childNode );
+                                }
+
+                                // Filling the 'Elements To Wrappers' Map
+                                elementsToWrappersMap.put( rootChild, childNode );
+
+                                // Recursively creating the hierarchy for all children
+                                // of the root element.
+                                addHierarchyChildren( childNode, hierarchyManager.getChildren(
rootChild ) );
                             }
                         }
                     }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        addHierarchyChildren( root, hierarchyManager.getChildren( hierarchyManager.getRootObject()
) );
+                    }
+                }
+
+                children = root.getChildren();
+
+                if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                {
+                    // Sort by
+                    if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME
)
+                    {
+                        Collections.sort( children, firstNameSorter );
+                    }
+                    else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID
)
+                    {
+                        Collections.sort( children, oidSorter );
+                    }
+
+                    // Sort Order
+                    if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING
)
+                    {
+                        Collections.reverse( children );
+                    }
                 }
             }
 
-            children = root.getChildren();
+        }
+        else if ( parentElement instanceof Folder )
+        {
+            children = ( ( TreeNode ) parentElement ).getChildren();
 
-            Collections.sort( children, schemaSorter );
+            // Sort by
+            if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME )
+            {
+                Collections.sort( children, firstNameSorter );
+            }
+            else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID )
+            {
+                Collections.sort( children, oidSorter );
+            }
+
+            // Sort Order
+            if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING
)
+            {
+                Collections.reverse( children );
+            }
         }
-        else if ( parentElement instanceof SchemaWrapper )
+        else if ( ( parentElement instanceof AttributeTypeWrapper ) || ( parentElement instanceof
ObjectClassWrapper )
+            || ( parentElement instanceof SchemaWrapper ) )
         {
-            children = ( ( SchemaWrapper ) parentElement ).getChildren();
+            children = ( ( TreeNode ) parentElement ).getChildren();
 
             if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
             {
@@ -194,28 +302,47 @@
                 }
             }
         }
-        else if ( parentElement instanceof Folder )
-        {
-            children = ( ( Folder ) parentElement ).getChildren();
 
-            // Sort by
-            if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME )
-            {
-                Collections.sort( children, firstNameSorter );
-            }
-            else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID )
-            {
-                Collections.sort( children, oidSorter );
-            }
+        return children.toArray();
+    }
 
-            // Sort Order
-            if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING
)
+
+    /**
+     * Converts the given children and adds them to the given node.
+     *
+     * @param node
+     *      the parent node.
+     * @param children
+     *      the children
+     */
+    private void addHierarchyChildren( TreeNode node, List<Object> children )
+    {
+        if ( ( children != null ) && ( children.size() > 0 ) )
+        {
+            for ( Object child : children )
             {
-                Collections.reverse( children );
+                TreeNode childNode = null;
+                if ( child instanceof AttributeTypeImpl )
+                {
+                    AttributeTypeImpl at = ( AttributeTypeImpl ) child;
+                    childNode = new AttributeTypeWrapper( at, node );
+                    node.addChild( childNode );
+                }
+                else if ( child instanceof ObjectClassImpl )
+                {
+                    ObjectClassImpl oc = ( ObjectClassImpl ) child;
+                    childNode = new ObjectClassWrapper( oc, node );
+                    node.addChild( childNode );
+                }
+
+                // Filling the 'Elements To Wrappers' Map
+                elementsToWrappersMap.put( child, childNode );
+
+                // Recursively creating the hierarchy for all children
+                // of the given element.
+                addHierarchyChildren( childNode, hierarchyManager.getChildren( child ) );
             }
         }
-
-        return children.toArray();
     }
 
 
@@ -224,7 +351,6 @@
      */
     public Object getParent( Object element )
     {
-
         if ( element instanceof TreeNode )
         {
             return ( ( TreeNode ) element ).getParent();
@@ -247,5 +373,262 @@
 
         // Default
         return false;
+    }
+
+
+    /**
+     * Gets the wrappers associated with the given object.
+     *
+     * @param o
+     *      the object
+     * @return
+     *      the wrappers associated with the given object
+     */
+    @SuppressWarnings("unchecked")
+    public List<TreeNode> getWrappers( Object o )
+    {
+        return ( List<TreeNode> ) elementsToWrappersMap.get( o );
+    }
+
+
+    /**
+     * Gets the wrapper associated with the given object.
+     *
+     * @param o
+     *      the object
+     * @return
+     *      the wrapper associated with the given object
+     */
+    public TreeNode getWrapper( Object o )
+    {
+        List<TreeNode> wrappers = getWrappers( o );
+        if ( ( wrappers != null ) && ( wrappers.size() > 0 ) )
+        {
+            return wrappers.get( 0 );
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /**
+     * Gets the Root Element.
+     *
+     * @return
+     *      the Root Element
+     */
+    public SchemaViewRoot getRoot()
+    {
+        return root;
+    }
+
+
+    /**
+     * Adds the given <element, wrapper> association.
+     *
+     * @param element
+     *      the element
+     * @param wrapper
+     *      the wrapper
+     */
+    public void addElementToWrapper( Object element, TreeNode wrapper )
+    {
+        elementsToWrappersMap.put( element, wrapper );
+    }
+
+
+    /**
+     * Removes the given <element, wrapper> association.
+     *
+     * @param element
+     *      the element
+     * @param wrapper
+     *      the wrapper
+     */
+    public void removeElementToWrapper( Object element, TreeNode wrapper )
+    {
+        elementsToWrappersMap.remove( element, wrapper );
+    }
+
+
+    /**
+     * Remove all <element, wrapper> association for the given element.
+     *
+     * @param element
+     *      the element
+     */
+    public void removeElementToWrapper( Object element )
+    {
+        elementsToWrappersMap.remove( element );
+    }
+
+
+    public void attributeTypeAdded( AttributeTypeImpl at )
+    {
+        hierarchyManager.attributeTypeAdded( at );
+
+        List<TreeNode> createdWrappers = new ArrayList<TreeNode>();
+
+        List<Object> parents = hierarchyManager.getParents( at );
+
+        if ( parents != null )
+        {
+            for ( Object parent : parents )
+            {
+                AttributeTypeWrapper parentATW = ( AttributeTypeWrapper ) getWrapper( parent
);
+                AttributeTypeWrapper atw = null;
+                if ( parentATW == null )
+                {
+                    int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING
);
+                    if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                    {
+                        for ( TreeNode child : root.getChildren() )
+                        {
+                            if ( child instanceof Folder )
+                            {
+                                Folder folder = ( Folder ) child;
+                                if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE )
)
+                                {
+                                    atw = new AttributeTypeWrapper( at, folder );
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                    {
+                        atw = new AttributeTypeWrapper( at, root );
+                    }
+
+                }
+                else
+                {
+                    atw = new AttributeTypeWrapper( at, parentATW );
+                }
+                atw.getParent().addChild( atw );
+                createdWrappers.add( atw );
+                elementsToWrappersMap.put( at, atw );
+            }
+        }
+
+        List<Object> children = hierarchyManager.getChildren( at );
+        if ( children != null )
+        {
+            for ( Object child : children )
+            {
+                AttributeTypeWrapper childATW = ( AttributeTypeWrapper ) getWrapper( child
);
+                elementsToWrappersMap.remove( child );
+                childATW.getParent().removeChild( childATW );
+
+                for ( TreeNode createdWrapper : createdWrappers )
+                {
+                    AttributeTypeWrapper atw = new AttributeTypeWrapper( ( AttributeTypeImpl
) child, createdWrapper );
+                    atw.getParent().addChild( atw );
+                    elementsToWrappersMap.put( ( AttributeTypeImpl ) child, atw );
+                }
+            }
+        }
+
+    }
+
+
+    public void attributeTypeModified( AttributeTypeImpl at )
+    {
+    }
+
+
+    public void attributeTypeRemoved( AttributeTypeImpl at )
+    {
+        // Creating children nodes of the AT 
+        // and attaching them to the root
+        List<Object> children = hierarchyManager.getChildren( at );
+        if ( children != null )
+        {
+            for ( Object child : children )
+            {
+                AttributeTypeWrapper atw = null;
+                int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+                if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+                {
+                    for ( TreeNode rootChild : root.getChildren() )
+                    {
+                        if ( rootChild instanceof Folder )
+                        {
+                            Folder folder = ( Folder ) rootChild;
+                            if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE ) )
+                            {
+                                atw = new AttributeTypeWrapper( ( AttributeTypeImpl ) child,
folder );
+                                break;
+                            }
+                        }
+                    }
+                }
+                else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+                {
+                    atw = new AttributeTypeWrapper( ( AttributeTypeImpl ) child, root );
+                }
+
+                atw.getParent().addChild( atw );
+                elementsToWrappersMap.put( ( AttributeTypeImpl ) child, atw );
+            }
+        }
+
+        // Propagating the removal to the hierarchy manager
+        hierarchyManager.attributeTypeRemoved( at );
+
+        // Removing the Wrappers
+        List<TreeNode> wrappers = getWrappers( at );
+        if ( wrappers != null )
+        {
+            for ( TreeNode wrapper : wrappers )
+            {
+                wrapper.getParent().removeChild( wrapper );
+                removeRecursiveChildren( wrapper );
+            }
+
+            elementsToWrappersMap.remove( at );
+        }
+    }
+
+
+    private void removeRecursiveChildren( TreeNode wrapper )
+    {
+        for ( TreeNode child : wrapper.getChildren() )
+        {
+            if ( child instanceof AttributeTypeImpl )
+            {
+                elementsToWrappersMap.remove( ( AttributeTypeImpl ) child, child );
+            }
+            else if ( child instanceof ObjectClassImpl )
+            {
+                elementsToWrappersMap.remove( ( ObjectClassImpl ) child, child );
+            }
+        }
+    }
+
+
+    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 )
+    {
     }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewLabelProvider.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewLabelProvider.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewLabelProvider.java
Fri Sep 21 09:14:46 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.studio.schemaeditor.view.views;
 
 
+import java.util.List;
+
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
 import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
@@ -29,6 +31,7 @@
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
@@ -65,6 +68,7 @@
     {
         String label = ""; //$NON-NLS-1$
 
+        int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION
);
         int labelValue = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_LABEL );
         boolean abbreviate = store.getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE
);
         int abbreviateMaxLength = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH
);
@@ -74,6 +78,7 @@
             .getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE );
         int secondaryLabelAbbreviateMaxLength = store
             .getInt( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH
);
+        boolean schemaLabelDisplay = store.getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY
);
 
         if ( element instanceof SchemaWrapper )
         {
@@ -191,7 +196,14 @@
         {
             Folder folder = ( Folder ) element;
 
-            return folder.getName() + " (" + folder.getChildren().size() + ")";
+            if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT
)
+            {
+                return folder.getName() + " (" + folder.getChildren().size() + ")";
+            }
+            else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL
)
+            {
+                return folder.getName();
+            }
         }
 
         // Secondary Label
@@ -270,7 +282,34 @@
                 secondaryLabel = secondaryLabel.substring( 0, secondaryLabelAbbreviateMaxLength
) + "..."; //$NON-NLS-1$
             }
 
-            label += "   [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+            label += "  [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // Number of children
+        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL
)
+        {
+            if ( ( element instanceof AttributeTypeWrapper ) || ( element instanceof ObjectClassWrapper
) )
+            {
+                List<TreeNode> children = ( ( TreeNode ) element ).getChildren();
+
+                if ( ( children != null ) && ( children.size() > 0 ) )
+                {
+                    label += "  (" + children.size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+                }
+            }
+        }
+
+        // Schema Label
+        if ( schemaLabelDisplay )
+        {
+            if ( element instanceof AttributeTypeWrapper )
+            {
+                label += "  [" + ( ( AttributeTypeWrapper ) element ).getAttributeType().getSchema()
+ "]"; //$NON-NLS-1$ //$NON-NLS-2$
+            }
+            else if ( element instanceof ObjectClassWrapper )
+            {
+                label += "  [" + ( ( ObjectClassWrapper ) element ).getObjectClass().getSchema()
+ "]"; //$NON-NLS-1$ //$NON-NLS-2$
+            }
         }
 
         return label;

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
Fri Sep 21 09:14:46 2007
@@ -256,7 +256,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$
         }
 
         // Schema Label
@@ -266,7 +266,7 @@
             {
                 SchemaObject object = ( SchemaObject ) element;
 
-                label += "   from the schema \"" + object.getSchema() + "\""; //$NON-NLS-1$
//$NON-NLS-2$
+                label += " from schema \"" + object.getSchema() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
             }
         }
 

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
Fri Sep 21 09:14:46 2007
@@ -352,7 +352,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;

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
Fri Sep 21 09:14:46 2007
@@ -73,13 +73,4 @@
     {
         return attributeType;
     }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hasChildren()
-     */
-    public boolean hasChildren()
-    {
-        return false;
-    }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
Fri Sep 21 09:14:46 2007
@@ -122,4 +122,35 @@
     {
         return name;
     }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof Folder )
+        {
+            Folder folder = ( Folder ) obj;
+
+            if ( ( getParent() != null ) && ( !getParent().equals( folder.getParent()
) ) )
+            {
+                return false;
+            }
+
+            if ( !getType().equals( folder.getType() ) )
+            {
+                return false;
+            }
+
+            if ( ( getName() != null ) && ( !getName().equals( folder.getName() )
) )
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        return false;
+    }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java?rev=578192&r1=578191&r2=578192&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
Fri Sep 21 09:14:46 2007
@@ -73,13 +73,4 @@
     {
         return objectClass;
     }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hasChildren()
-     */
-    public boolean hasChildren()
-    {
-        return false;
-    }
 }



Mime
View raw message