directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r548363 [1/2] - in /directory/studio/trunk/studio-apacheds-schemaeditor: ./ META-INF/ resources/ resources/icons/ src/main/java/org/apache/directory/studio/ src/main/java/org/apache/directory/studio/apacheds/ src/main/java/org/apache/direct...
Date Mon, 18 Jun 2007 14:05:09 GMT
Author: pamarcelot
Date: Mon Jun 18 07:05:06 2007
New Revision: 548363

URL: http://svn.apache.org/viewvc?view=rev&rev=548363
Log:
Added first shot for the ApacheDS Schema Editor Plugin. The schema is readable from the server in the Apache DS Schema View.
Connections parameters are host='localhost', port='10389', user='uid=admin,ou=system', password='secret'.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/connect.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/disconnect.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_at.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_oc.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_view.png   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java
      - copied, changed from r547706, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/Main.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java
      - copied, changed from r547706, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/SchemaImporter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/
      - copied from r547703, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/AttributeTypeImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/MatchingRuleImpl.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/MatchingRuleImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/ObjectClassImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/Schema.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SchemaImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SyntaxImpl.java
      - copied, changed from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SyntaxImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AbstractTreeNode.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaWrapper.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/TreeNode.java
Removed:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/Main.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/SchemaImporter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF
    directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF?view=diff&rev=548363&r1=548362&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF Mon Jun 18 07:05:06 2007
@@ -7,6 +7,7 @@
 Bundle-Vendor: Apache Software Foundation
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,
- org.apache.directory.studio.jars
+ org.apache.directory.studio.jars,
+ org.eclipse.core.runtime
 Eclipse-LazyStart: true
 Bundle-ClassPath: .

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml?view=diff&rev=548363&r1=548362&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Mon Jun 18 07:05:06 2007
@@ -19,4 +19,17 @@
   under the License.
 -->
 <plugin>
