You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/11/16 17:05:29 UTC

svn commit: r475786 [6/13] - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin: ./ META-INF/ icons/ ressources/ ressources/help/ ressources/help/html/ ressources/help/html/concepts/ ressources/help/html/concepts/images/ ressources/h...

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/ressources/utils/syntaxes.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/ressources/utils/syntaxes.xml?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/ressources/utils/syntaxes.xml (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/ressources/utils/syntaxes.xml Thu Nov 16 08:05:20 2006
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<syntaxes>
+	<syntax>
+		<name>ACI Item</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.1</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Access Point</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.2</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Attribute Type Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.3</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Audio</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.4</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Binary</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.5</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Bit String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.6</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Boolean</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.7</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Certificate</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.8</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Certificate List</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.9</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Certificate Pair</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.10</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Country String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.11</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DN</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.12</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Data Quality Syntax</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.13</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Delivery Method</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.14</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Directory String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.15</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DIT Content Rule Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.16</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DIT Structure Rule Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.17</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DL Submit Permission</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.18</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DSA Quality Syntax</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.19</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>DSE Type</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.20</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Enhanced Guide</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.21</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Facsimile Telephone Number</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.22</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Fax</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.23</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Generalized Time</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.24</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Guide</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.25</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>IA5 String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.26</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>INTEGER</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.27</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>JPEG</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.28</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>LDAP Syntax Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.54</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>LDAP Schema Definition</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.56</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>LDAP Schema Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.57</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Master And Shadow Access Points</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.29</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Matching Rule Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.30</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Description Rule Use Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.31</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Mail Preference</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.32</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>MHS OR Address</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.33</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Modify Rights</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.55</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Name And Optionnal UID</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.34</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Name Form Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.35</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Numeric String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.36</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Object Class Description</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.37</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Octet String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.40</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>OID</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.38</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Other Mailbox</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.39</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Postal Address</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.41</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Protocol Information</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.42</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Presentation Address</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.43</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Printable String</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.44</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Substring Assertion</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.58</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Subtree Specification</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.45</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Supplier Information</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.46</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Supplier Or Consumer</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.47</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Supplier And Consumer</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.48</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Supportd Algorithm</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.49</oid>
+		<hr>N</hr>
+	</syntax>
+	<syntax>
+		<name>Telephone Number</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.50</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Teletex Terminal Identifier</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.51</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>Telex Number</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.52</oid>
+		<hr>Y</hr>
+	</syntax>
+	<syntax>
+		<name>UTC Time</name>
+		<oid>1.3.6.1.4.1.1466.115.121.1.53</oid>
+		<hr>Y</hr>
+	</syntax>
+</syntaxes>
\ No newline at end of file

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/Activator.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/Activator.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/Activator.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,91 @@
+/*
+ *  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;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemaPreferencePage;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin
+{
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.schemas"; //$NON-NLS-1$
+
+    // The shared instance
+    private static Activator plugin;
+
+
+    /**
+     * The constructor
+     */
+    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
+    {
+        // save workspace configuration
+        IEclipsePreferences prefs = new ConfigurationScope().getNode( Application.PLUGIN_ID );
+        boolean save_workspace = prefs.getBoolean( SchemaPreferencePage.SAVE_WORKSPACE, true );
+        if ( save_workspace )
+            SchemaPool.getInstance().savePool();
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/Application.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/Application.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/Application.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/Application.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller;
+
+
+public class Application
+{
+    public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.schemas"; //$NON-NLS-1$
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchicalViewerController.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller;
+
+
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchicalViewer;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.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;
+
+
+public class HierarchicalViewerController implements IDoubleClickListener
+{
+    private static Logger logger = Logger.getLogger( HierarchicalViewerController.class );
+    private static final HierarchicalViewerController instance_;
+
+    // Static thread-safe singleton initializer
+    static
+    {
+        try
+        {
+            instance_ = new HierarchicalViewerController();
+        }
+        catch ( Throwable e )
+        {
+            throw new RuntimeException( e.getMessage() );
+        }
+    }
+
+
+    //Prevent direct access to the constructor
+    private HierarchicalViewerController()
+    {
+    }
+
+
+    /**
+     * Use this method to get the singleton instance of the controller
+     * @return
+     */
+    public static HierarchicalViewerController getInstance()
+    {
+        return instance_;
+    }
+
+
+    public void doubleClick( DoubleClickEvent event )
+    {
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+        HierarchicalViewer view = ( HierarchicalViewer ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+            .getActivePage().findView( HierarchicalViewer.ID );
+        TreeViewer viewer = view.getViewer();
+
+        // What we get from the treeViewer is a StructuredSelection
+        StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+        // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+        Object objectSelection = selection.getFirstElement();
+        IEditorInput input = null;
+        String editorId = null;
+
+        // Selecting the right editor and input
+        if ( objectSelection instanceof AttributeTypeWrapper )
+        {
+            input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection ).getMyAttributeType() );
+            editorId = AttributeTypeFormEditor.ID;
+        }
+        else if ( objectSelection instanceof ObjectClassWrapper )
+        {
+            input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
+            editorId = ObjectClassFormEditor.ID;
+        }
+        else if ( objectSelection instanceof IntermediateNode )
+        {
+            // Here we don't open an editor, we just expand the node.
+            viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
+        }
+
+        // Let's open the editor
+        if ( input != null )
+        {
+            try
+            {
+                page.openEditor( input, editorId );
+            }
+            catch ( PartInitException e )
+            {
+                logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+            }
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/ICommandIds.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/ICommandIds.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/ICommandIds.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/ICommandIds.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller;
+
+
+/**
+ * Interface defining the application's command IDs.
+ * Key bindings can be defined for specific commands.
+ * To associate an action with a command, use IAction.setActionDefinitionId(commandId).
+ *
+ * @see org.eclipse.jface.action.IAction#setActionDefinitionId(String)
+ */
+public interface ICommandIds
+{
+    public static final String CMD_DELETE = Application.PLUGIN_ID + ".delete"; //$NON-NLS-1$
+    public static final String CMD_OPEN_LOCAL = Application.PLUGIN_ID + ".openlocal"; //$NON-NLS-1$
+    public static final String CMD_OPEN_SCHEMA_SOURCE_CODE = Application.PLUGIN_ID + ".openschemasourcecode"; //$NON-NLS-1$
+    public static final String CMD_SAVE = Application.PLUGIN_ID + ".save"; //$NON-NLS-1$
+    public static final String CMD_SAVE_AS = Application.PLUGIN_ID + ".saveas"; //$NON-NLS-1$
+    public static final String CMD_SAVE_ALL = Application.PLUGIN_ID + ".saveall"; //$NON-NLS-1$
+    public static final String CMD_REMOVE_SCHEMA = Application.PLUGIN_ID + ".removeschema"; //$NON-NLS-1$
+    public static final String CMD_CREATE_A_NEW_SCHEMA = Application.PLUGIN_ID + ".createanewschema"; //$NON-NLS-1$
+    public static final String CMD_CREATE_A_NEW_OBJECTCLASS = Application.PLUGIN_ID + ".createanewobjectclass"; //$NON-NLS-1$
+    public static final String CMD_CREATE_A_NEW_ATTRIBUTETYPE = Application.PLUGIN_ID + ".createanewattributetype"; //$NON-NLS-1$
+    public static final String CMD_SORT_HIERACHICAL_VIEWER = Application.PLUGIN_ID + ".sorthierarchicalviewer"; //$NON-NLS-1$
+    public static final String CMD_SORT_POOL_MANAGER = Application.PLUGIN_ID + ".sortpoolmanager"; //$NON-NLS-1$
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,286 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewAttributeTypeAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewObjectClassAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewSchemaAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.DeleteAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSchemaSourceCode;
+import org.apache.directory.ldapstudio.schemas.controller.actions.RemoveSchemaAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAsAction;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaCreationException;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.model.Schema.SchemaType;
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.DropTargetListener;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+public class PoolManagerController implements IMenuListener, IDoubleClickListener, DropTargetListener
+{
+    private static Logger logger = Logger.getLogger( PoolManagerController.class );
+    private static final PoolManagerController instance_;
+    private final static FileTransfer fileTransfer = FileTransfer.getInstance();
+
+    //Static thread-safe singleton initializer
+    static
+    {
+        try
+        {
+            instance_ = new PoolManagerController();
+        }
+        catch ( Throwable e )
+        {
+            throw new RuntimeException( e.getMessage() );
+        }
+    }
+
+
+    /**
+     * Use this method to get the singleton instance of the controller
+     * @return
+     */
+    public static PoolManagerController getInstance()
+    {
+        return instance_;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+     */
+    public void menuAboutToShow( IMenuManager manager )
+    {
+        CreateANewSchemaAction createANewSchemaAction = new CreateANewSchemaAction();
+        CreateANewObjectClassAction createANewObjectClassAction = new CreateANewObjectClassAction();
+        CreateANewAttributeTypeAction createANewAttributeTypeAction = new CreateANewAttributeTypeAction();
+        DeleteAction deleteAction = new DeleteAction();
+        OpenSchemaSourceCode openSchemaSourceCode = new OpenSchemaSourceCode( PlatformUI.getWorkbench()
+            .getActiveWorkbenchWindow(), "View source code" ); //$NON-NLS-1$
+        SaveAction saveAction = new SaveAction();
+        SaveAsAction saveAsAction = new SaveAsAction();
+        RemoveSchemaAction removeSchemaAction = new RemoveSchemaAction();
+
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
+
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        if ( selection instanceof SchemaWrapper )
+        {
+            Schema schema = ( ( SchemaWrapper ) selection ).getMySchema();
+            if ( schema.type == SchemaType.coreSchema )
+            {
+                manager.add( saveAsAction );
+                manager.add( new Separator() );
+                manager.add( openSchemaSourceCode );
+            }
+            else if ( schema.type == SchemaType.userSchema )
+            {
+                manager.add( createANewObjectClassAction );
+                manager.add( createANewAttributeTypeAction );
+                manager.add( new Separator() );
+                manager.add( saveAction );
+                manager.add( saveAsAction );
+                manager.add( removeSchemaAction );
+                manager.add( new Separator() );
+                manager.add( openSchemaSourceCode );
+            }
+        }
+        else if ( selection instanceof IntermediateNode )
+        {
+            if ( ( ( IntermediateNode ) selection ).getDisplayName().equals( "Attribute Types" ) ) { //$NON-NLS-1$
+                manager.add( createANewAttributeTypeAction );
+            }
+            else if ( ( ( IntermediateNode ) selection ).getDisplayName().equals( "Object Classes" ) ) { //$NON-NLS-1$
+                manager.add( createANewObjectClassAction );
+            }
+        }
+        else if ( ( selection instanceof AttributeTypeWrapper ) )
+        {
+            manager.add( deleteAction );
+            manager.add( new Separator() );
+            manager.add( createANewAttributeTypeAction );
+        }
+        else if ( ( selection instanceof ObjectClassWrapper ) )
+        {
+            manager.add( deleteAction );
+            manager.add( new Separator() );
+            manager.add( createANewObjectClassAction );
+        }
+        else
+        {
+            // Nothing is selected
+            if ( selection == null )
+            {
+                manager.add( createANewSchemaAction );
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+     */
+    public void doubleClick( DoubleClickEvent event )
+    {
+        // TODO : /!\ Essayer de factoriser le code commun � la fenetre de vue hierarchique dans une classe abstraite
+
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( PoolManager.ID );
+        TreeViewer viewer = view.getViewer();
+
+        // What we get from the treeViewer is a StructuredSelection
+        StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+        // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+        Object objectSelection = selection.getFirstElement();
+        IEditorInput input = null;
+        String editorId = null;
+
+        // Selecting the right editor and input
+        if ( objectSelection instanceof AttributeTypeWrapper )
+        {
+            input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection ).getMyAttributeType() );
+            editorId = AttributeTypeFormEditor.ID;
+        }
+        else if ( objectSelection instanceof ObjectClassWrapper )
+        {
+            input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
+            editorId = ObjectClassFormEditor.ID;
+        }
+        else if ( ( objectSelection instanceof IntermediateNode ) || ( 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$
+            }
+        }
+    }
+
+
+    /******************************************
+     *         DropTargetListener Impl        *
+     ******************************************/
+
+    public void dragEnter( DropTargetEvent event )
+    {
+        if ( ( event.operations & DND.DROP_COPY ) != 0 )
+        {
+            event.detail = DND.DROP_COPY;
+        }
+        else
+        {
+            event.detail = DND.DROP_NONE;
+        }
+
+        //we only want files
+        for ( int i = 0; i < event.dataTypes.length; i++ )
+        {
+            if ( fileTransfer.isSupportedType( event.dataTypes[i] ) )
+            {
+                event.currentDataType = event.dataTypes[i];
+                break;
+            }
+        }
+    }
+
+
+    public void dragOver( DropTargetEvent event )
+    {
+    }
+
+
+    public void dragOperationChanged( DropTargetEvent event )
+    {
+    }
+
+
+    public void dragLeave( DropTargetEvent event )
+    {
+    }
+
+
+    public void dropAccept( DropTargetEvent event )
+    {
+    }
+
+
+    public void drop( DropTargetEvent event )
+    {
+        if ( fileTransfer.isSupportedType( event.currentDataType ) )
+        {
+            SchemaPool pool = SchemaPool.getInstance();
+            String[] files = ( String[] ) event.data;
+            for ( int i = 0; i < files.length; i++ )
+            {
+                try
+                {
+                    pool.addAlreadyExistingSchema( files[i], SchemaType.userSchema );
+                }
+                catch ( SchemaCreationException e )
+                {
+                    logger.debug( "error when initializing new schema after drag&drop: " + files[i] ); //$NON-NLS-1$
+                }
+            }
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PreferenceInitializer.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller;
+
+
+import org.apache.directory.ldapstudio.schemas.view.preferences.GeneralPreferencePage;
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemaPreferencePage;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer
+{
+
+    public PreferenceInitializer()
+    {
+        super();
+    }
+
+
+    @Override
+    public void initializeDefaultPreferences()
+    {
+        IEclipsePreferences defaults = new DefaultScope().getNode( Application.PLUGIN_ID );
+        defaults.put( GeneralPreferencePage.COMPANY_OID, "1.2.3.4.5.6" ); //$NON-NLS-1$
+        defaults.putBoolean( GeneralPreferencePage.AUTO_OID, true );
+        defaults.put( SchemaPreferencePage.DEFAULT_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
+        defaults.putBoolean( SchemaPreferencePage.SAVE_WORKSPACE, true );
+        defaults.putBoolean( SchemaPreferencePage.SPECIFIC_CORE, false );
+        defaults.put( SchemaPreferencePage.SPECIFIC_CORE_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,168 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewAttributeTypeWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for creating a new attribute type
+ */
+public class CreateANewAttributeTypeAction extends Action implements IWorkbenchWindowActionDelegate,
+    IViewActionDelegate
+{
+
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public CreateANewAttributeTypeAction()
+    {
+        setText( Messages.getString( "CreateANewAttributeTypeAction.Create_a_new_attribute_type" ) ); //$NON-NLS-1$
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_CREATE_A_NEW_ATTRIBUTETYPE );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_CREATE_A_NEW_ATTRIBUTETYPE );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+            IImageKeys.CREATE_A_NEW_ATTRIBUTETYPE ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        String schemaName = null;
+
+        // We have to check on which node we are to get the schema name
+        if ( selection instanceof SchemaWrapper )
+        {
+            schemaName = ( ( SchemaWrapper ) selection ).getName();
+        }
+        else if ( selection instanceof AttributeTypeWrapper )
+        {
+            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+        }
+        else if ( selection instanceof ObjectClassWrapper )
+        {
+            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+        }
+        else if ( selection instanceof IntermediateNode )
+        {
+            schemaName = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getName();
+        }
+
+        if ( schemaName == null )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox.setMessage( Messages.getString( "CreateANewAttributeTypeAction.A_schema_must_be_selected" ) ); //$NON-NLS-1$
+            messageBox.open();
+        }
+        else
+        {
+            //Getting the SchemaPool
+            SchemaPool pool = SchemaPool.getInstance();
+            // Getting the right schema
+            Schema schema = pool.getSchema( schemaName );
+
+            // Check if the schema isn't a core schema (core schema can't be modified
+            if ( schema.type == Schema.SchemaType.coreSchema )
+            {
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+                messageBox
+                    .setMessage( Messages.getString( "CreateANewAttributeTypeAction.The_schema" ) + schemaName + Messages.getString( "CreateANewAttributeTypeAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                messageBox.open();
+            }
+            else
+            {
+                // Instantiates and initializes the wizard
+                CreateANewAttributeTypeWizard wizard = new CreateANewAttributeTypeWizard( schemaName );
+                wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+                // Instantiates the wizard container with the wizard and opens it
+                WizardDialog dialog = new WizardDialog(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+                dialog.create();
+                dialog.open();
+            }
+        }
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,167 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewObjectClassWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for creating a new object class
+ */
+public class CreateANewObjectClassAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+{
+
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public CreateANewObjectClassAction()
+    {
+        setText( Messages.getString( "CreateANewObjectClassAction.Create_a_new_object_class" ) ); //$NON-NLS-1$
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_CREATE_A_NEW_OBJECTCLASS );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_CREATE_A_NEW_OBJECTCLASS );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+            IImageKeys.CREATE_A_NEW_OBJECTCLASS ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        String schemaName = null;
+
+        // We have to check on which node we are to get the schema name
+        if ( selection instanceof SchemaWrapper )
+        {
+            schemaName = ( ( SchemaWrapper ) selection ).getName();
+        }
+        else if ( selection instanceof AttributeTypeWrapper )
+        {
+            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+        }
+        else if ( selection instanceof ObjectClassWrapper )
+        {
+            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+        }
+        else if ( selection instanceof IntermediateNode )
+        {
+            schemaName = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getName();
+        }
+
+        if ( schemaName == null )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox.setMessage( Messages.getString( "CreateANewObjectClassAction.A_schema_must_be_selected" ) ); //$NON-NLS-1$
+            messageBox.open();
+        }
+        else
+        {
+            // Getting the SchemaPool
+            SchemaPool pool = SchemaPool.getInstance();
+            // Getting the right schema
+            Schema schema = pool.getSchema( schemaName );
+
+            // Check if the schema isn't a core schema (core schema can't be modified
+            if ( schema.type == Schema.SchemaType.coreSchema )
+            {
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+                messageBox
+                    .setMessage( Messages.getString( "CreateANewObjectClassAction.The_schema" ) + schemaName + Messages.getString( "CreateANewObjectClassAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                messageBox.open();
+            }
+            else
+            {
+                // Instantiates and initializes the wizard
+                CreateANewObjectClassWizard wizard = new CreateANewObjectClassWizard( schemaName );
+                wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+                // Instantiates the wizard container with the wizard and opens it
+                WizardDialog dialog = new WizardDialog(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+                dialog.create();
+                dialog.open();
+            }
+        }
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewSchemaWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for creating a new schema
+ */
+
+public class CreateANewSchemaAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+{
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public CreateANewSchemaAction()
+    {
+        setText( Messages.getString( "CreateANewSchemaAction.Create_a_new_schema" ) ); //$NON-NLS-1$
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_CREATE_A_NEW_SCHEMA );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_CREATE_A_NEW_SCHEMA );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID,
+            IImageKeys.CREATE_A_NEW_SCHEMA ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        CreateANewSchemaWizard wizard = new CreateANewSchemaWizard();
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,213 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for deleting an element (object class or attribute type)
+ */
+public class DeleteAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+{
+    private static Logger logger = Logger.getLogger( DeleteAction.class );
+
+    private enum ItemType
+    {
+        attributeType, objectClass
+    };
+
+
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public DeleteAction()
+    {
+        setText( Messages.getString( "DeleteAction.Delete_the_selected_item" ) ); //$NON-NLS-1$
+
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_DELETE );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_DELETE );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.DELETE ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        String schemaName = null;
+        ItemType item = null;
+
+        if ( selection instanceof AttributeTypeWrapper )
+        {
+            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+            item = DeleteAction.ItemType.attributeType;
+        }
+        else if ( selection instanceof ObjectClassWrapper )
+        {
+            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+            item = DeleteAction.ItemType.objectClass;
+        }
+
+        if ( schemaName == null )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox.setMessage( Messages.getString( "DeleteAction.This_item_cant_be_deleted" ) ); //$NON-NLS-1$
+            messageBox.open();
+        }
+        else
+        {
+            // Getting the SchemaPool
+            SchemaPool pool = SchemaPool.getInstance();
+            // Getting the right schema
+            Schema schema = pool.getSchema( schemaName );
+
+            // Check if the schema isn't a core schema (core schema can't be modified
+            if ( schema.type == Schema.SchemaType.coreSchema )
+            {
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+                messageBox
+                    .setMessage( Messages.getString( "DeleteAction.The_schema" ) + schemaName + Messages.getString( "DeleteAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                messageBox.open();
+            }
+            else
+            {
+                if ( item == DeleteAction.ItemType.attributeType )
+                {
+                    AttributeType attributeType = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType();
+                    MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                        .getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION );
+                    messageBox
+                        .setMessage( Messages
+                            .getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_attribute_type" ) + attributeType.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                    if ( messageBox.open() == SWT.OK )
+                    {
+                        schema.removeAttributeType( attributeType );
+                    }
+                }
+                else if ( item == DeleteAction.ItemType.objectClass )
+                {
+                    ObjectClass objectClass = ( ( ObjectClassWrapper ) selection ).getMyObjectClass();
+                    MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                        .getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION );
+                    messageBox
+                        .setMessage( Messages
+                            .getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_object_class" ) + objectClass.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                    if ( messageBox.open() == SWT.OK )
+                    {
+
+                        //try to close the associated editors before deleting the objectClass
+                        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                        IEditorReference[] editorReferences = page.getEditorReferences();
+                        for ( IEditorReference reference : editorReferences )
+                        {
+                            try
+                            {
+                                if ( reference.getEditorInput() instanceof ObjectClassFormEditorInput )
+                                {
+                                    ObjectClassFormEditorInput input = ( ObjectClassFormEditorInput ) reference
+                                        .getEditorInput();
+                                    if ( input.getObjectClass().equals( objectClass ) )
+                                    {
+                                        page.closeEditor( reference.getEditor( false ), false );
+                                    }
+                                }
+                            }
+                            catch ( PartInitException e )
+                            {
+                                logger.debug( "error when closing associated editors" ); //$NON-NLS-1$
+                            }
+                        }
+                        //delete the objectClass
+                        schema.removeObjectClass( objectClass );
+                    }
+                }
+            }
+        }
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/Messages.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/Messages.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/Messages.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/Messages.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.directory.ldapstudio.schemas.controller.actions.messages"; //$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+    private Messages()
+    {
+    }
+
+
+    public static String getString( String key )
+    {
+        try
+        {
+            return RESOURCE_BUNDLE.getString( key );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java Thu Nov 16 08:05:20 2006
@@ -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.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.model.Schema.SchemaType;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.preferences.SchemaPreferencePage;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for opening a local file schema
+ */
+public class OpenLocalFileAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+{
+    private static Logger logger = Logger.getLogger( OpenLocalFileAction.class );
+
+
+    public OpenLocalFileAction()
+    {
+        setText( Messages.getString( "OpenLocalFileAction.Open_a_schema_file" ) ); //$NON-NLS-1$
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_OPEN_LOCAL );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_OPEN_LOCAL );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.OPEN_LOCAL ) );
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void run()
+    {
+        FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN );
+        fd.setText( Messages.getString( "OpenLocalFileAction.Open_a_schema_file" ) ); //$NON-NLS-1$
+
+        IEclipsePreferences prefs = new ConfigurationScope().getNode( Application.PLUGIN_ID );
+        String defaultPath = prefs.get( SchemaPreferencePage.DEFAULT_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
+        fd.setFilterPath( defaultPath );
+        String[] filterExt =
+            { "*.schema", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+        fd.setFilterExtensions( filterExt );
+        String selected = fd.open();
+        // selected == null if 'cancel' has been pushed
+        if ( selected != null )
+        {
+            SchemaPool pool = SchemaPool.getInstance();
+            try
+            {
+                pool.addAlreadyExistingSchema( selected, SchemaType.userSchema );
+            }
+            catch ( Exception e )
+            {
+                logger.debug( "Error when opening a schema file" ); //$NON-NLS-1$
+            }
+        }
+
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for deleting an element (object class or attribute type)
+ */
+@SuppressWarnings("unused")//$NON-NLS-1$
+public class OpenSchemaSourceCode extends Action
+{
+    private static Logger logger = Logger.getLogger( OpenSchemaSourceCode.class );
+    private final IWorkbenchWindow window;
+
+
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public OpenSchemaSourceCode( IWorkbenchWindow window, String label )
+    {
+        this.window = window;
+        setText( label );
+
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_OPEN_SCHEMA_SOURCE_CODE );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_OPEN_SCHEMA_SOURCE_CODE );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.SCHEMA ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( PoolManager.ID );
+
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        if ( selection instanceof SchemaWrapper )
+        {
+            SchemaWrapper schemaWrapper = ( SchemaWrapper ) selection;
+            try
+            {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                page.openEditor( new SchemaFormEditorInput( schemaWrapper.getMySchema() ), SchemaFormEditor.ID );
+            }
+            catch ( PartInitException e )
+            {
+                logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+            }
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,155 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.controller.actions;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Action for removing a schema from the pool
+ */
+public class RemoveSchemaAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+{
+
+    /**
+     * Default constructor
+     * @param window
+     * @param label
+     */
+    public RemoveSchemaAction()
+    {
+        setText( Messages.getString( "RemoveSchemaAction.Remove_the_selected_schema" ) ); //$NON-NLS-1$
+        // The id is used to refer to the action in a menu or toolbar
+        setId( ICommandIds.CMD_REMOVE_SCHEMA );
+        // Associate the action with a pre-defined command, to allow key bindings.
+        setActionDefinitionId( ICommandIds.CMD_REMOVE_SCHEMA );
+        setImageDescriptor( AbstractUIPlugin
+            .imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.REMOVE_SCHEMA ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
+        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+        String schemaName = null;
+
+        // We have to check on which node we are to get the schema name
+        if ( selection instanceof SchemaWrapper )
+        {
+            schemaName = ( ( SchemaWrapper ) selection ).getName();
+        }
+        else if ( selection instanceof AttributeTypeWrapper )
+        {
+            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+        }
+        else if ( selection instanceof ObjectClassWrapper )
+        {
+            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
+            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+        }
+
+        if ( schemaName != null )
+        {
+            // Getting the SchemaPool
+            SchemaPool pool = SchemaPool.getInstance();
+            // Getting the right schema
+            Schema schema = pool.getSchema( schemaName );
+
+            if ( schema.type == Schema.SchemaType.coreSchema )
+            {
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+                messageBox
+                    .setMessage( Messages.getString( "RemoveSchemaAction.The_schema" ) + schemaName + Messages.getString( "RemoveSchemaAction.Is_a_core_schema_It_cant_be_removed_from_the_pool" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                messageBox.open();
+                return;
+            }
+            if ( schema.hasBeenModified() || schema.hasPendingModification() )
+            {
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.CANCEL
+                        | SWT.ICON_QUESTION );
+                messageBox.setMessage( Messages
+                    .getString( "RemoveSchemaAction.This_schema_has_been_modified_or_has_pending_modifications" ) ); //$NON-NLS-1$
+                if ( messageBox.open() == SWT.OK )
+                {
+                    pool.removeSchema( schema );
+                }
+            }
+            else
+                pool.removeSchema( schema );
+        }
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void init( IViewPart view )
+    {
+    }
+}