directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r507112 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ressources/icons/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ src/main/java/...
Date Tue, 13 Feb 2007 17:33:02 GMT
Author: pamarcelot
Date: Tue Feb 13 09:33:00 2007
New Revision: 507112

URL: http://svn.apache.org/viewvc?view=rev&rev=507112
Log:
Fixed DIRSTUDIO-58 (Improve the Hierarchy View).

Added two actions :
   o one that hides all Attribute Types
   o one that hides all Object Classes

Refactored relationship View/Controller.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_attribute_types.png   (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_object_classes.png   (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/IImageKeys.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_attribute_types.png
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_attribute_types.png?view=auto&rev=507112
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_attribute_types.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_object_classes.png
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_object_classes.png?view=auto&rev=507112
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/hide_object_classes.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java Tue Feb 13 09:33:00 2007
@@ -21,15 +21,23 @@
 package org.apache.directory.ldapstudio.schemas.controller;
 
 
+import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.HideAttributeTypesAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.HideObjectClassesAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.LinkWithEditorHierarchyView;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SortHierarchicalViewAction;
 import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchicalViewer;
+import org.apache.directory.ldapstudio.schemas.view.viewers.Messages;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.log4j.Logger;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.StructuredSelection;
@@ -40,86 +48,133 @@
 import org.eclipse.ui.PlatformUI;
 
 
-public class HierarchicalViewerController implements IDoubleClickListener
+/**
+ * This class implements the Controller for the Hierarchy View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchicalViewerController
 {
+    /** The logger */
     private static Logger logger = Logger.getLogger( HierarchicalViewerController.class );
-    private static final HierarchicalViewerController instance_;
 
-    // Static thread-safe singleton initializer
-    static
+    /** The associated view */
+    private HierarchicalViewer view;
+    
+    // The Actions
+    private HideObjectClassesAction hideObjectClasses;
+    private HideAttributeTypesAction hideAttributeTypes;
+    private SortHierarchicalViewAction sortAlphabetical;
+    private SortHierarchicalViewAction sortUnAlphabetical;
+    private CollapseAllAction collapseAll;
+    private LinkWithEditorHierarchyView linkWithEditor;
+
+    /**
+     * Creates a new instance of HierarchicalViewerController.
+     *
+     */
+    public HierarchicalViewerController( HierarchicalViewer view )
     {
-        try
-        {
-            instance_ = new HierarchicalViewerController();
-        }
-        catch ( Throwable e )
-        {
-            throw new RuntimeException( e.getMessage() );
-        }
-    }
+        this.view = view;
 
+        initActions();
+        initToolbar();
 
-    //Prevent direct access to the constructor
-    private HierarchicalViewerController()
-    {
+        initDoubleClickListener();
     }
 
 
     /**
-     * Use this method to get the singleton instance of the controller
-     * @return
+     * Initializes the Actions.
      */
-    public static HierarchicalViewerController getInstance()
+    private void initActions()
     {
-        return instance_;
+        hideObjectClasses = new HideObjectClassesAction( view );
+        hideAttributeTypes = new HideAttributeTypesAction( view );
+        sortAlphabetical = new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortHierarchicalViewAction.SortType.alphabetical, Messages
+                .getString( "HierarchicalViewer.Sort_alphabetically" ) ); //$NON-NLS-1$
+        sortUnAlphabetical = new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortHierarchicalViewAction.SortType.unalphabetical, Messages
+                .getString( "HierarchicalViewer.Sort_unalphabetically" ) ); //$NON-NLS-1$
+        collapseAll = new CollapseAllAction( view.getViewer() );
+        linkWithEditor = new LinkWithEditorHierarchyView( view );
     }
 
 
-    public void doubleClick( DoubleClickEvent event )
+    /**
+     * Initializes the Toolbar.
+     */
+    private void initToolbar()
     {
-        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( hideObjectClasses );
+        toolbar.add( hideAttributeTypes );
+        toolbar.add( new Separator() );
+        toolbar.add( sortAlphabetical );
+        toolbar.add( sortUnAlphabetical );
+        toolbar.add( new Separator() );
+        toolbar.add( collapseAll );
+        toolbar.add( linkWithEditor );
+    }
 
