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 2007/07/16 09:35:53 UTC
svn commit: r556532 [1/2] - in
/directory/studio/trunk/studio-apacheds-schemaeditor: ./ resources/icons/
src/main/java/org/apache/directory/studio/apacheds/schemaeditor/
src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/
src/ma...
Author: pamarcelot
Date: Mon Jul 16 00:35:49 2007
New Revision: 556532
URL: http://svn.apache.org/viewvc?view=rev&rev=556532
Log:
Added a new ProjectsView.
Added Import/Export wizards for projects.
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/delete.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads_closed.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export_wizard.png (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import_wizard.png (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new_wizard.png (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline_closed.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/projects_view.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizard.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizardPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizard.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizardPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizard.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewProjectWizardPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectWrapper.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ProjectsViewRoot.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_export_wizard.png
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml?view=diff&rev=556532&r1=556531&r2=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Mon Jul 16 00:35:49 2007
@@ -46,6 +46,13 @@
icon="resources/icons/problems_view.gif"
id="org.apache.directory.studio.apacheds.schemaeditor.view.ProblemsView"
name="Problems"/>
+ <view
+ allowMultiple="false"
+ category="org.apache.directory.studio.apacheds.schemaeditor.view.category"
+ class="org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView"
+ icon="resources/icons/projects_view.gif"
+ id="org.apache.directory.studio.apacheds.schemaeditor.view.ProjectsView"
+ name="Projects"/>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
@@ -56,6 +63,14 @@
<category
id="org.apache.directory.studio.apacheds.schemaeditor.newWizardCategory"
name="Apache DS Schema Editor"/>
+ <wizard
+ category="org.apache.directory.studio.apacheds.schemaeditor.newWizardCategory"
+ class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.NewProjectWizard"
+ hasPages="true"
+ icon="resources/icons/project_new.gif"
+ id="org.apache.directory.studio.apacheds.schemaeditor.wizards.NewProjectWizard"
+ name="New Schema Project"
+ project="true"/>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.newWizardCategory"
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.NewAttributeTypeWizard"
@@ -105,14 +120,21 @@
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportSchemasAsXmlWizard"
icon="resources/icons/schemas_export.gif"
id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ExportSchemasAsXmlWizard"
- name="Export schemas as XML file(s)">
+ name="Schemas as XML file(s)">
</wizard>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.exportWizardCategory"
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportSchemasAsOpenLdapWizard"
icon="resources/icons/schemas_export.gif"
id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ExportSchemasAsOpenLdapWizard"
- name="Export schemas as OpenLdap files">
+ name="Schemas as OpenLdap files">
+ </wizard>
+ <wizard
+ category="org.apache.directory.studio.apacheds.schemaeditor.exportWizardCategory"
+ class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportProjectsWizard"
+ icon="resources/icons/project_export.gif"
+ id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ExportProjectsWizard"
+ name="Schema Projects">
</wizard>
</extension>
<extension
@@ -126,14 +148,21 @@
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ImportSchemasFromXmlWizard"
icon="resources/icons/schemas_import.gif"
id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ImportSchemasFromXmlWizard"
- name="Import schemas from XML file(s)">
+ name="Schemas from XML file(s)">
</wizard>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.importWizardCategory"
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ImportSchemasFromOpenLdapWizard"
icon="resources/icons/schemas_import.gif"
id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ImportSchemasFromOpenLdapWizard"
- name="Import schemas from OpenLdap files">
+ name="Schemas from OpenLdap files">
+ </wizard>
+ <wizard
+ category="org.apache.directory.studio.apacheds.schemaeditor.importWizardCategory"
+ class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ImportProjectsWizard"
+ icon="resources/icons/project_import.gif"
+ id="org.apache.directory.studio.apacheds.schemaeditor.wizards.ImportProjectsWizard"
+ name="Schema Projects">
</wizard>
</extension>
</plugin>
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/delete.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/delete.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/delete.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads_closed.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads_closed.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_ads_closed.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export_wizard.png?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_export_wizard.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import_wizard.png?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_import_wizard.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new_wizard.png?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_new_wizard.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline_closed.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline_closed.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/project_offline_closed.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/projects_view.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/projects_view.gif?view=auto&rev=556532
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/projects_view.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_export_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schemas_export_wizard.png?view=diff&rev=556532&r1=556531&r2=556532
==============================================================================
Binary files - no diff available.
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=diff&rev=556532&r1=556531&r2=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java Mon Jul 16 00:35:49 2007
@@ -33,6 +33,7 @@
public static final String IMG_ATTRIBUTE_TYPE_NEW = "resources/icons/attribute_type_new.gif";
public static final String IMG_ATTRIBUTE_TYPE_NEW_WIZARD = "resources/icons/attribute_type_new_wizard.png";
public static final String IMG_CONNECT = "resources/icons/connect.gif";
+ public static final String IMG_DELETE = "resources/icons/delete.gif";
public static final String IMG_DISCONNECT = "resources/icons/disconnect.gif";
public static final String IMG_DIFFERENCE_ADD = "resources/icons/difference_add.png";
public static final String IMG_DIFFERENCE_MODIFY = "resources/icons/difference_modify.png";
@@ -46,13 +47,31 @@
public static final String IMG_PROBLEMS_ERROR = "resources/icons/problems_error.gif";
public static final String IMG_PROBLEMS_GROUP = "resources/icons/problems_group.gif";
public static final String IMG_PROBLEMS_WARNING = "resources/icons/problems_warning.gif";
+ public static final String IMG_PROJECT_ADS = "resources/icons/project_ads.gif";
+ public static final String IMG_PROJECT_ADS_CLOSED = "resources/icons/project_ads_closed.gif";
+ public static final String IMG_PROJECT_EXPORT = "resources/icons/project_export.gif";
+ public static final String IMG_PROJECT_EXPORT_WIZARD = "resources/icons/project_export_wizard.png";
+ public static final String IMG_PROJECT_IMPORT = "resources/icons/project_import.gif";
+ public static final String IMG_PROJECT_IMPORT_WIZARD = "resources/icons/project_import_wizard.png";
+ public static final String IMG_PROJECT_NEW = "resources/icons/project_new.gif";
+ public static final String IMG_PROJECT_NEW_WIZARD = "resources/icons/project_new_wizard.png";
+ public static final String IMG_PROJECT_OFFLINE = "resources/icons/project_offline.gif";
+ public static final String IMG_PROJECT_OFFLINE_CLOSED = "resources/icons/project_offline_closed.gif";
+ public static final String IMG_RENAME = "resources/icons/rename.gif";
public static final String IMG_SCHEMA = "resources/icons/schema.gif";
+ public static final String IMG_SCHEMAS_EXPORT = "resources/icons/schemas_export.gif";
public static final String IMG_SCHEMAS_EXPORT_WIZARD = "resources/icons/schemas_export_wizard.png";
+ public static final String IMG_SCHEMAS_IMPORT = "resources/icons/schemas_import.gif";
public static final String IMG_SCHEMAS_IMPORT_WIZARD = "resources/icons/schemas_import_wizard.png";
public static final String IMG_TOOLBAR_MENU = "resources/icons/toolbar_menu.gif";
// Commands
- public static final String CMD_CONNECT = Activator.PLUGIN_ID + ".connect";
+ public static final String CMD_CONNECT = Activator.PLUGIN_ID + ".commands.connect";
+ public static final String CMD_NEW_PROJECT = Activator.PLUGIN_ID + ".commands.newProject";
+ public static final String CMD_DELETE_PROJECT = Activator.PLUGIN_ID + ".commands.deleteProject";
+ public static final String CMD_EXPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.exportProjects";
+ public static final String CMD_IMPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.importProjects";
+ public static final String CMD_RENAME_PROJECT = Activator.PLUGIN_ID + ".commands.renameProject";
// Preferences
/** The preferences ID for DifferencesWidget Grouping */
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.DeleteProjectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportProjectsAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportProjectsAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewProjectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.RenameProjectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+
+/**
+ * This class implements the Controller for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsViewController
+{
+ /** The associated view */
+ private ProjectsView view;
+
+ /** The Context Menu */
+ private MenuManager contextMenu;
+
+ // The Actions
+ private NewProjectAction newProject;
+ private RenameProjectAction renameProject;
+ private DeleteProjectAction deleteProject;
+ private ImportProjectsAction importProjects;
+ private ExportProjectsAction exportProjects;
+
+
+ /**
+ * Creates a new instance of SchemasViewController.
+ *
+ * @param view
+ * the associated view
+ */
+ public ProjectsViewController( ProjectsView view )
+ {
+ this.view = view;
+
+ initActions();
+ initToolbar();
+ initContextMenu();
+ initDoubleClickListener();
+ }
+
+
+ /**
+ * Initializes the Actions.
+ */
+ private void initActions()
+ {
+ newProject = new NewProjectAction();
+ renameProject = new RenameProjectAction( view );
+ deleteProject = new DeleteProjectAction( view );
+ importProjects = new ImportProjectsAction();
+ exportProjects = new ExportProjectsAction();
+ }
+
+
+ /**
+ * Initializes the Toolbar.
+ */
+ private void initToolbar()
+ {
+ IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+ toolbar.add( newProject );
+ }
+
+
+ /**
+ * Initializes the ContextMenu.
+ */
+ private void initContextMenu()
+ {
+ contextMenu = new MenuManager( "" ); //$NON-NLS-1$
+ contextMenu.setRemoveAllWhenShown( true );
+ contextMenu.addMenuListener( new IMenuListener()
+ {
+ public void menuAboutToShow( IMenuManager manager )
+ {
+ MenuManager importManager = new MenuManager( "Import..." );
+ MenuManager exportManager = new MenuManager( "Export..." );
+ manager.add( newProject );
+ manager.add( new Separator() );
+ manager.add( renameProject );
+ manager.add( new Separator() );
+ manager.add( deleteProject );
+ manager.add( new Separator() );
+ manager.add( importManager );
+ importManager.add( importProjects );
+ manager.add( exportManager );
+ exportManager.add( exportProjects );
+
+ manager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
+ }
+ } );
+
+ TableViewer viewer = view.getViewer();
+
+ // set the context menu to the table viewer
+ viewer.getControl().setMenu( contextMenu.createContextMenu( viewer.getControl() ) );
+
+ // register the context menu to enable extension actions
+ view.getSite().registerContextMenu( contextMenu, viewer );
+ }
+
+
+ /**
+ * Initializes the DoubleClickListener.
+ */
+ private void initDoubleClickListener()
+ {
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java Mon Jul 16 00:35:49 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.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action deletes one or more Projects from the ProjectsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteProjectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private ProjectsView view;
+
+
+ /**
+ * Creates a new instance of DeleteProjectAction.
+ *
+ * @param view
+ * the associated view
+ */
+ public DeleteProjectAction( ProjectsView view )
+ {
+ super( "Delete Project" ); //$NON-NLS-1$
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_DELETE_PROJECT );
+ setImageDescriptor( AbstractUIPlugin
+ .imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_DELETE ) );
+ setEnabled( false );
+ this.view = view;
+ this.view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+ if ( selection.size() == 1 )
+ {
+ setText( "Delete Project" );
+ setEnabled( true );
+ }
+ else if ( selection.size() > 1 )
+ {
+ setText( "Delete Projects" );
+ setEnabled( true );
+ }
+ else
+ {
+ setText( "Delete Project" );
+ setEnabled( false );
+ }
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // TODO implement
+ }
+
+
+ /* (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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java Mon Jul 16 00:35:49 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.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportProjectsWizard;
+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 ExportProjectsWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportProjectsAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of NewProjectAction.
+ */
+ public ExportProjectsAction()
+ {
+ super( "Export Schema Projects" ); //$NON-NLS-1$
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_EXPORT_PROJECTS );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_EXPORT ) );
+ setEnabled( true );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Instantiates and initializes the wizard
+ ExportProjectsWizard wizard = new ExportProjectsWizard();
+ 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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java Mon Jul 16 00:35:49 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.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.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( "Import Schema Projects" ); //$NON-NLS-1$
+ 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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewProjectAction.java Mon Jul 16 00:35:49 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.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.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 Project" ); //$NON-NLS-1$
+ setToolTipText( getText() );
+ setId( 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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RenameProjectAction.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+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 RenameProjectAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private ProjectsView view;
+
+
+ /**
+ * Creates a new instance of RenameProjectAction.
+ *
+ * @param view
+ * the associate view
+ */
+ public RenameProjectAction( ProjectsView view )
+ {
+ super( "Rename Project..." ); //$NON-NLS-1$
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_RENAME_PROJECT );
+ setImageDescriptor( AbstractUIPlugin
+ .imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_RENAME ) );
+ setEnabled( false );
+ this.view = view;
+ this.view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+ setEnabled( selection.size() == 1 );
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // TODO Implement
+ }
+
+
+ /* (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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.model;
+
+
+/**
+ * This class implements a Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Project
+{
+ /**
+ * This enum represents the different types of Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum ProjectType
+ {
+ /** A schema project not linked to any LDAP Server */
+ OFFLINE,
+ /** A schema project linked to an Apache Directory Server */
+ APACHE_DIRECTORY_SERVER
+ }
+
+ /** The type of the project */
+ private ProjectType type;
+
+ /** The name of the project */
+ private String name;
+
+
+ /**
+ * Creates a new instance of Project.
+ *
+ * @param type
+ * the type of project
+ * @param name
+ * the name of project
+ */
+ public Project( ProjectType type, String name )
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+
+ /**
+ * Creates a new instance of Project.
+ * The default type is used : OFFLINE.
+ */
+ public Project()
+ {
+ type = ProjectType.OFFLINE;
+ }
+
+
+ /**
+ * Creates a new instance of Project.
+ *
+ * @param type
+ * the type of project
+ */
+ public Project( ProjectType type )
+ {
+ this.type = type;
+ }
+
+
+ /**
+ * Gets the type of the project.
+ *
+ * @return
+ * the type of the project
+ */
+ public ProjectType getType()
+ {
+ return type;
+ }
+
+
+ /**
+ * Gets the name of the project.
+ *
+ * @return
+ * the name of the project
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * Sets the name of the project
+ *
+ * @param name
+ * the name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java?view=diff&rev=556532&r1=556531&r2=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/Perspective.java Mon Jul 16 00:35:49 2007
@@ -22,6 +22,7 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProblemsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProjectsView;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
@@ -60,10 +61,12 @@
// Adding Views
topLeftFolder.addView( SchemaView.ID );
+ layout.addStandaloneView( ProjectsView.ID, true, IPageLayout.BOTTOM, 0.7f, topLeftFolderId );
layout.addStandaloneView( ProblemsView.ID, true, IPageLayout.BOTTOM, 0.7f, editorAreaId );
// Setting up non-closeable views
layout.getViewLayout( SchemaView.ID ).setCloseable( false );
+ layout.getViewLayout( ProjectsView.ID ).setCloseable( false );
// Adding Perspective shortcuts
layout.addPerspectiveShortcut( "org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective" ); //$NON-NLS-1$
@@ -71,6 +74,7 @@
// Adding View shortcuts
layout.addShowViewShortcut( SchemaView.ID );
+ layout.addShowViewShortcut( ProjectsView.ID );
layout.addShowViewShortcut( ProblemsView.ID );
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsView.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.ProjectsViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectsViewRoot;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class represents the ProjectsView.
+ * It is used to display the projects the user has created.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsView extends ViewPart
+{
+ /** The ID of the View */
+ public static final String ID = Activator.PLUGIN_ID + ".view.ProjectsView"; //$NON-NLS-1$
+
+ /** The viewer */
+ private TableViewer tableViewer;
+
+ /** The content provider of the viewer */
+ private ProjectsViewContentProvider contentProvider;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl( Composite parent )
+ {
+ initViewer( parent );
+
+ // Adding the controller
+ new ProjectsViewController( this );
+ }
+
+
+ /**
+ * Initializes the Viewer
+ */
+ private void initViewer( Composite parent )
+ {
+ tableViewer = new TableViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+ contentProvider = new ProjectsViewContentProvider( tableViewer );
+ tableViewer.setContentProvider( contentProvider );
+ tableViewer.setLabelProvider( new DecoratingLabelProvider( new ProjectsViewLabelProvider(), Activator
+ .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+ tableViewer.setInput( new ProjectsViewRoot() );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ public void setFocus()
+ {
+ tableViewer.getTable().setFocus();
+ }
+
+
+ /**
+ * Gets the TableViewer.
+ *
+ * @return
+ * the TableViewer
+ */
+ public TableViewer getViewer()
+ {
+ return tableViewer;
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewContentProvider.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectType;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectsViewRoot;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the ProblemsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+ /** The associated viewer */
+ private TableViewer viewer;
+
+
+ /**
+ * Creates a new instance of ProblemsViewContentProvider.
+ *
+ * @param viewer
+ * the associated TableViewer
+ */
+ public ProjectsViewContentProvider( TableViewer viewer )
+ {
+ this.viewer = viewer;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements( Object inputElement )
+ {
+ return getChildren( inputElement );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose()
+ {
+ // Nothing to do.
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+ {
+ // Nothing to do.
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren( Object parentElement )
+ {
+ List<TreeNode> children = null;
+
+ if ( parentElement instanceof ProjectsViewRoot )
+ {
+ children = new ArrayList<TreeNode>();
+
+ children.add( new ProjectWrapper( new Project( ProjectType.APACHE_DIRECTORY_SERVER,
+ "Apache DS" ) ) );
+
+ children.add( new ProjectWrapper( new Project( ProjectType.OFFLINE, "Open LDAP" ) ) );
+ }
+ else if ( parentElement instanceof ProjectWrapper )
+ {
+ children = new ArrayList<TreeNode>();
+ }
+ return children.toArray();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ public Object getParent( Object element )
+ {
+ if ( element instanceof TreeNode )
+ {
+ return ( ( TreeNode ) element ).getParent();
+ }
+
+ // Default
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ public boolean hasChildren( Object element )
+ {
+ if ( element instanceof TreeNode )
+ {
+ return ( ( TreeNode ) element ).hasChildren();
+ }
+
+ // Default
+ return false;
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProjectsViewLabelProvider.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project.ProjectType;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProjectWrapper;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the ProjectsView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProjectsViewLabelProvider extends LabelProvider
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage( Object element )
+ {
+ if ( element instanceof ProjectWrapper )
+ {
+ ProjectWrapper projectWrapper = ( ProjectWrapper ) element;
+ ProjectType type = projectWrapper.getProject().getType();
+ switch ( type )
+ {
+ case OFFLINE:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
+ case APACHE_DIRECTORY_SERVER:
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_ADS ).createImage();
+ }
+ }
+
+ // Default
+ return super.getImage( element );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof ProjectWrapper )
+ {
+ ProjectWrapper projectWrapper = ( ProjectWrapper ) element;
+ return projectWrapper.getProject().getName();
+ }
+
+ // Default
+ return super.getText( element );
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizard.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizard.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizard.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.wizards;
+
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * This class represents the wizard to export schema projects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportProjectsWizard extends Wizard implements IExportWizard
+{
+ // The pages of the wizard
+ private ExportProjectsWizardPage page;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages()
+ {
+ // Creating pages
+ page = new ExportProjectsWizardPage();
+
+ // Adding pages
+ addPage( page );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish()
+ {
+
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init( IWorkbench workbench, IStructuredSelection selection )
+ {
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizardPage.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizardPage.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportProjectsWizardPage.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.wizards;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents the WizardPage of the ExportProjectsWizard.
+ * <p>
+ * It is used to let the user enter the informations about the
+ * schemas projects he wants to export and where to export.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportProjectsWizardPage extends WizardPage
+{
+ // UI Fields
+ private CheckboxTableViewer projectsTableViewer;
+ private Button projectsTableSelectAllButton;
+ private Button projectsTableDeselectAllButton;
+ private Label exportDirectoryLabel;
+ private Text exportDirectoryText;
+ private Button exportDirectoryButton;
+
+
+ /**
+ * Creates a new instance of ExportSchemasAsXmlWizardPage.
+ */
+ protected ExportProjectsWizardPage()
+ {
+ super( "ExportProjectsWizardPage" );
+ setTitle( "Export schema projects" );
+ setDescription( "Please select the schema projects to export." );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_EXPORT_WIZARD ) );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NULL );
+ GridLayout layout = new GridLayout();
+ composite.setLayout( layout );
+
+ // Projects Group
+ Group schemaProjectsGroup = new Group( composite, SWT.NONE );
+ schemaProjectsGroup.setText( "Schema projects" );
+ schemaProjectsGroup.setLayout( new GridLayout( 2, false ) );
+ schemaProjectsGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Projects TableViewer
+ Label projectsLabel = new Label( schemaProjectsGroup, SWT.NONE );
+ projectsLabel.setText( "Select the schema projects to export:" );
+ projectsLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+ projectsTableViewer = new CheckboxTableViewer( new Table( schemaProjectsGroup, SWT.BORDER | SWT.CHECK
+ | SWT.FULL_SELECTION ) );
+ GridData projectsTableViewerGridData = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 2 );
+ projectsTableViewerGridData.heightHint = 125;
+ projectsTableViewer.getTable().setLayoutData( projectsTableViewerGridData );
+ projectsTableViewer.setContentProvider( new ArrayContentProvider() );
+ projectsTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public String getText( Object element )
+ {
+ if ( element instanceof Schema )
+ {
+ return ( ( Schema ) element ).getName();
+ }
+
+ // Default
+ return super.getText( element );
+ }
+
+
+ public Image getImage( Object element )
+ {
+ if ( element instanceof Schema )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_PROJECT_OFFLINE_CLOSED ).createImage();
+ }
+
+ // Default
+ return super.getImage( element );
+ }
+ } );
+ projectsTableViewer.addCheckStateListener( new ICheckStateListener()
+ {
+ /**
+ * Notifies of a change to the checked state of an element.
+ *
+ * @param event
+ * event object describing the change
+ */
+ public void checkStateChanged( CheckStateChangedEvent event )
+ {
+ dialogChanged();
+ }
+ } );
+ projectsTableSelectAllButton = new Button( schemaProjectsGroup, SWT.PUSH );
+ projectsTableSelectAllButton.setText( "Select All" );
+ projectsTableSelectAllButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ projectsTableSelectAllButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ projectsTableViewer.setAllChecked( true );
+ dialogChanged();
+ }
+ } );
+ projectsTableDeselectAllButton = new Button( schemaProjectsGroup, SWT.PUSH );
+ projectsTableDeselectAllButton.setText( "Deselect All" );
+ projectsTableDeselectAllButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ projectsTableDeselectAllButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ projectsTableViewer.setAllChecked( false );
+ dialogChanged();
+ }
+ } );
+
+ // Export Destination Group
+ Group exportDestinationGroup = new Group( composite, SWT.NULL );
+ exportDestinationGroup.setText( "Export Destination" );
+ exportDestinationGroup.setLayout( new GridLayout( 3, false ) );
+ exportDestinationGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ exportDirectoryLabel = new Label( exportDestinationGroup, SWT.NONE );
+ exportDirectoryLabel.setText( "Directory:" );
+ exportDirectoryText = new Text( exportDestinationGroup, SWT.BORDER );
+ exportDirectoryText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ exportDirectoryText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dialogChanged();
+ }
+ } );
+ exportDirectoryButton = new Button( exportDestinationGroup, SWT.PUSH );
+ exportDirectoryButton.setText( "Browse..." );
+ exportDirectoryButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ chooseExportDirectory();
+ dialogChanged();
+ }
+ } );
+
+ initFields();
+
+ setControl( composite );
+ }
+
+
+ /**
+ * Initializes the UI Fields.
+ */
+ private void initFields()
+ {
+ // Filling the Schemas table
+// schemaProjectsTableViewer.setInput( schemaHandler.getSchemas() );
+
+ displayErrorMessage( null );
+ setPageComplete( false );
+ }
+
+
+ /**
+ * This method is called when the exportMultipleFiles 'browse' button is selected.
+ */
+ private void chooseExportDirectory()
+ {
+ DirectoryDialog dialog = new DirectoryDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ dialog.setText( "Choose Folder" );
+ dialog.setMessage( "Select the folder in which export the files." );
+
+ String selectedDirectory = dialog.open();
+ if ( selectedDirectory != null )
+ {
+ exportDirectoryText.setText( selectedDirectory );
+ }
+ }
+
+
+ /**
+ * This method is called when the user modifies something in the UI.
+ */
+ private void dialogChanged()
+ {
+ // Schemas table
+ if ( projectsTableViewer.getCheckedElements().length == 0 )
+ {
+ displayErrorMessage( "One or several schema projects must be selected." );
+ return;
+ }
+
+ // Export Directory
+ String directory = exportDirectoryText.getText();
+ if ( ( directory == null ) || ( directory.equals( "" ) ) )
+ {
+ displayErrorMessage( "A directory must be selected." );
+ return;
+ }
+ else
+ {
+ File directoryFile = new File( directory );
+ if ( !directoryFile.exists() )
+ {
+ displayErrorMessage( "The selected directory does not exist." );
+ return;
+ }
+ else if ( !directoryFile.isDirectory() )
+ {
+ displayErrorMessage( "The selected directory is not a directory." );
+ return;
+ }
+ else if ( !directoryFile.canWrite() )
+ {
+ displayErrorMessage( "The selected directory is not writable." );
+ return;
+ }
+ }
+
+ displayErrorMessage( null );
+ }
+
+
+ /**
+ * Displays an error message and set the page status as incomplete
+ * if the message is not null.
+ *
+ * @param message
+ * the message to display
+ */
+ private void displayErrorMessage( String message )
+ {
+ setErrorMessage( message );
+ setPageComplete( message == null );
+ }
+
+
+ /**
+ * Gets the selected projects.
+ *
+ * @return
+ * the selected projects
+ */
+ public Project[] getSelectedProjects()
+ {
+ Object[] selectedProjects = projectsTableViewer.getCheckedElements();
+
+ List<Project> schemas = new ArrayList<Project>();
+ for ( Object project : selectedProjects )
+ {
+ schemas.add( ( Project ) project );
+ }
+
+ return schemas.toArray( new Project[0] );
+ }
+
+
+ /**
+ * Gets the export directory.
+ *
+ * @return
+ * the export directory
+ */
+ public String getExportDirectory()
+ {
+ return exportDirectoryText.getText();
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizard.java?view=auto&rev=556532
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizard.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ImportProjectsWizard.java Mon Jul 16 00:35:49 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.wizards;
+
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * This class represents the wizard to import schema projects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ImportProjectsWizard extends Wizard implements IImportWizard
+{
+ // The pages of the wizard
+ private ImportProjectsWizardPage page;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages()
+ {
+ // Creating pages
+ page = new ImportProjectsWizardPage();
+
+ // Adding pages
+ addPage( page );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish()
+ {
+
+
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init( IWorkbench workbench, IStructuredSelection selection )
+ {
+ }
+}