directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592094 [5/35] - in /directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/ma...
Date Mon, 05 Nov 2007 17:15:02 GMT
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportProjectsAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportProjectsAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportProjectsAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,132 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.view.wizards.ExportProjectsWizard;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectWrapper;
+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.TableViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ExportProjectsWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportProjectsAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TableViewer viewer;
+
+
+    /**
+     * Creates a new instance of NewProjectAction.
+     */
+    public ExportProjectsAction( TableViewer viewer )
+    {
+        super( "Schema Projects" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_EXPORT_PROJECTS );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_PROJECT_EXPORT ) );
+        setEnabled( true );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        List<Project> selectedProjects = new ArrayList<Project>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                selectedProjects.add( ( ( ProjectWrapper ) i.next() ).getProject() );
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        ExportProjectsWizard wizard = new ExportProjectsWizard();
+        wizard.setSelectedProjects( selectedProjects.toArray( new Project[0] ) );
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportProjectsAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,136 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasAsOpenLdapWizard;
+import org.apache.directory.studio.schemaeditor.view.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.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ExportSchemasAsOpenLdapWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSchemasAsOpenLdapAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of ExportSchemasAsOpenLdapAction.
+     */
+    public ExportSchemasAsOpenLdapAction( TreeViewer viewer )
+    {
+        super( "Schemas as OpenLDAP files" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_EXPORT_SCHEMAS_AS_OPENLDAP );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMAS_EXPORT ) );
+        setEnabled( true );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        List<Schema> selectedSchemas = new ArrayList<Schema>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                Object o = i.next();
+                if ( o instanceof SchemaWrapper )
+                {
+                    selectedSchemas.add( ( ( SchemaWrapper ) o ).getSchema() );
+                }
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        ExportSchemasAsOpenLdapWizard wizard = new ExportSchemasAsOpenLdapWizard();
+        wizard.setSelectedSchemas( selectedSchemas.toArray( new Schema[0] ) );
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,136 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasAsXmlWizard;
+import org.apache.directory.studio.schemaeditor.view.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.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ExportSchemasAsXmlWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSchemasAsXmlAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of ExportSchemasAsXmlAction.
+     */
+    public ExportSchemasAsXmlAction( TreeViewer viewer )
+    {
+        super( "Schemas as XML file(s)" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_EXPORT_SCHEMAS_AS_XML );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMAS_EXPORT ) );
+        setEnabled( true );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        List<Schema> selectedSchemas = new ArrayList<Schema>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                Object o = i.next();
+                if ( o instanceof SchemaWrapper )
+                {
+                    selectedSchemas.add( ( ( SchemaWrapper ) o ).getSchema() );
+                }
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        ExportSchemasAsXmlWizard wizard = new ExportSchemasAsXmlWizard();
+        wizard.setSelectedSchemas( selectedSchemas.toArray( new Schema[0] ) );
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasForADSAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasForADSAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasForADSAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasForADSAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,136 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasForADSWizard;
+import org.apache.directory.studio.schemaeditor.view.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.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ExportSchemasAsXmlWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSchemasForADSAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of ExportSchemasAsXmlAction.
+     */
+    public ExportSchemasForADSAction( TreeViewer viewer )
+    {
+        super( "Schemas for Apache DS" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_EXPORT_SCHEMAS_FOR_ADS );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMAS_EXPORT_FOR_ADS ) );
+        setEnabled( true );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        List<Schema> selectedSchemas = new ArrayList<Schema>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                Object o = i.next();
+                if ( o instanceof SchemaWrapper )
+                {
+                    selectedSchemas.add( ( ( SchemaWrapper ) o ).getSchema() );
+                }
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        ExportSchemasForADSWizard wizard = new ExportSchemasForADSWizard();
+        wizard.setSelectedSchemas( selectedSchemas.toArray( new Schema[0] ) );
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ExportSchemasForADSAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportProjectsAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportProjectsAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportProjectsAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.ImportProjectsWizard;
+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.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ImportProjectsWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ImportProjectsAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of ImportProjectsAction.
+     */
+    public ImportProjectsAction()
+    {
+        super( "Schema Projects" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_IMPORT_PROJECTS );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_PROJECT_IMPORT ) );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        ImportProjectsWizard wizard = new ImportProjectsWizard();
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportProjectsAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.ImportSchemasFromOpenLdapWizard;
+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.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ImportSchemasFromOpenLdapWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ImportSchemasFromOpenLdapAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of ImportSchemasFromOpenLdapAction.
+     */
+    public ImportSchemasFromOpenLdapAction()
+    {
+        super( "Schemas from OpenLDAP files" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_IMPORT_SCHEMAS_FROM_OPENLDAP );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMAS_IMPORT ) );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        ImportSchemasFromOpenLdapWizard wizard = new ImportSchemasFromOpenLdapWizard();
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.ImportSchemasFromXmlWizard;
+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.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the ImportSchemasFromXmlWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ImportSchemasFromXmlAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of ImportSchemasFromXmlAction.
+     */
+    public ImportSchemasFromXmlAction()
+    {
+        super( "Schemas from XML file(s)" );
+        setToolTipText( getText() );
+        setId( PluginConstants.CMD_IMPORT_SCHEMAS_FROM_XML );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMAS_IMPORT ) );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        ImportSchemasFromXmlWizard wizard = new ImportSchemasFromXmlWizard();
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorHierarchyViewAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorHierarchyViewAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorHierarchyViewAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorHierarchyViewAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,215 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.views.HierarchyView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Link With Editor Action for the Hierarchy View
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LinkWithEditorHierarchyViewAction extends Action
+{
+    /** The String for storing the checked state of the action */
+    private static final String LINK_WITH_EDITOR_HIERARCHY_VIEW_DS_KEY = LinkWithEditorHierarchyViewAction.class
+        .getName()
+        + ".dialogsettingkey"; //$NON-NLS-1$
+
+    /** The associated view */
+    private HierarchyView view;
+
+    /** The listener listening on changes on editors */
+    private IPartListener2 editorListener = new IPartListener2()
+    {
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partVisible( IWorkbenchPartReference partRef )
+        {
+            IWorkbenchPart part = partRef.getPart( true );
+
+            if ( part instanceof ObjectClassEditor )
+            {
+                linkViewWithEditor( ( ( ObjectClassEditor ) part ).getOriginalObjectClass() );
+            }
+            else if ( part instanceof AttributeTypeEditor )
+            {
+                linkViewWithEditor( ( ( AttributeTypeEditor ) part ).getOriginalAttributeType() );
+            }
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partActivated( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partClosed( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partDeactivated( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partHidden( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partInputChanged( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partOpened( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partBroughtToTop( IWorkbenchPartReference partRef )
+        {
+        }
+    };
+
+
+    /**
+     * Creates a new instance of LinkWithEditorSchemasView.
+     *
+     * @param view
+     *      the associated view
+     */
+    public LinkWithEditorHierarchyViewAction( HierarchyView view )
+    {
+        super( "Lin&k with Editor", AS_CHECK_BOX );
+        setToolTipText( "Link with Editor" );
+        setId( PluginConstants.CMD_LINK_WITH_EDITOR_HIERARCHY_VIEW );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_LINK_WITH_EDITOR ) );
+        setEnabled( true );
+        this.view = view;
+
+        // Setting up the default key value (if needed)
+        if ( Activator.getDefault().getDialogSettings().get( LINK_WITH_EDITOR_HIERARCHY_VIEW_DS_KEY ) == null )
+        {
+            Activator.getDefault().getDialogSettings().put( LINK_WITH_EDITOR_HIERARCHY_VIEW_DS_KEY, false );
+        }
+
+        // Setting state from the dialog settings
+        setChecked( Activator.getDefault().getDialogSettings().getBoolean( LINK_WITH_EDITOR_HIERARCHY_VIEW_DS_KEY ) );
+
+        // Enabling the listeners
+        if ( isChecked() )
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener( editorListener );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        setChecked( isChecked() );
+        Activator.getDefault().getDialogSettings().put( LINK_WITH_EDITOR_HIERARCHY_VIEW_DS_KEY, isChecked() );
+
+        if ( isChecked() ) // Enabling the listeners
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener( editorListener );
+
+            IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                .getActiveEditor();
+            if ( activeEditor instanceof ObjectClassEditor )
+            {
+                linkViewWithEditor( ( ( ObjectClassEditor ) activeEditor ).getOriginalObjectClass() );
+            }
+            else if ( activeEditor instanceof AttributeTypeEditor )
+            {
+                linkViewWithEditor( ( ( AttributeTypeEditor ) activeEditor ).getOriginalAttributeType() );
+            }
+        }
+        else
+        // Disabling the listeners
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().removePartListener( editorListener );
+        }
+    }
+
+
+    /**
+     * Links the view with the right editor
+     *
+     * @param schemaElement
+     *      the Schema Element
+     */
+    private void linkViewWithEditor( SchemaObject schemaElement )
+    {
+        if ( schemaElement instanceof AttributeTypeImpl )
+        {
+            view.setInput( schemaElement );
+        }
+        else if ( schemaElement instanceof ObjectClassImpl )
+        {
+            view.setInput( schemaElement );
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorHierarchyViewAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorSchemaViewAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorSchemaViewAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorSchemaViewAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorSchemaViewAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,378 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.schema.SchemaEditor;
+import org.apache.directory.studio.schemaeditor.view.views.SchemaView;
+import org.apache.directory.studio.schemaeditor.view.views.SchemaViewContentProvider;
+import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action is used to link the with the view with the frontmost editor.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LinkWithEditorSchemaViewAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The String for storing the checked state of the action */
+    private static final String LINK_WITH_EDITOR_SCHEMAS_VIEW_DS_KEY = LinkWithEditorSchemaViewAction.class.getName()
+        + ".dialogsettingkey"; //$NON-NLS-1$
+
+    /** The associated view */
+    private SchemaView view;
+
+    /** The listener listening on changes on editors */
+    private IPartListener2 editorListener = new IPartListener2()
+    {
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partVisible( IWorkbenchPartReference partRef )
+        {
+            IWorkbenchPart part = partRef.getPart( true );
+
+            if ( part instanceof ObjectClassEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( ObjectClassEditor ) part ).getOriginalObjectClass() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+            else if ( part instanceof AttributeTypeEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( AttributeTypeEditor ) part ).getOriginalAttributeType() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+            else if ( part instanceof SchemaEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( SchemaEditor ) part ).getSchema() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partActivated( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partClosed( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partDeactivated( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partHidden( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partInputChanged( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partOpened( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
+         */
+        public void partBroughtToTop( IWorkbenchPartReference partRef )
+        {
+        }
+    };
+
+    /** The listener listening on changes on the view */
+    private ISelectionListener viewListener = new ISelectionListener()
+    {
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+         *      org.eclipse.jface.viewers.ISelection)
+         */
+        public void selectionChanged( IWorkbenchPart part, ISelection selection )
+        {
+            ITreeSelection iSelection = ( ITreeSelection ) selection;
+
+            Object selectedObject = iSelection.getFirstElement();
+
+            if ( ( selectedObject instanceof SchemaWrapper ) || ( selectedObject instanceof ObjectClassWrapper )
+                || ( selectedObject instanceof AttributeTypeWrapper ) )
+            {
+                linkEditorWithView( ( TreeNode ) selectedObject );
+            }
+        }
+    };
+
+
+    /**
+     * Creates a new instance of ExportSchemasAsXmlAction.
+     */
+    public LinkWithEditorSchemaViewAction( SchemaView view )
+    {
+        super( "Lin&k with Editor", AS_CHECK_BOX );
+        setToolTipText( "Link with Editor" );
+        setId( PluginConstants.CMD_LINK_WITH_EDITOR_SCHEMA_VIEW );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_LINK_WITH_EDITOR ) );
+        setEnabled( false );
+        this.view = view;
+
+        // Setting up the default key value (if needed)
+        if ( Activator.getDefault().getDialogSettings().get( LINK_WITH_EDITOR_SCHEMAS_VIEW_DS_KEY ) == null )
+        {
+            Activator.getDefault().getDialogSettings().put( LINK_WITH_EDITOR_SCHEMAS_VIEW_DS_KEY, false );
+        }
+
+        // Setting state from the dialog settings
+        setChecked( Activator.getDefault().getDialogSettings().getBoolean( LINK_WITH_EDITOR_SCHEMAS_VIEW_DS_KEY ) );
+
+        // Enabling the listeners
+        if ( isChecked() )
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener( editorListener );
+            view.getSite().getPage().addPostSelectionListener( viewListener );
+        }
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        setChecked( isChecked() );
+        Activator.getDefault().getDialogSettings().put( LINK_WITH_EDITOR_SCHEMAS_VIEW_DS_KEY, isChecked() );
+
+        if ( isChecked() ) // Enabling the listeners
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener( editorListener );
+
+            IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                .getActiveEditor();
+            if ( activeEditor instanceof ObjectClassEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( ObjectClassEditor ) activeEditor ).getOriginalObjectClass() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+            else if ( activeEditor instanceof AttributeTypeEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( AttributeTypeEditor ) activeEditor ).getOriginalAttributeType() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+            else if ( activeEditor instanceof SchemaEditor )
+            {
+                view.getSite().getPage().removePostSelectionListener( viewListener );
+                linkViewWithEditor( ( ( SchemaEditor ) activeEditor ).getSchema() );
+                view.getSite().getPage().addPostSelectionListener( viewListener );
+            }
+
+            view.getSite().getPage().addPostSelectionListener( viewListener );
+        }
+        else
+        // Disabling the listeners
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().removePartListener( editorListener );
+            view.getSite().getPage().removePostSelectionListener( viewListener );
+        }
+    }
+
+
+    /**
+     * Links the view with the right editor
+     *
+     * @param o
+     *      the object
+     */
+    private void linkViewWithEditor( Object o )
+    {
+        TreeNode wrapper = ( ( SchemaViewContentProvider ) view.getViewer().getContentProvider() ).getWrapper( o );
+        if ( wrapper != null )
+        {
+            view.getViewer().setSelection( new StructuredSelection( wrapper ) );
+        }
+    }
+
+
+    /**
+     * Links the editor to the view
+     *
+     * @param wrapper
+     *      the selected element in the view
+     */
+    private void linkEditorWithView( TreeNode wrapper )
+    {
+        IEditorReference[] references = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            .getEditorReferences();
+
+        for ( IEditorReference reference : references )
+        {
+            IWorkbenchPart workbenchPart = reference.getPart( true );
+
+            if ( ( workbenchPart instanceof ObjectClassEditor ) && ( wrapper instanceof ObjectClassWrapper ) )
+            {
+                ObjectClassEditor editor = ( ObjectClassEditor ) workbenchPart;
+                ObjectClassWrapper ocw = ( ObjectClassWrapper ) wrapper;
+                if ( editor.getOriginalObjectClass().equals( ocw.getObjectClass() ) )
+                {
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop( workbenchPart );
+                    return;
+                }
+            }
+            else if ( ( workbenchPart instanceof AttributeTypeEditor ) && ( wrapper instanceof AttributeTypeWrapper ) )
+            {
+                AttributeTypeEditor editor = ( AttributeTypeEditor ) workbenchPart;
+                AttributeTypeWrapper atw = ( AttributeTypeWrapper ) wrapper;
+                if ( editor.getOriginalAttributeType().equals( atw.getAttributeType() ) )
+                {
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop( workbenchPart );
+                    return;
+                }
+            }
+            else if ( ( workbenchPart instanceof SchemaEditor ) && ( wrapper instanceof SchemaWrapper ) )
+            {
+                SchemaEditor editor = ( SchemaEditor ) workbenchPart;
+                SchemaWrapper sw = ( SchemaWrapper ) wrapper;
+                if ( editor.getSchema().equals( sw.getSchema() ) )
+                {
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop( workbenchPart );
+                    return;
+                }
+            }
+        }
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /*
+     * (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#selectionChanged(org.eclipse.jface.action.IAction,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/LinkWithEditorSchemaViewAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,171 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.wizards.NewAttributeTypeWizard;
+import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.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.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the NewAttributeTypeWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewAttributeTypeAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of NewAttributeTypeAction.
+     */
+    public NewAttributeTypeAction( TreeViewer viewer )
+    {
+        super( "New A&ttribute Type" );
+        setToolTipText( "New Attribute Type" );
+        setId( PluginConstants.CMD_NEW_ATTRIBUTE_TYPE );
+        setActionDefinitionId( PluginConstants.CMD_NEW_ATTRIBUTE_TYPE );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_ATTRIBUTE_TYPE_NEW ) );
+        setEnabled( false );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Getting the selection
+        Schema selectedSchema = null;
+
+        int presentation = Activator.getDefault().getPreferenceStore().getInt(
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
+        {
+            StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+            {
+                Object firstElement = selection.getFirstElement();
+                if ( firstElement instanceof SchemaWrapper )
+                {
+                    selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
+                }
+                else if ( firstElement instanceof Folder )
+                {
+                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent() ).getSchema();
+                }
+                else if ( firstElement instanceof AttributeTypeWrapper )
+                {
+                    TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent() ).getSchema();
+
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
+                }
+                else if ( firstElement instanceof ObjectClassWrapper )
+                {
+                    TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent() ).getSchema();
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
+                }
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        NewAttributeTypeWizard wizard = new NewAttributeTypeWizard();
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        wizard.setSelectedSchema( selectedSchema );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,171 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.wizards.NewObjectClassWizard;
+import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.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.TreeViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the NewObjectClassWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewObjectClassAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of NewObjectClassAction.
+     */
+    public NewObjectClassAction( TreeViewer viewer )
+    {
+        super( "New O&bject Class" );
+        setToolTipText( "New Object Class" );
+        setId( PluginConstants.CMD_NEW_OBJECT_CLASS );
+        setActionDefinitionId( PluginConstants.CMD_NEW_OBJECT_CLASS );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_OBJECT_CLASS_NEW ) );
+        setEnabled( false );
+        this.viewer = viewer;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Getting the selection
+        Schema selectedSchema = null;
+
+        int presentation = Activator.getDefault().getPreferenceStore().getInt(
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
+        {
+            StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+            {
+                Object firstElement = selection.getFirstElement();
+                if ( firstElement instanceof SchemaWrapper )
+                {
+                    selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
+                }
+                else if ( firstElement instanceof Folder )
+                {
+                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent() ).getSchema();
+                }
+                else if ( firstElement instanceof AttributeTypeWrapper )
+                {
+                    TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent() ).getSchema();
+
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
+                }
+                else if ( firstElement instanceof ObjectClassWrapper )
+                {
+                    TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent() ).getSchema();
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
+                }
+            }
+        }
+
+        // Instantiates and initializes the wizard
+        NewObjectClassWizard wizard = new NewObjectClassWizard();
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        wizard.setSelectedSchema( selectedSchema );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewProjectAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewProjectAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewProjectAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewProjectAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,109 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.NewProjectWizard;
+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.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the NewProjectWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewProjectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of NewProjectAction.
+     */
+    public NewProjectAction()
+    {
+        super( "New Schema P&roject" );
+        setToolTipText( "New Schema Project" );
+        setId( PluginConstants.CMD_NEW_PROJECT );
+        setActionDefinitionId( PluginConstants.CMD_NEW_PROJECT );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_PROJECT_NEW ) );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        NewProjectWizard wizard = new NewProjectWizard();
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewProjectAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewSchemaAction.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewSchemaAction.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewSchemaAction.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,109 @@
+/*
+ *  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.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.NewSchemaWizard;
+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.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action launches the NewSchemaWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewSchemaAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of NewSchemaAction.
+     */
+    public NewSchemaAction()
+    {
+        super( "New Sch&ema" );
+        setToolTipText( "New Schema" );
+        setId( PluginConstants.CMD_NEW_SCHEMA );
+        setActionDefinitionId( PluginConstants.CMD_NEW_SCHEMA );
+        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SCHEMA_NEW ) );
+        setEnabled( false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        NewSchemaWizard wizard = new NewSchemaWizard();
+        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();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (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#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewSchemaAction.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message