-        HierarchicalViewer view = ( HierarchicalViewer ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-            .getActivePage().findView( HierarchicalViewer.ID );
-        TreeViewer viewer = view.getViewer();
-
-        // What we get from the treeViewer is a StructuredSelection
-        StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-
-        // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
-        Object objectSelection = selection.getFirstElement();
-        IEditorInput input = null;
-        String editorId = null;
 
-        // Selecting the right editor and input
-        if ( objectSelection instanceof AttributeTypeWrapper )
-        {
-            input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection ).getMyAttributeType() );
-            editorId = AttributeTypeFormEditor.ID;
-        }
-        else if ( objectSelection instanceof ObjectClassWrapper )
-        {
-            input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
-            editorId = ObjectClassFormEditor.ID;
-        }
-        else if ( objectSelection instanceof IntermediateNode )
-        {
-            // Here we don't open an editor, we just expand the node.
-            viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
-        }
-
-        // Let's open the editor
-        if ( input != null )
+    /**
+     * Initializes the DoubleClickListener
+     */
+    private void initDoubleClickListener()
+    {
+        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
         {
-            try
-            {
-                page.openEditor( input, editorId );
-            }
-            catch ( PartInitException e )
+            public void doubleClick( DoubleClickEvent event )
             {
-                logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+                HierarchicalViewer view = ( HierarchicalViewer ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                    .getActivePage().findView( HierarchicalViewer.ID );
+                TreeViewer viewer = view.getViewer();
+
+                // What we get from the treeViewer is a StructuredSelection
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+                // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+                Object objectSelection = selection.getFirstElement();
+                IEditorInput input = null;
+                String editorId = null;
+
+                // Selecting the right editor and input
+                if ( objectSelection instanceof AttributeTypeWrapper )
+                {
+                    input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection )
+                        .getMyAttributeType() );
+                    editorId = AttributeTypeFormEditor.ID;
+                }
+                else if ( objectSelection instanceof ObjectClassWrapper )
+                {
+                    input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection )
+                        .getMyObjectClass() );
+                    editorId = ObjectClassFormEditor.ID;
+                }
+                else if ( objectSelection instanceof IntermediateNode )
+                {
+                    // Here we don't open an editor, we just expand the node.
+                    viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
+                }
+
+                // Let's open the editor
+                if ( input != null )
+                {
+                    try
+                    {
+                        page.openEditor( input, editorId );
+                    }
+                    catch ( PartInitException e )
+                    {
+                        logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
             }
-        }
+        } );
     }