+	<extension
+         point="org.eclipse.ui.views">
+      <category
+            id="org.apache.directory.studio.apacheds.schemaeditor.view.category"
+            name="Apache DS Schema"/>
+      <view
+            allowMultiple="false"
+            category="org.apache.directory.studio.apacheds.schemaeditor.view.category"
+            class="org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView"
+            icon="resources/icons/schemas_view.png"
+            id="org.apache.directory.studio.apacheds.schemaeditor.view.SchemaView"
+            name="Apache DS Schema"/>
+   </extension>
 </plugin>

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/attribute_type.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/connect.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/connect.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/connect.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/disconnect.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/disconnect.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/disconnect.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_at.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_at.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_at.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_oc.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_oc.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/folder_oc.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/object_class.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema.gif?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_view.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_view.png?view=auto&rev=548363
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_view.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,87 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Activator extends AbstractUIPlugin
+{
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = "org.apache.directory.studio.apacheds.schemaeditor"; //$NON-NLS-1$
+
+    /** The shared instance */
+    private static Activator plugin;
+
+
+    /**
+     * Creates a new instance of Activator.
+     */
+    public Activator()
+    {
+        plugin = this;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance.
+     *
+     * @return
+     *      the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
+}

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java (from r547706, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/Main.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/Main.java&r1=547706&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/Main.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java Mon Jun 18 07:05:06 2007
@@ -17,30 +17,48 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio;
+package org.apache.directory.studio.apacheds.schemaeditor;
+
+
+import java.beans.XMLEncoder;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.List;
 
 import javax.naming.NamingException;
 
-public class Main 
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+
+
+public class Main
 {
 
-	
-	public static void main(String[] args)
-	{
-		try
-		{
-			SchemaImporter schemaImporter = new SchemaImporter();
-			schemaImporter.getServerSchema();
-			
-			
-		}
-		catch (NamingException e)
-		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}		
-	}
-	
-	
+    public static void main( String[] args )
+    {
+        try
+        {
+            SchemaImporter schemaImporter = new SchemaImporter();
+            List<Schema> schemas = schemaImporter.getServerSchema();
+
+            for ( Schema schema : schemas )
+            {
+                FileOutputStream os = new FileOutputStream("/Users/pajbam/Desktop/test/" + schema.getName() +".xml");
+                XMLEncoder encoder = new XMLEncoder(os);
+                encoder.writeObject( schema.getAttributeTypes() );
+                encoder.close();
+            }
+
+        }
+        catch ( NamingException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        catch ( FileNotFoundException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
 
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor;
+
+
+/**
+ * This interface contains all the Constants used in the Plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface PluginConstants
+{
+    // Images
+    public static final String IMG_ATTRIBUTE_TYPE = "resources/icons/attribute_type.gif";
+    public static final String IMG_CONNECT = "resources/icons/connect.gif";
+    public static final String IMG_DISCONNECT = "resources/icons/disconnect.gif";
+    public static final String IMG_FOLDER = "resources/icons/folder.gif";
+    public static final String IMG_FOLDER_AT = "resources/icons/folder_at.gif";
+    public static final String IMG_FOLDER_OC = "resources/icons/folder_oc.gif";
+    public static final String IMG_OBJECT_CLASS = "resources/icons/object_class.gif";
+    public static final String IMG_SCHEMA = "resources/icons/schema.gif";
+    
+    // Commands
+    public static final String CMD_CONNECT= Activator.PLUGIN_ID +".connect";
+    
+}

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java (from r547706, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/SchemaImporter.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/SchemaImporter.java&r1=547706&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/SchemaImporter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio;
+package org.apache.directory.studio.apacheds.schemaeditor;
 
 
 import java.util.ArrayList;
@@ -39,12 +39,12 @@
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.studio.model.AttributeTypeImpl;
-import org.apache.directory.studio.model.MatchingRuleImpl;
-import org.apache.directory.studio.model.ObjectClassImpl;
-import org.apache.directory.studio.model.Schema;
-import org.apache.directory.studio.model.SchemaImpl;
-import org.apache.directory.studio.model.SyntaxImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
 
 
 /**
@@ -115,10 +115,12 @@
      * 		the context
      * @throws NamingException 
      */
-    public void getServerSchema() throws NamingException
+    public List<Schema> getServerSchema() throws NamingException
     {
         DirContext context = createContext( "localhost", "10389", SCHEMA_DN, "uid=admin,ou=system", "secret" );
 
+        List<Schema> schemas = new ArrayList<Schema>();
+
         // Looking for all the defined schemas
         SearchControls constraintSearch = new SearchControls();
         constraintSearch.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -134,9 +136,11 @@
             while ( ne.hasMoreElements() )
             {
                 String value = ( String ) ne.nextElement();
-                getSchema( context, value );
+                schemas.add( getSchema( context, value ) );
             }
         }
+        
+        return schemas;
     }
 
 
@@ -158,27 +162,22 @@
                     AttributeType at = createAttributeType( searchResult );
                     at.setSchema( name );
                     schema.addAttributeType( at );
-                    System.err.println( at );
                     break;
                 case OBJECT_CLASS:
                     ObjectClass oc = createObjectClass( searchResult );
                     oc.setSchema( name );
                     schema.addObjectClass( oc );
-                    System.err.println( oc );
                     break;
                 case MATCHING_RULE:
                     MatchingRule mr = createMatchingRule( searchResult );
                     mr.setSchema( name );
                     schema.addMatchingRule( mr );
-                    System.err.println( mr );
                     break;
                 case SYNTAX:
                     Syntax syntax = createSyntax( searchResult );
                     syntax.setSchema( name );
                     schema.addSyntax( syntax );
-                    System.err.println( syntax );
                     break;
-
                 default:
                     break;
             }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,144 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ConnectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Controller for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaViewController
+{
+    /** The associated view */
+    private SchemaView view;
+    
+    // The Actions
+    private Action connect;
+
+
+    /**
+     * Creates a new instance of SchemasViewController.
+     *
+     * @param view
+     *      the associated view
+     */
+    public SchemaViewController( SchemaView view )
+    {
+        this.view = view;
+        
+        initActions();
+        initToolbar();
+        initDoubleClickListener();
+    }
+    
+    /**
+     * Initializes the Actions.
+     */
+    private void initActions()
+    {
+        connect = new ConnectAction( view );
+    }
+    
+    /**
+     * Initializes the Toolbar.
+     */
+    private void initToolbar()
+    {
+        IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( connect );
+    }
+
+
+    /**
+     * Initializes the DoubleClickListener.
+     */
+    private void initDoubleClickListener()
+    {
+        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+                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 AttributeTypeEditorInput( ( ( AttributeTypeWrapper ) objectSelection )
+//                        .getMyAttributeType() );
+//                    editorId = AttributeTypeEditor.ID;
+                }
+                else if ( objectSelection instanceof ObjectClassWrapper )
+                {
+//                    input = new ObjectClassEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
+//                    editorId = ObjectClassEditor.ID;
+                }
+                else if ( ( objectSelection instanceof Folder )
+                    || ( objectSelection instanceof SchemaWrapper ) )
+                {
+                    // 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/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.SchemaImporter;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This Action is used to connect to Apache Directory Server and retrieve the Schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated View */
+    private SchemaView view;
+    
+    /**
+     * Creates a new instance of ConnectAction.
+     *
+     * @param view
+     *      the associated View
+     */
+    public ConnectAction( SchemaView view )
+    {
+        super( "Connect" ); //$NON-NLS-1$
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_CONNECT );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_CONNECT ) );
+        setEnabled( true );
+        this.view = view;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        try
+        {
+            SchemaHandler schemaHandler = SchemaHandler.getInstance();
+            SchemaImporter schemaImporter = new SchemaImporter();
+            List<Schema> schemas = schemaImporter.getServerSchema();
+            for ( Schema schema : schemas )
+            {
+                schemaHandler.addSchema( schema );
+            }
+            view.reloadViewer();
+        }
+        catch ( NamingException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/AttributeTypeImpl.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/AttributeTypeImpl.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/AttributeTypeImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
 import javax.naming.NamingException;

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/MatchingRuleImpl.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/MatchingRuleImpl.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/MatchingRuleImpl.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/MatchingRuleImpl.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/MatchingRuleImpl.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/MatchingRuleImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/MatchingRuleImpl.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
 import java.util.Comparator;

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/ObjectClassImpl.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/ObjectClassImpl.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/ObjectClassImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 import javax.naming.NamingException;
 

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/Schema.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/Schema.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/Schema.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
 import java.util.List;

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,110 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.model;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * The SchemaHandler is used to manage the Schema.
+ * 
+ * This class is a Singleton, use SchemaHandler.getInstance() to get an 
+ * instance of the class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaHandler
+{
+    /** The instance */
+    private static SchemaHandler instance = null;
+
+    private List<Schema> schemas;
+
+
+    /**
+     * Gets the instance of SchemaHandler.
+     *
+     * @return
+     *      the instance of SchemaHandler
+     */
+    public static SchemaHandler getInstance()
+    {
+        if ( instance == null )
+        {
+            instance = new SchemaHandler();
+        }
+
+        return instance;
+    }
+
+
+    /**
+     * Private Constructor.
+     */
+    private  SchemaHandler()
+    {
+        // Constructor is 'private' to disable the instanciation ("new SchemaHandler")
+
+        schemas = new ArrayList<Schema>();
+    }
+
+
+    /**
+     * Gets the Schema List.
+     *
+     * @return
+     *      the Schema List
+     */
+    public List<Schema> getSchemas()
+    {
+        return schemas;
+    }
+
+
+    /**
+     * Adds a Schema.
+     *
+     * @param schema
+     *      the Schema
+     * @return
+     *      true (as per the general contract of the Collection.add method).
+     */
+    public boolean addSchema( Schema schema )
+    {
+        return schemas.add( schema );
+    }
+
+
+    /**
+     * Removes a Schema.
+     *
+     * @param schema
+     *      the Schema
+     * @return
+     *      true if this list contained the specified element.
+     */
+    public boolean removeSchema( Schema schema )
+    {
+        return schemas.remove( schema );
+    }
+}

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SchemaImpl.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SchemaImpl.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SchemaImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
 import java.util.ArrayList;
@@ -54,7 +54,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#addAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
      */
     public boolean addAttributeType( AttributeType at )
     {
@@ -63,7 +63,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#addMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
      */
     public boolean addMatchingRule( MatchingRule mr )
     {
@@ -72,7 +72,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#addObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
      */
     public boolean addObjectClass( ObjectClass oc )
     {
@@ -81,7 +81,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#addSyntax(org.apache.directory.shared.ldap.schema.Syntax)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addSyntax(org.apache.directory.shared.ldap.schema.Syntax)
      */
     public boolean addSyntax( Syntax syntax )
     {
@@ -90,7 +90,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getAttributeType(java.lang.String)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getAttributeType(java.lang.String)
      */
     public AttributeType getAttributeType( String id )
     {
@@ -100,7 +100,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getAttributeTypes()
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getAttributeTypes()
      */
     public List<AttributeType> getAttributeTypes()
     {
@@ -109,7 +109,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getMatchingRule(java.lang.String)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getMatchingRule(java.lang.String)
      */
     public MatchingRule getMatchingRule( String id )
     {
@@ -119,7 +119,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getMatchingRules()
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getMatchingRules()
      */
     public List<MatchingRule> getMatchingRules()
     {
@@ -128,7 +128,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getName()
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getName()
      */
     public String getName()
     {
@@ -137,7 +137,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getObjectClass(java.lang.String)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getObjectClass(java.lang.String)
      */
     public ObjectClass getObjectClass( String id )
     {
@@ -147,7 +147,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getObjectClasses()
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getObjectClasses()
      */
     public List<ObjectClass> getObjectClasses()
     {
@@ -156,7 +156,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getSyntax(java.lang.String)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getSyntax(java.lang.String)
      */
     public MatchingRule getSyntax( String id )
     {
@@ -166,7 +166,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#getSyntaxes()
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getSyntaxes()
      */
     public List<Syntax> getSyntaxes()
     {
@@ -175,7 +175,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#removeAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
      */
     public boolean removeAttributeType( AttributeType at )
     {
@@ -184,7 +184,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#removeMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
      */
     public boolean removeMatchingRule( MatchingRule mr )
     {
@@ -193,7 +193,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#removeObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
      */
     public boolean removeObjectClass( ObjectClass oc )
     {
@@ -202,7 +202,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#removeSyntax(org.apache.directory.shared.ldap.schema.Syntax)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeSyntax(org.apache.directory.shared.ldap.schema.Syntax)
      */
     public boolean removeSyntax( Syntax syntax )
     {
@@ -211,7 +211,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.studio.model.Schema#setName(java.lang.String)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#setName(java.lang.String)
      */
     public void setName( String name )
     {

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SyntaxImpl.java (from r548361, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SyntaxImpl.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SyntaxImpl.java?view=diff&rev=548363&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SyntaxImpl.java&r1=548361&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SyntaxImpl.java&r2=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/model/SyntaxImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SyntaxImpl.java Mon Jun 18 07:05:06 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.model;
+package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
 import javax.naming.NamingException;

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,111 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaViewRoot;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class represents the SchemaView. 
+ * It is used to display the Schema and its elements (Schemas, AttributeTypes 
+ * and ObjectClasses).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaView extends ViewPart
+{
+    /** The ID of the View */
+    public static final String ID = Activator.PLUGIN_ID + ".view.SchemasView"; //$NON-NLS-1$
+
+    /** The viewer */
+    private TreeViewer viewer;
+
+    /** The content provider of the viewer */
+    private SchemaViewContentProvider contentProvider;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        initViewer( parent );
+
+        // Registering the Viewer, so other views can be notified when the viewer selection changes
+        getSite().setSelectionProvider( viewer );
+
+        // Adding the controller
+        new SchemaViewController( this );
+    }
+
+
+    /**
+     * Initializes the Viewer
+     */
+    private void initViewer( Composite parent )
+    {
+        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        contentProvider = new SchemaViewContentProvider( viewer );
+        viewer.setContentProvider( contentProvider );
+        viewer.setLabelProvider( new DecoratingLabelProvider( new SchemaViewLabelProvider(), Activator.getDefault()
+            .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+        viewer.setInput( new SchemaViewRoot() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    /**
+     * Gets the TreeViewer.
+     *
+     * @return
+     *      the TreeViewer
+     */
+    public TreeViewer getViewer()
+    {
+        return viewer;
+    }
+
+
+    /**
+     * Reloads the Viewer
+     */
+    public void reloadViewer()
+    {
+        viewer.setInput( new SchemaViewRoot() );
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,180 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaViewRoot;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder.FolderType;
+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 ContentProvider for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Default constructor
+     *
+     * @param viewer
+     *      the associated TreeViewer
+     */
+    public SchemaViewContentProvider( TreeViewer viewer )
+    {
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (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 )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    public Object[] getChildren( Object parentElement )
+    {
+        List<TreeNode> children = null;
+
+        if ( parentElement instanceof SchemaViewRoot )
+        {
+            SchemaViewRoot root = ( SchemaViewRoot ) parentElement;
+
+            if ( root.getChildren().isEmpty() )
+            {
+                List<Schema> schemas = SchemaHandler.getInstance().getSchemas();
+                for ( Schema schema : schemas )
+                {
+                    root.addChild( new SchemaWrapper( schema, root ) );
+                }
+            }
+
+            children = root.getChildren();
+        }
+        else if ( parentElement instanceof SchemaWrapper )
+        {
+            SchemaWrapper schemaWrapper = ( SchemaWrapper ) parentElement;
+
+            if ( schemaWrapper.getChildren().isEmpty() )
+            {
+                Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE, schemaWrapper );
+                schemaWrapper.addChild( atFolder );
+                Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper );
+                schemaWrapper.addChild( ocFolder );
+
+                List<AttributeType> attributeTypes = schemaWrapper.getSchema().getAttributeTypes();
+                for ( AttributeType attributeType : attributeTypes )
+                {
+                    atFolder.addChild( new AttributeTypeWrapper( attributeType, atFolder ) );
+                }
+
+                List<ObjectClass> objectClasses = schemaWrapper.getSchema().getObjectClasses();
+                for ( ObjectClass objectClass : objectClasses )
+                {
+                    ocFolder.addChild( new ObjectClassWrapper( objectClass, ocFolder ) );
+                }
+            }
+
+            children = schemaWrapper.getChildren();
+        }
+        else if ( parentElement instanceof Folder )
+        {
+            Folder folder = ( Folder ) parentElement;
+
+            children = folder.getChildren();
+        }
+
+        return children.toArray();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).getParent();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).hasChildren();
+        }
+
+        // Default
+        return false;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaViewLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof SchemaWrapper )
+        {
+            SchemaWrapper sw = ( SchemaWrapper ) element;
+
+            return sw.getSchema().getName();
+        }
+        else if ( element instanceof AttributeTypeWrapper )
+        {
+            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) element;
+
+            return atw.getAttributeType().getOid();
+        }
+        else if ( element instanceof ObjectClassWrapper )
+        {
+            ObjectClassWrapper ocw = ( ObjectClassWrapper ) element;
+
+            return ocw.getObjectClass().getOid();
+        }
+        else if ( element instanceof Folder )
+        {
+            Folder folder = ( Folder ) element;
+
+            return folder.getName() + " (" + folder.getChildren().size() + ")";
+        }
+
+        // Default
+        return element.toString();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof SchemaWrapper )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA )
+                .createImage();
+        }
+        else if ( element instanceof AttributeTypeWrapper )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE )
+                .createImage();
+        }
+        else if ( element instanceof ObjectClassWrapper )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+                .createImage();
+        }
+        else if ( element instanceof Folder )
+        {
+            Folder folder = ( Folder ) element;
+            
+            switch ( folder.getType() )
+            {
+                case ATTRIBUTE_TYPE:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_FOLDER_AT )
+                    .createImage();
+                case OBJECT_CLASS:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_FOLDER_OC )
+                    .createImage();
+                case NONE:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_FOLDER )
+                    .createImage();
+            }
+        }
+
+        // Default
+        return null;
+    }
+}

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

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.wrappers;
+
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+
+
+/**
+ * This class is used to wrap an AttributeType in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeWrapper extends AbstractTreeNode
+{
+    /** The wrapped AttributeType */
+    private AttributeType attributeType;
+
+
+    /**
+     * Creates a new instance of AttributeTypeWrapper.
+     *
+     * @param at
+     *      the wrapped AttributeType
+     */
+    public AttributeTypeWrapper( AttributeType at )
+    {
+        super( null );
+        attributeType = at;
+    }
+
+
+    /**
+     * Creates a new instance of AttributeTypeWrapper.
+     * 
+     * @param at
+     *      the wrapped AttributeType
+     * @param parent
+     *      the parent TreeNode
+     */
+    public AttributeTypeWrapper( AttributeType at, TreeNode parent )
+    {
+        super( parent );
+        attributeType = at;
+    }
+
+
+    /**
+     * Gets the wrapped AttributeType.
+     *
+     * @return
+     *      the wrapped AttributeType
+     */
+    public AttributeType getAttributeType()
+    {
+        return attributeType;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AbstractTreeNode#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        return false;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/Folder.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,98 @@
+package org.apache.directory.studio.apacheds.schemaeditor.view.wrappers;
+
+
+/**
+ * This used to represent a folder in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Folder extends AbstractTreeNode
+{
+    /**
+     * This enum represents the different types of folders.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    public enum FolderType
+    {
+        NONE, ATTRIBUTE_TYPE, OBJECT_CLASS
+    }
+
+    /** The type of the Folder */
+    private FolderType type = FolderType.NONE;
+
+    /** The name of the Folder */
+    private String name = "";
+    
+    private static final String NAME_AT = "Attribute Types";
+    private static final String NAME_OC = "Object Classes";
+
+
+    /**
+     * Creates a new instance of Folder.
+     *
+     * @param type
+     *      the type of the Folder
+     * @param parent
+     *      the parent TreeNode
+     */
+    public Folder( FolderType type, TreeNode parent )
+    {
+        super( parent );
+        this.type = type;
+        
+        switch ( type )
+        {
+            case ATTRIBUTE_TYPE:
+                name = NAME_AT;
+                break;
+            case OBJECT_CLASS:
+                name = NAME_OC;
+                break;
+        }
+    }
+
+
+    /**
+     * Creates a new instance of Folder.
+     *
+     * @param type
+     *      the type of the Folder
+     * @param name
+     *      the name of the Folder
+     * @param parent
+     *      the parent TreeNode
+     */
+    public Folder( FolderType type, String name, TreeNode parent )
+    {
+        super( parent );
+        this.type = type;
+        this.name = name;
+    }
+
+
+    /**
+     * Get the type of the Folder.
+     *
+     * @return
+     *      the type of the Folder
+     */
+    public FolderType getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * Gets the name of the Folder.
+     * 
+     * @return
+     *      the name of the Folder
+     */
+    public String getName()
+    {
+        return name;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.wrappers;
+
+
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+
+
+/**
+ * This class is used to wrap an ObjectClass in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassWrapper extends AbstractTreeNode
+{
+    /** The wrapped ObjectClass */
+    private ObjectClass objectClass;
+
+
+    /**
+     * Creates a new instance of ObjectClassWrapper.
+     *
+     * @param oc
+     *      the wrapped ObjectClass
+     */
+    public ObjectClassWrapper( ObjectClass oc )
+    {
+        super( null );
+        objectClass = oc;
+    }
+
+
+    /**
+     * Creates a new instance of ObjectClassWrapper.
+     * 
+     * @param at
+     *      the wrapped ObjectClass
+     * @param parent
+     *      the parent TreeNode
+     */
+    public ObjectClassWrapper( ObjectClass oc, TreeNode parent )
+    {
+        super( parent );
+        objectClass = oc;
+    }
+
+
+    /**
+     * Gets the wrapped ObjectClass.
+     *
+     * @return
+     *      the wrapped ObjectClass
+     */
+    public ObjectClass getObjectClass()
+    {
+        return objectClass;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AbstractTreeNode#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        return false;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java?view=auto&rev=548363
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/SchemaViewRoot.java Mon Jun 18 07:05:06 2007
@@ -0,0 +1,13 @@
+
+package org.apache.directory.studio.apacheds.schemaeditor.view.wrappers;
+
+public class SchemaViewRoot extends AbstractTreeNode
+{
+    /**
+     * Creates a new instance of SchemaViewRoot.
+     */
+    public SchemaViewRoot()
+    {
+        super( null );
+    }
+}



Mime
View raw message