directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r518658 [3/3] - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ META-INF/ ressources/icons/ src/main/java/org/apache/directory/ldapstudio/schemas/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/...
Date Thu, 15 Mar 2007 15:14:44 GMT
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewRoot.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewRoot.java?view=auto&rev=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewRoot.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewRoot.java
Thu Mar 15 08:14:41 2007
@@ -0,0 +1,216 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * This class is used to represent the root entry of the TreeViewer used in the Hierarchy
View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyViewRoot extends TreeNode
+{
+    /** The AT children */
+    private List<AttributeTypeWrapper> aTChildren;
+
+    /** The OC children */
+    private List<ObjectClassWrapper> ocChildren;
+
+
+    /**
+     * Creates a new instance of SchemasViewRoot.
+     *
+     */
+    public HierarchyViewRoot()
+    {
+        super( null );
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "HierarchyViewRoot";
+    }
+
+
+    /**
+     * Adds an Attribute Type Wrapper to the list of children.
+     *
+     * @param atw
+     *      the Attribute Type Wrapper to add
+     */
+    public void addAttributeType( AttributeTypeWrapper atw )
+    {
+        if ( aTChildren == null )
+        {
+            aTChildren = new ArrayList<AttributeTypeWrapper>();
+        }
+
+        if ( !aTChildren.contains( atw ) )
+        {
+            aTChildren.add( atw );
+        }
+    }
+
+
+    /**
+     * Adds an Object Class Wrapper to the list of children.
+     *
+     * @param ocw
+     *      the Object Class Wrapper to add
+     */
+    public void addObjectClass( ObjectClassWrapper ocw )
+    {
+        if ( ocChildren == null )
+        {
+            ocChildren = new ArrayList<ObjectClassWrapper>();
+        }
+
+        if ( !ocChildren.contains( ocw ) )
+        {
+            ocChildren.add( ocw );
+        }
+    }
+
+
+    /**
+     * Gets the children Attribute Type Wrappers.
+     *
+     * @return
+     *      the children Attribute Type Wrappers
+     */
+    public List<AttributeTypeWrapper> getAttributeTypes()
+    {
+        if ( aTChildren == null )
+        {
+            aTChildren = new ArrayList<AttributeTypeWrapper>();
+        }
+
+        return aTChildren;
+    }
+
+
+    /**
+     * Gets the children Object Class Wrappers.
+     *
+     * @return
+     *      the children Object Class Wrappers
+     */
+    public List<ObjectClassWrapper> getObjectClasses()
+    {
+        if ( ocChildren == null )
+        {
+            ocChildren = new ArrayList<ObjectClassWrapper>();
+        }
+
+        return ocChildren;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#addChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    public void addChild( ITreeNode node )
+    {
+        if ( node instanceof AttributeTypeWrapper )
+        {
+            addAttributeType( ( AttributeTypeWrapper ) node );
+        }
+        else if ( node instanceof ObjectClassWrapper )
+        {
+            addObjectClass( ( ObjectClassWrapper ) node );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#addAllChildren(java.util.Collection)
+     */
+    public boolean addAllChildren( Collection<? extends ITreeNode> c )
+    {
+        for ( ITreeNode child : c )
+        {
+            addChild( child );
+        }
+        return true;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#removeChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    public void removeChild( ITreeNode node )
+    {
+        if ( node instanceof AttributeTypeWrapper )
+        {
+            removeAttributeType( ( AttributeTypeWrapper ) node );
+        }
+        else if ( node instanceof ObjectClassWrapper )
+        {
+            removeObjectClass( ( ObjectClassWrapper ) node );
+        }
+    }
+
+
+    /**
+     * TODO removeAttributeType.
+     *
+     * @param wrapper
+     */
+    private void removeAttributeType( AttributeTypeWrapper wrapper )
+    {
+        if ( aTChildren != null )
+        {
+            aTChildren.remove( wrapper );
+        }
+    }
+
+
+    /**
+     * TODO removeObjectClass.
+     *
+     * @param wrapper
+     */
+    private void removeObjectClass( ObjectClassWrapper wrapper )
+    {
+        if ( ocChildren != null )
+        {
+            ocChildren.remove( wrapper );
+        }
+    }
+    
+    public List<ITreeNode> getChildren()
+    {
+        List<ITreeNode> children = new ArrayList<ITreeNode>();
+        children.addAll( aTChildren );
+        children.addAll( ocChildren );
+        
+        return children;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ITreeNode.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ITreeNode.java?view=auto&rev=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ITreeNode.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ITreeNode.java
Thu Mar 15 08:14:41 2007
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This interface defines an element that can be used in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ITreeNode
+{
+    /**
+     * Gets the image of the element.
+     *
+     * @return
+     *      the image of the element
+     */
+    public Image getImage();
+
+
+    /**
+     * Gets the children of the element.
+     *
+     * @return
+     *      the children of the element
+     */
+    public List<ITreeNode> getChildren();
+
+
+    /**
+     * Returns true if the element has children.
+     *
+     * @return
+     *      true if the element has children
+     */
+    public boolean hasChildren();
+
+
+    /**
+     * Gets the parent of the element.
+     *
+     * @return
+     *      the parent of the element
+     */
+    public ITreeNode getParent();
+
+
+
+    /**
+     * Sets the parent of the element.
+     *
+     * @param node
+     *      the parent of the element
+     */
+    public void setParent( ITreeNode parent );
+
+
+    /**
+     * Adds a node to the element.
+     *
+     * @param node
+     *      the node to add
+     */
+    public void addChild( ITreeNode node );
+
+
+    /**
+     * Removes a node from the element.
+     *
+     * @param node
+     *      the node to remove 
+     */
+    public void removeChild( ITreeNode node );
+
+
+    /**
+     *  Appends all of the elements in the specified collection to the end of this list,
in the order that they are returned by the specified collection's iterator (optional operation).
The behavior of this operation is unspecified if the specified collection is modified while
the operation is in progress. (Note that this will occur if the specified collection is this
list, and it's nonempty.)
+     * 
+     * @param c
+     *      the collection whose elements are to be added to this list.
+     * @return
+     *      true if this list changed as a result of the call.
+     *      
+     * @see java.util.List.addAll(Collection c)
+     */
+    public boolean addAllChildren( Collection<? extends ITreeNode> c );
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
Thu Mar 15 08:14:41 2007
@@ -36,7 +36,7 @@
  * AttributeTypeLiterals or ObjectClassLiterals.
  *
  */
-public class IntermediateNode implements DisplayableTreeElement
+public class IntermediateNode extends TreeNode
 {
     /** This enum represent the different types of IntermediateNodes */
     public enum IntermediateNodeType
@@ -47,9 +47,6 @@
     /** The name */
     private String name;
 
-    /** The parent element */
-    private DisplayableTreeElement parent;
-
     /** The type */
     private IntermediateNodeType type;
 
@@ -60,10 +57,10 @@
      * @param parent the parent DisplayableTreeElement in the schema relationship
      * hierarchy
      */
-    public IntermediateNode( String name, DisplayableTreeElement parent )
+    public IntermediateNode( String name, ITreeNode parent )
     {
+        super( parent );
         this.name = name;
-        this.parent = parent;
         this.type = IntermediateNodeType.NONE;
     }
 
@@ -78,10 +75,10 @@
      * @param type 
      *      the type of IntermediateNode
      */
-    public IntermediateNode( String name, DisplayableTreeElement parent, IntermediateNodeType
type )
+    public IntermediateNode( String name, ITreeNode parent, IntermediateNodeType type )
     {
+        super( parent );
         this.name = name;
-        this.parent = parent;
         this.type = type;
     }
 
@@ -99,19 +96,10 @@
     }
 
 
-    /**
-     * @return the parent of the intermediate node
-     */
-    public DisplayableTreeElement getParent()
-    {
-        return parent;
-    }
-
-
     /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#getImage()
      */
-    public Image getDisplayImage()
+    public Image getImage()
     {
         switch ( type )
         {
@@ -130,10 +118,6 @@
         return PlatformUI.getWorkbench().getSharedImages().getImage( imageKey );
     }
 
-
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
 
     /* (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/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=518658&r1=518657&r2=518658
==============================================================================
--- 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
Thu Mar 15 08:14:41 2007
@@ -36,7 +36,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ObjectClassWrapper implements DisplayableTreeElement
+public class ObjectClassWrapper extends TreeNode
 {
     /**
      * This enum represent the different states of an ObjectClassWrapper
@@ -52,9 +52,6 @@
     /** The state */
     private State state;
 
-    /** The parent element */
-    private DisplayableTreeElement parent;
-
     /** The associated object class */
     private ObjectClass myObjectClass;
 
@@ -67,9 +64,9 @@
      * @param parent
      *      the parent element
      */
-    public ObjectClassWrapper( ObjectClass myObjectClass, DisplayableTreeElement parent )
+    public ObjectClassWrapper( ObjectClass myObjectClass, ITreeNode parent )
     {
-        this.parent = parent;
+        super( parent );
         this.myObjectClass = myObjectClass;
         this.state = State.resolved;
     }
@@ -87,15 +84,6 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getParent()
-     */
-    public DisplayableTreeElement getParent()
-    {
-        return parent;
-    }
-
-
     /**
      * Gets the state of the object class wrapper.
      * 
@@ -121,9 +109,9 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#getImage()
      */
-    public Image getDisplayImage()
+    public Image getImage()
     {
         String imageKey = ISharedImages.IMG_OBJS_WARN_TSK;
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java
Thu Mar 15 08:14:41 2007
@@ -30,12 +30,12 @@
 /**
  * This class is used to compare and sort ascending two DisplayableTreeElement
  */
-public class OidSorter implements Comparator<DisplayableTreeElement>
+public class OidSorter implements Comparator<ITreeNode>
 {
     /* (non-Javadoc)
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( DisplayableTreeElement o1, DisplayableTreeElement o2 )
+    public int compare( ITreeNode o1, ITreeNode o2 )
     {
         if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper
) )
         {

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaSorter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaSorter.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaSorter.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaSorter.java
Thu Mar 15 08:14:41 2007
@@ -29,12 +29,12 @@
 /**
  * This class is used to compare and sort ascending two Schemas
  */
-public class SchemaSorter implements Comparator<DisplayableTreeElement>
+public class SchemaSorter implements Comparator<ITreeNode>
 {
     /* (non-Javadoc)
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( DisplayableTreeElement o1, DisplayableTreeElement o2 )
+    public int compare( ITreeNode o1, ITreeNode o2 )
     {
         if ( ( o1 instanceof SchemaWrapper ) && ( o2 instanceof SchemaWrapper ) )
         {

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaWrapper.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaWrapper.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaWrapper.java
Thu Mar 15 08:14:41 2007
@@ -31,49 +31,24 @@
 /**
  * Nasty trick to display object-classes attributes in the tree-viewer
  */
-public class SchemaWrapper implements DisplayableTreeElement
+public class SchemaWrapper extends TreeNode
 {
-    /******************************************
-     *               Fields                   *
-     ******************************************/
-
-    private IntermediateNode parent;
+    /** The associated schema */
     private Schema mySchema;
 
 
-    /******************************************
-     *              Constructors              *
-     ******************************************/
-
     /**
      * Default constructor
      * @param mySchema
      * @param parent
      */
-    public SchemaWrapper( Schema mySchema, IntermediateNode parent )
+    public SchemaWrapper( Schema mySchema, ITreeNode parent )
     {
+        super( parent );
         this.mySchema = mySchema;
-        this.parent = parent;
-    }
-
-
-    /******************************************
-     *             Wrapper Methods            *
-     ******************************************/
-
-    /**
-     * @return the name of the wrapped schema
-     */
-    public String getName()
-    {
-        return mySchema.getName();
     }
 
 
-    /******************************************
-     *               Accessors                *
-     ******************************************/
-
     /**
      * @return the wrapped schema
      */
@@ -83,23 +58,10 @@
     }
 
 
-    /**
-     * @return the parent element
-     */
-    public IntermediateNode getParent()
-    {
-        return parent;
-    }
-
-
-    /******************************************
-     *       DisplayableTreeElement Impl.     *
-     ******************************************/
-
     /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.TreeNode#getImage()
      */
-    public Image getDisplayImage()
+    public Image getImage()
     {
         if ( this.mySchema.type.equals( Schema.SchemaType.coreSchema ) )
         {
@@ -108,15 +70,20 @@
         }
         else
         {
-            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA
).createImage();
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA
)
+                .createImage();
         }
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
+
+    /**
+     * Gets the name of the schema.
+     *
+     * @return
+     *      the name of the schema
      */
-    public String getDisplayName()
+    public String getName()
     {
         String res = ""; //$NON-NLS-1$
         if ( mySchema.hasBeenModified() )
@@ -125,10 +92,6 @@
     }
 
 
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
-
     /* (non-Javadoc)
      * @see java.lang.Object#equals(java.lang.Object)
      */
@@ -148,6 +111,6 @@
      */
     public String toString()
     {
-        return mySchema + " wrapper"; //$NON-NLS-1$
+        return mySchema.getName() + " wrapper"; //$NON-NLS-1$
     }
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewRoot.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewRoot.java?view=auto&rev=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewRoot.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewRoot.java
Thu Mar 15 08:14:41 2007
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+/**
+ * This class is used to represent the root entry of the TreeViewer used in the Schemas View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemasViewRoot extends TreeNode
+{
+    /**
+     * Creates a new instance of SchemasViewRoot.
+     *
+     */
+    public SchemasViewRoot()
+    {
+        super( null );
+    }
+
+    
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "SchemasViewRoot";
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/TreeNode.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/TreeNode.java?view=auto&rev=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/TreeNode.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/TreeNode.java
Thu Mar 15 08:14:41 2007
@@ -0,0 +1,159 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This abstract class implements the ITreeNode Interface.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class TreeNode implements ITreeNode
+{
+    /** The children */
+    protected List<ITreeNode> fChildren;
+
+    /** The parent */
+    protected ITreeNode fParent;
+
+
+    /**
+     * Creates a new instance of TreeNode.
+     *
+     * @param parent
+     *      the parent element
+     */
+    public TreeNode( ITreeNode parent )
+    {
+        fParent = parent;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#getImage()
+     */
+    public Image getImage()
+    {
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        if ( fChildren == null )
+        {
+            return true;
+        }
+
+        return !fChildren.isEmpty();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#getParent()
+     */
+    public ITreeNode getParent()
+    {
+        return fParent;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#setParent(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    public void setParent( ITreeNode parent )
+    {
+        fParent = parent;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#getChildren()
+     */
+    public List<ITreeNode> getChildren()
+    {
+        if ( fChildren == null )
+        {
+            fChildren = new ArrayList<ITreeNode>();
+        }
+
+        return fChildren;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#addChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    public void addChild( ITreeNode node )
+    {
+        if ( fChildren == null )
+        {
+            fChildren = new ArrayList<ITreeNode>();
+        }
+
+        if ( !fChildren.contains( node ) )
+        {
+            fChildren.add( node );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#removeChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#removeChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#removeChild(org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode)
+     */
+    public void removeChild( ITreeNode node )
+    {
+        if ( fChildren != null )
+        {
+            fChildren.remove( node );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode#addAllChildren(java.util.Collection)
+     */
+    public boolean addAllChildren( Collection<? extends ITreeNode> c )
+    {
+        if ( fChildren == null )
+        {
+            fChildren = new ArrayList<ITreeNode>();
+        }
+
+        return fChildren.addAll( c );
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
Thu Mar 15 08:14:41 2007
@@ -21,11 +21,10 @@
 package org.apache.directory.ldapstudio.schemas.view.wizards;
 
 
-import java.util.Hashtable;
+import java.util.Map;
 
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
-import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.OID;
 import org.apache.directory.ldapstudio.schemas.model.SchemaElement;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
@@ -59,9 +58,7 @@
     @SuppressWarnings("unused")//$NON-NLS-1$
     private ISelection selection;
 
-    private Hashtable<String, AttributeType> typesByName;
-
-    private Hashtable<String, SchemaElement> elementsByOID;
+    private Map<String, SchemaElement> elements;
 
     private Text oidField;
 
@@ -80,9 +77,8 @@
         setDescription( Messages.getString( "CreateANewAttributeTypeWizardPage.Page_Description"
) ); //$NON-NLS-1$
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID,
PluginConstants.IMG_ATTRIBUTE_TYPE_NEW_WIZARD ) );
         this.selection = selection;
-
-        typesByName = SchemaPool.getInstance().getAttributeTypesAsHashTableByName();
-        elementsByOID = SchemaPool.getInstance().getSchemaElementsAsHashTableByOID();
+        
+        elements = SchemaPool.getInstance().getSchemaElements();
     }
 
 
@@ -218,17 +214,17 @@
             return;
         }
 
-        if ( elementsByOID.containsKey( getOidField() ) )
+        if ( elements.containsKey( getOidField() ) )
         {
             updateStatus( Messages
                 .getString( "CreateANewAttributeTypeWizardPage.An_element_of_the_same_OID_already_exists"
) ); //$NON-NLS-1$
             return;
         }
 
-        if ( typesByName.containsKey( getNameField() ) )
+        if ( elements.containsKey( getNameField() ) )
         {
             updateStatus( Messages
-                .getString( "CreateANewAttributeTypeWizardPage.An_attribute_type_of_the_same_name_already_exists"
) ); //$NON-NLS-1$
+                .getString( "CreateANewAttributeTypeWizardPage.An_element_of_the_same_name_already_exists"
) ); //$NON-NLS-1$
             return;
         }
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
Thu Mar 15 08:14:41 2007
@@ -21,12 +21,11 @@
 package org.apache.directory.ldapstudio.schemas.view.wizards;
 
 
-import java.util.Hashtable;
+import java.util.Map;
 
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.model.OID;
-import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.model.SchemaElement;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.preferences.OidPreferencePage;
@@ -58,10 +57,7 @@
 
     @SuppressWarnings("unused")//$NON-NLS-1$
     private ISelection selection;
-
-    private Hashtable<String, ObjectClass> classesByName;
-
-    private Hashtable<String, SchemaElement> elementsByOID;
+    private Map<String, SchemaElement> elements;
 
     private Text oidField;
 
@@ -81,8 +77,7 @@
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
PluginConstants.IMG_OBJECT_CLASS_NEW_WIZARD ) );
         this.selection = selection;
 
-        classesByName = SchemaPool.getInstance().getObjectClassesAsHashTableByName();
-        elementsByOID = SchemaPool.getInstance().getSchemaElementsAsHashTableByOID();
+        elements = SchemaPool.getInstance().getSchemaElements();
     }
 
 
@@ -219,14 +214,14 @@
             return;
         }
 
-        if ( elementsByOID.containsKey( getOidField() ) )
+        if ( elements.containsKey( getOidField() ) )
         {
             updateStatus( Messages
                 .getString( "CreateANewObjectClassWizardPage.An_element_of_the_same_OID_already_exists"
) ); //$NON-NLS-1$
             return;
         }
 
-        if ( classesByName.containsKey( getNameField() ) )
+        if ( elements.containsKey( getNameField() ) )
         {
             updateStatus( Messages
                 .getString( "CreateANewObjectClassWizardPage.An_object_class_of_the_same_name_already_exists"
) ); //$NON-NLS-1$

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/wizards/messages.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/wizards/messages.properties?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/wizards/messages.properties
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/wizards/messages.properties
Thu Mar 15 08:14:41 2007
@@ -42,6 +42,6 @@
 CreateANewObjectClassWizardPage.A_name_must_be_specified=A name must be specified
 CreateANewAttributeTypeWizardPage.An_element_of_the_same_OID_already_exists=An element of
the same OID already exists
 CreateANewObjectClassWizardPage.An_element_of_the_same_OID_already_exists=An element of the
same OID already exists
-CreateANewAttributeTypeWizardPage.An_attribute_type_of_the_same_name_already_exists=An attribute
type of the same name already exists
+CreateANewAttributeTypeWizardPage.An_element_of_the_same_name_already_exists=An element of
the same name already exists
 CreateANewSchemaWizardPage.A_schema_of_the_same_name_is_already_loaded_in_the_pool=A schema
of the same name is already loaded in the pool
 CreateANewObjectClassWizardPage.An_object_class_of_the_same_name_already_exists=An object
class of the same name already exists



Mime
View raw message