-
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java?view=auto&rev=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java Tue Feb 13 09:33:00 2007
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchicalViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Hide Object Classes Action for the Hierarch View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HideAttributeTypesAction extends Action
+{
+    /** The String for storing the checked state of the action */
+    public static final String HIDE_ATTRIBUTE_TYPES_DS_KEY = HideAttributeTypesAction.class.getName()
+        + ".dialogsettingkey";
+
+    /** The associated view */
+    private HierarchicalViewer hierarchyView;
+
+
+    /**
+     * Creates a new instance of HideObjectClassesAction.
+     *
+     * @param view
+     *      the associated view
+     */
+    public HideAttributeTypesAction( HierarchicalViewer view )
+    {
+        super( "Hide Attribute Types", AS_CHECK_BOX );
+        super.setActionDefinitionId( Activator.PLUGIN_ID + "hideAttributeTypes" );
+        super.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+            IImageKeys.HIDE_ATTRIBUTE_TYPES ) );
+        super.setEnabled( true );
+        hierarchyView = view;
+
+        // Setting up the default key value (if needed)
+        if ( Activator.getDefault().getDialogSettings().get( HIDE_ATTRIBUTE_TYPES_DS_KEY ) == null )
+        {
+            Activator.getDefault().getDialogSettings().put( HIDE_ATTRIBUTE_TYPES_DS_KEY, false );
+        }
+
+        // Setting state from the dialog settings
+        super.setChecked( Activator.getDefault().getDialogSettings().getBoolean( HIDE_ATTRIBUTE_TYPES_DS_KEY ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        setChecked( isChecked() );
+        Activator.getDefault().getDialogSettings().put( HIDE_ATTRIBUTE_TYPES_DS_KEY, isChecked() );
+
+        hierarchyView.getViewer().refresh();
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java?view=auto&rev=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java Tue Feb 13 09:33:00 2007
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchicalViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Hide Object Classes Action for the Hierarch View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HideObjectClassesAction extends Action
+{
+    /** The String for storing the checked state of the action */
+    public static final String HIDE_OBJECT_CLASSES_DS_KEY = HideObjectClassesAction.class.getName()
+        + ".dialogsettingkey";
+
+    /** The associated view */
+    private HierarchicalViewer hierarchyView;
+
+
+    /**
+     * Creates a new instance of HideObjectClassesAction.
+     *
+     * @param view
+     *      the associated view
+     */
+    public HideObjectClassesAction( HierarchicalViewer view )
+    {
+        super( "Hide Object Classes", AS_CHECK_BOX );
+        super.setActionDefinitionId( Activator.PLUGIN_ID + "hideObjectClasses" );
+        super.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+            IImageKeys.HIDE_OBJECT_CLASSES ) );
+        super.setEnabled( true );
+        hierarchyView = view;
+
+        // Setting up the default key value (if needed)
+        if ( Activator.getDefault().getDialogSettings().get( HIDE_OBJECT_CLASSES_DS_KEY ) == null )
+        {
+            Activator.getDefault().getDialogSettings().put( HIDE_OBJECT_CLASSES_DS_KEY, false );
+        }
+
+        // Setting state from the dialog settings
+        super.setChecked( Activator.getDefault().getDialogSettings().getBoolean( HIDE_OBJECT_CLASSES_DS_KEY ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        setChecked( isChecked() );
+        Activator.getDefault().getDialogSettings().put( HIDE_OBJECT_CLASSES_DS_KEY, isChecked() );
+        
+        hierarchyView.getViewer().refresh();
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/IImageKeys.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/IImageKeys.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/IImageKeys.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/IImageKeys.java Tue Feb 13 09:33:00 2007
@@ -43,6 +43,8 @@
     public static final String SHOW_PREFERENCES = "ressources/icons/preferences.png"; //$NON-NLS-1$
     public static final String LINK_WITH_EDITOR = "ressources/icons/link_with_editor.gif"; //$NON-NLS-1$
     public static final String COLLAPSE_ALL = "ressources/icons/collapse_all.gif"; //$NON-NLS-1$
+    public static final String HIDE_OBJECT_CLASSES = "ressources/icons/hide_object_classes.png"; //$NON-NLS-1$
+    public static final String HIDE_ATTRIBUTE_TYPES = "ressources/icons/hide_attribute_types.png"; //$NON-NLS-1$
 
     // Images for Views
     public static final String FOLDER_ATTRIBUTE_TYPE = "ressources/icons/folder_at.gif"; //$NON-NLS-1$

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalContentProvider.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalContentProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalContentProvider.java Tue Feb 13 09:33:00 2007
@@ -21,48 +21,67 @@
 package org.apache.directory.ldapstudio.schemas.view.viewers;
 
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
 
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.controller.actions.HideAttributeTypesAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.HideObjectClassesAction;
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AlphabeticalOrderComparator;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode.IntermediateNodeType;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 
 
+/**
+ * This class implements the content provider for the Hierarchy View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class HierarchicalContentProvider implements SortableContentProvider, IStructuredContentProvider,
     ITreeContentProvider
 {
+    /** The Schema Pool holding all schemas */
     private SchemaPool schemaPool;
+
+    /** The HashTable containing all the object classes */
     private Hashtable<String, ObjectClass> objectClassTable;
+
+    /** The HashTable containing all the attribute types */
     private Hashtable<String, AttributeType> attributeTypeTable;
+
+    /** The Order Comparator */
     private Comparator order = new AlphabeticalOrderComparator();
 
 
-    public HierarchicalContentProvider( SchemaPool schemaPool )
+    /**
+     * Creates a new instance of HierarchicalContentProvider.
+     *
+     * @param schemaPool
+     *      the associated Schema Pool
+     */
+    public HierarchicalContentProvider()
     {
-        this.schemaPool = schemaPool;
+        this.schemaPool = SchemaPool.getInstance();
 
         objectClassTable = schemaPool.getObjectClassesAsHashTableByName();
-
         attributeTypeTable = schemaPool.getAttributeTypesAsHashTableByName();
     }
 
 
-    /******************************************
-     *       Interfaces Implementation        *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
      */
@@ -72,30 +91,6 @@
     }
 
 
-    /**
-     * Disposes of this content provider. This is called by the viewer when it is disposed.
-     */
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-     */
-    public void dispose()
-    {
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-     */
-    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
-    {
-    }
-
-
-    /******************************************
-     *       ITreeContentProvider Impl        *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
      */
@@ -104,13 +99,9 @@
         if ( parentElement instanceof ObjectClassWrapper )
         {
             //we are looking for the childrens of the contained objectClass
-            ObjectClass objectClass =  ( ( ObjectClassWrapper ) parentElement ).getMyObjectClass();
+            ObjectClass objectClass = ( ( ObjectClassWrapper ) parentElement ).getMyObjectClass();
 
-            IntermediateNode sub = new IntermediateNode( "Sub-types", ( ObjectClassWrapper ) parentElement, this, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
-            IntermediateNode may = new IntermediateNode(
-                "Optionnal Attributes", ( ObjectClassWrapper ) parentElement, this, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
-            IntermediateNode must = new IntermediateNode(
-                "Mandatory Attributes", ( ObjectClassWrapper ) parentElement, this, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
+            List<ObjectClassWrapper> subTypes = new ArrayList<ObjectClassWrapper>();
 
             //-> we need to compare each and every other objectClass's sup against them 
             //-> we also need to find a better way to do this (complexity wise)
@@ -133,7 +124,8 @@
                             if ( oClassSup.equals( objectClass ) )
                             {
                                 //we use an objectClass wrapper
-                                sub.addElement( new ObjectClassWrapper( oClass, sub ) );
+                                subTypes
+                                    .add( new ObjectClassWrapper( oClass, ( DisplayableTreeElement ) parentElement ) );
                                 break; //break only the inner for
                             }
                         }
@@ -141,35 +133,47 @@
                 }
             }
 
-            //complete optional attributes
-            String[] optAttributes = objectClass.getMay();
-            for ( String name : optAttributes )
-            {
-                AttributeType attr = attributeTypeTable.get( name );
-                //A CHANGER, ON FAIT SAUTER LES ATTR QUI NE SONT PAS DEFINIS
-                //DANS LE SCHEMA COURANT (ATTRS PAR DEFAUT)
-                if ( attr == null )
-                    continue;
-                //we use an attribute-type wrapper
-                may.addElement( new AttributeTypeWrapper( attr, may ) );
-            }
+            return subTypes.toArray();
+        }
+
+        if ( parentElement instanceof AttributeTypeWrapper )
+        {
+            //we are looking for the childrens of the contained attribute type
+            AttributeType attributeType = ( ( AttributeTypeWrapper ) parentElement ).getMyAttributeType();
+
+            List<AttributeTypeWrapper> subTypes = new ArrayList<AttributeTypeWrapper>();
 
-            //complete mandatory attributes
-            String[] mandAttributes = objectClass.getMust();
-            for ( String name : mandAttributes )
+            //-> we need to compare each and every other attribute type sup against them 
+            //-> we also need to find a better way to do this (complexity wise)
+
+            Collection<AttributeType> attributeTypes = attributeTypeTable.values();
+            for ( Iterator iter = attributeTypes.iterator(); iter.hasNext(); )
             {
-                AttributeType attr = attributeTypeTable.get( name );
-                //A CHANGER, ON FAIT SAUTER LES ATTR QUI NE SONT PAS DEFINIS
-                //DANS LE SCHEMA COURANT (ATTRS PAR DEFAUT)
-                if ( attr == null )
-                    continue;
+                AttributeType aType = ( AttributeType ) iter.next();
 
-                //we use an attribute-type wrapper
-                must.addElement( new AttributeTypeWrapper( attr, must ) );
+                //not this attribute type
+                if ( aType.getOid() != attributeType.getOid() )
+                {
+                    String aTypeSupName = aType.getSuperior();
+                    if ( aTypeSupName != null )
+                    {
+                        AttributeType aTypeSup = attributeTypeTable.get( aType.getSuperior() );
+                        if ( aTypeSup != null )
+                        {
+                            //the current object class is a sup of oClass
+                            if ( aTypeSup.equals( attributeType ) )
+                            {
+                                //we use an objectClass wrapper
+                                subTypes
+                                    .add( new AttributeTypeWrapper( aType, ( DisplayableTreeElement ) parentElement ) );
+                                break; //break only the inner for
+                            }
+                        }
+                    }
+                }
             }
 
-            return new Object[]
-                { sub, may, must };
+            return subTypes.toArray();
         }
 
         else if ( parentElement instanceof IntermediateNode )
@@ -181,47 +185,69 @@
                 //is beeing refreshed 
                 // -> the pool has been modified or it's the first display
                 // -> we need to regenerate the hashmaps containing the schemas elements
-                refresh();
+                refreshOcsAndAts();
 
                 //clear the primary node (because it's always the same instance we need to
                 //refresh it manually)
                 intermediate.clearChildrens();
-
-                //bootstrap the tree exploring process by adding the top node into the tree
-                ObjectClass top = schemaPool.getObjectClass( "top" ); //$NON-NLS-1$
-                if ( top != null )
+                if ( !Activator.getDefault().getDialogSettings().getBoolean(
+                    HideObjectClassesAction.HIDE_OBJECT_CLASSES_DS_KEY ) )
                 {
-                    ObjectClassWrapper topWrapper = new ObjectClassWrapper( top, intermediate );
-                    intermediate.addElement( topWrapper );
-                }
-
-                //add the unresolved object-classes to the top of the hierarchy
-                Collection<ObjectClass> objectClasses = objectClassTable.values();
-                for ( Iterator iter = objectClasses.iterator(); iter.hasNext(); )
-                {
-                    ObjectClass oClass = ( ObjectClass ) iter.next();
-                    String[] sups = oClass.getSuperiors();
-                    //if no supperiors had been set
-                    if ( sups.length == 0 )
+                    //bootstrap the tree exploring process by adding the top node into the tree
+                    ObjectClass top = schemaPool.getObjectClass( "top" ); //$NON-NLS-1$
+                    if ( top != null )
                     {
-                        ObjectClassWrapper wrapper = new ObjectClassWrapper( oClass, intermediate );
-                        wrapper.setState( ObjectClassWrapper.State.unResolved );
-                        intermediate.addElement( wrapper );
+                        ObjectClassWrapper topWrapper = new ObjectClassWrapper( top, intermediate );
+                        intermediate.addElement( topWrapper );
                     }
-                    else
+
+                    //add the unresolved object-classes to the top of the hierarchy
+                    Collection<ObjectClass> objectClasses = objectClassTable.values();
+                    for ( Iterator iter = objectClasses.iterator(); iter.hasNext(); )
                     {
-                        for ( String sup : sups )
+                        ObjectClass oClass = ( ObjectClass ) iter.next();
+                        String[] sups = oClass.getSuperiors();
+                        //if no supperiors had been set
+                        if ( sups.length == 0 )
+                        {
+                            ObjectClassWrapper wrapper = new ObjectClassWrapper( oClass, intermediate );
+                            wrapper.setState( ObjectClassWrapper.State.unResolved );
+                            intermediate.addElement( wrapper );
+                            this.hasChildren( wrapper );
+                        }
+                        else
                         {
-                            ObjectClass oClassSup = objectClassTable.get( sup );
-                            if ( oClassSup == null )
+                            for ( String sup : sups )
                             {
-                                ObjectClassWrapper wrapper = new ObjectClassWrapper( oClass, intermediate );
-                                wrapper.setState( ObjectClassWrapper.State.unResolved );
-                                intermediate.addElement( wrapper );
+                                ObjectClass oClassSup = objectClassTable.get( sup );
+                                if ( oClassSup == null )
+                                {
+                                    ObjectClassWrapper wrapper = new ObjectClassWrapper( oClass, intermediate );
+                                    wrapper.setState( ObjectClassWrapper.State.unResolved );
+                                    intermediate.addElement( wrapper );
+                                }
                             }
                         }
                     }
                 }
+
+                if ( !Activator.getDefault().getDialogSettings().getBoolean(
+                    HideAttributeTypesAction.HIDE_ATTRIBUTE_TYPES_DS_KEY ) )
+                {
+                    //add the unresolved object-classes to the top of the hierarchy
+                    Collection<AttributeType> attributeTypes = attributeTypeTable.values();
+                    for ( Iterator iter = attributeTypes.iterator(); iter.hasNext(); )
+                    {
+                        AttributeType aType = ( AttributeType ) iter.next();
+                        String sup = aType.getSuperior();
+                        //if no superior had been set
+                        if ( sup == null )
+                        {
+                            AttributeTypeWrapper wrapper = new AttributeTypeWrapper( aType, intermediate );
+                            intermediate.addElement( wrapper );
+                        }
+                    }
+                }
             }
 
             return intermediate.getChildren();
@@ -259,27 +285,25 @@
     {
         if ( element instanceof ObjectClassWrapper )
         {
-            return true;
+            return getChildren( ( ObjectClassWrapper ) element ).length > 0;
         }
         else if ( element instanceof AttributeTypeWrapper )
         {
-            return false;
+            return getChildren( ( AttributeTypeWrapper ) element ).length > 0;
         }
         else if ( element instanceof IntermediateNode )
         {
-            if ( ( ( IntermediateNode ) element ).getChildren().length > 0 )
-                return true;
+            return ( ( IntermediateNode ) element ).getChildren().length > 0;
         }
 
         return false;
     }
 
 
-    /******************************************
-     *             Internal Logic             *
-     ******************************************/
-
-    private void refresh()
+    /**
+     * Refreshes the object classes and attribute types HahshTables.
+     */
+    private void refreshOcsAndAts()
     {
         objectClassTable = schemaPool.getObjectClassesAsHashTableByName();
 
@@ -287,13 +311,11 @@
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
-     * Specify the comparator that will be used to sort the elements in the view
-     * @param order the comparator
+     * Specify the comparator that will be used to sort the elements in the view.
+     * 
+     * @param order
+     *      the comparator
      */
     public void setOrder( Comparator order )
     {
@@ -302,7 +324,8 @@
 
 
     /**
-     * Returns the comparator used to sort the elements in the view
+     * Returns the comparator used to sort the elements in the view.
+     * 
      * @return
      */
     public Comparator getOrder()
@@ -313,8 +336,10 @@
 
     /**
      * Initialize a tree viewer to display the information provided by the specified content
-     * provider
-     * @param viewer the tree viewer
+     * provider.
+     * 
+     * @param viewer
+     *      the tree viewer
      */
     public void bindToTreeViewer( TreeViewer viewer )
     {
@@ -323,5 +348,21 @@
 
         IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null, this ); //$NON-NLS-1$
         viewer.setInput( invisibleNode );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalLabelProvider.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalLabelProvider.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalLabelProvider.java Tue Feb 13 09:33:00 2007
@@ -29,12 +29,13 @@
 
 
 /**
- * Eclipse RPC programming pattern for tree-viewers
- *
+ * This class implements the label provider for the Hierarchy View.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class HierarchicalLabelProvider extends LabelProvider
 {
-
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
      */
@@ -43,7 +44,7 @@
         if ( obj instanceof DisplayableTreeElement )
             return ( ( DisplayableTreeElement ) obj ).getDisplayName();
 
-        //default
+        // Default
         return obj.toString();
     }
 
@@ -56,8 +57,7 @@
         if ( obj instanceof DisplayableTreeElement )
             return ( ( DisplayableTreeElement ) obj ).getDisplayImage();
 
-        //default
+        // Default
         return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_WARN_TSK );
-
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java Tue Feb 13 09:33:00 2007
@@ -25,73 +25,64 @@
 
 import org.apache.directory.ldapstudio.schemas.controller.Application;
 import org.apache.directory.ldapstudio.schemas.controller.HierarchicalViewerController;
-import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
-import org.apache.directory.ldapstudio.schemas.controller.actions.LinkWithEditorHierarchyView;
-import org.apache.directory.ldapstudio.schemas.controller.actions.SortHierarchicalViewAction;
 import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
 import org.apache.directory.ldapstudio.schemas.model.PoolListener;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 
+/**
+ * This class implements the Hierarchy View where all the hierarchy of object classes and attribute types is displayed.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class HierarchicalViewer extends ViewPart implements PoolListener
 {
+    /** The view's ID */
     public static final String ID = Application.PLUGIN_ID + ".view.HierarchicalViewer"; //$NON-NLS-1$
-    private TreeViewer viewer;
-    private Composite parent;
-    private HierarchicalContentProvider contentProvider;
-
 
-    /**
-     * @return the internal tree viewer
-     */
-    public TreeViewer getViewer()
-    {
-        return viewer;
-    }
+    /** The tree viewer */
+    private TreeViewer viewer;
 
+    /** The content provider */
+    private HierarchicalContentProvider contentProvider;
 
-    /******************************************
-     *        Interfaces Implementation       *
-     ******************************************/
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
      */
     public void createPartControl( Composite parent )
-    {
-        this.parent = parent;
-        initViewer();
-        IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
-        toolbar.add( new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
-            SortHierarchicalViewAction.SortType.alphabetical, Messages
-                .getString( "HierarchicalViewer.Sort_alphabetically" ) ) ); //$NON-NLS-1$
-        toolbar.add( new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
-            SortHierarchicalViewAction.SortType.unalphabetical, Messages
-                .getString( "HierarchicalViewer.Sort_unalphabetically" ) ) ); //$NON-NLS-1$
-        toolbar.add( new Separator() );
-        toolbar.add( new CollapseAllAction( getViewer() ) );
-        toolbar.add( new LinkWithEditorHierarchyView( this ) );
-    }
-
-
-    private void initViewer()
-    {
+    { 
+        initViewer( parent );
+        
+        // Registering the Viewer, so other views can be notified when the viewer selection changes
+        getSite().setSelectionProvider( viewer );
+        
         SchemaPool pool = SchemaPool.getInstance();
         //we want to be notified if the pool has been modified
         pool.addListener( this );
+        
+        // Adding the controller
+        new HierarchicalViewerController( this );
+    }
+
 
+    /**
+     * Initializes the viewer.
+     *
+     * @param parent
+     *      the parent element
+     */
+    private void initViewer( Composite parent )
+    {
         viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
-        contentProvider = new HierarchicalContentProvider( pool );
+        contentProvider = new HierarchicalContentProvider();
         contentProvider.bindToTreeViewer( viewer );
-        viewer.addDoubleClickListener( HierarchicalViewerController.getInstance() );
     }
 
 
@@ -104,12 +95,8 @@
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
-     * Refresh the entire view
+     * Refreshes the entire view
      */
     public void refresh()
     {
@@ -138,10 +125,6 @@
     }
 
 
-    /******************************************
-     *            Pool Listener Impl          *
-     ******************************************/
-
     /**
      * refresh the view if the pool has been modified
      */
@@ -149,7 +132,8 @@
     {
         refresh();
     }
-    
+
+
     /**
      * Search for the given element in the Tree and returns it if it has been found.
      *
@@ -196,5 +180,17 @@
             }
         }
         return null;
+    }
+
+
+    /**
+     * Gets the tree viewer.
+     * 
+     * @return
+     *      the tree viewer
+     */
+    public TreeViewer getViewer()
+    {
+        return viewer;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java Tue Feb 13 09:33:00 2007
@@ -29,40 +29,40 @@
 
 
 /**
- * Nasty trick to display object-classes attributes in the tree-viewer
+ * This class is used to represent an attribute type in a tree viewer.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class AttributeTypeWrapper implements DisplayableTreeElement
 {
-    /******************************************
-     *               Fields                   *
-     ******************************************/
+    /** The parent element */
+    private DisplayableTreeElement parent;
 
-    private IntermediateNode parent;
+    /** The associated attribute type */
     private AttributeType myAttributeType;
 
 
-    /******************************************
-     *              Constructors              *
-     ******************************************/
-
     /**
-     * Default constructor
+     * Creates a new instance of AttributeTypeWrapper.
+     *
      * @param myAttributeType
+     *      the associated attribute type
      * @param parent
+     *      the parent element
      */
-    public AttributeTypeWrapper( AttributeType myAttributeType, IntermediateNode parent )
+    public AttributeTypeWrapper( AttributeType myAttributeType, DisplayableTreeElement parent )
     {
         this.myAttributeType = myAttributeType;
         this.parent = parent;
     }
 
 
-    /******************************************
-     *             Wrapper Methods            *
-     ******************************************/
-
     /**
-     * @return the name of the wrapped attribute type
+     * Gets the name of the associated attribute type.
+     * 
+     * @return
+     *      the name of the associated attribute type
      */
     public String getName()
     {
@@ -71,7 +71,10 @@
 
 
     /**
-     * @return the OID of the wrapped attribute type
+     * Gets the OID of the associated attribute type.
+     * 
+     * @return
+     *      the OID of the associated attribute type
      */
     public String getOid()
     {
@@ -79,12 +82,11 @@
     }
 
 
-    /******************************************
-     *               Accessors                *
-     ******************************************/
-
     /**
-     * @return the wrapped attribute type
+     * Gets the associated attribute type.
+     * 
+     * @return 
+     *      the associated attribute type
      */
     public AttributeType getMyAttributeType()
     {
@@ -93,18 +95,17 @@
 
 
     /**
-     * @return the parent element
+     * Gets the parent element.
+     * 
+     * @return
+     *      the parent element
      */
-    public IntermediateNode getParent()
+    public DisplayableTreeElement getParent()
     {
         return parent;
     }
 
 
-    /******************************************
-     *       DisplayableTreeElement Impl.     *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
      */
@@ -124,10 +125,6 @@
     }
 
 
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
-    
     /* (non-Javadoc)
      * @see java.lang.Object#equals(java.lang.Object)
      */
@@ -140,6 +137,7 @@
         }
         return false;
     }
+
 
     /* (non-Javadoc)
      * @see java.lang.Object#toString()

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java Tue Feb 13 09:33:00 2007
@@ -46,4 +46,7 @@
      * @return the display name
      */
     public String getDisplayName();
+
+
+    public DisplayableTreeElement getParent();
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java?view=diff&rev=507112&r1=507111&r2=507112
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java Tue Feb 13 09:33:00 2007
@@ -31,33 +31,43 @@
 
 
 /**
- * Nasty trick to display object class in the tree-viewer
+ * This class is used to display an object class in a tree viewer. 
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class ObjectClassWrapper implements DisplayableTreeElement
 {
-    /******************************************
-     *               Fields                   *
-     ******************************************/
+    /**
+     * This enum represent the different states of an ObjectClassWrapper
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
     public enum State
     {
         resolved, unResolved
     }
 
+    /** The state */
     private State state;
-    private IntermediateNode parent;
-    private ObjectClass myObjectClass;
 
+    /** The parent element */
+    private DisplayableTreeElement parent;
+
+    /** The associated object class */
+    private ObjectClass myObjectClass;
 
-    /******************************************
-     *              Constructors              *
-     ******************************************/
 
     /**
-     * Default constructor
-     * @param parent
+     * Creates a new instance of ObjectClassWrapper.
+     *
      * @param myObjectClass
+     *      the associated object class
+     * @param parent
+     *      the parent element
      */
-    public ObjectClassWrapper( ObjectClass myObjectClass, IntermediateNode parent )
+    public ObjectClassWrapper( ObjectClass myObjectClass, DisplayableTreeElement parent )
     {
         this.parent = parent;
         this.myObjectClass = myObjectClass;
@@ -65,12 +75,11 @@
     }
 
 
-    /******************************************
-     *             Wrapper Methods            *
-     ******************************************/
-
     /**
-     * @return the names of the wrapped object class
+     * Gets the names of the associated object class.
+     *
+     * @return
+     *      the names of the associated object class
      */
     public String[] getNames()
     {
@@ -79,7 +88,10 @@
 
 
     /**
-     * @return the oid of the wrapped object class
+     * Gets the OID of the associated object class.
+     * 
+     * @return 
+     *      the oid of the associated object class
      */
     public String getOid()
     {
@@ -87,12 +99,11 @@
     }
 
 
-    /******************************************
-     *               Accessors                *
-     ******************************************/
-
     /**
-     * @return the wrapped object class
+     * Gets the associated object class
+     * 
+     * @return 
+     *      the associated object class
      */
     public ObjectClass getMyObjectClass()
     {
@@ -100,17 +111,20 @@
     }
 
 
-    /**
-     * @return the parent element
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getParent()
      */
-    public IntermediateNode getParent()
+    public DisplayableTreeElement getParent()
     {
         return parent;
     }
 
 
     /**
-     * @return the state of the wrapped object class
+     * Gets the state of the object class wrapper.
+     * 
+     * @return
+     *      the state of the object class wrapper
      */
     public State getState()
     {
@@ -119,8 +133,10 @@
 
 
     /**
-     * Sets the state of the wrapped object class
+     * Sets the state of the object class wrapper.
+     * 
      * @param state
+     *      the state of the object class wrapper
      */
     public void setState( State state )
     {
@@ -128,10 +144,6 @@
     }
 
 
-    /******************************************
-     *       DisplayableTreeElement Impl.     *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
      */
@@ -159,10 +171,6 @@
     }
 
 
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see java.lang.Object#equals(java.lang.Object)
      */
@@ -184,5 +192,4 @@
     {
         return myObjectClass + " wrapper"; //$NON-NLS-1$
     }
-
 }



Mime
View raw message