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/17 16:44:44 UTC
svn commit: r556934 - 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/main/jav...
Author: pamarcelot
Date: Tue Jul 17 07:44:41 2007
New Revision: 556934
URL: http://svn.apache.org/viewvc?view=rev&rev=556934
Log:
Added Context Menu in the SchemaView.
Added Actions for Import/Export Schemas in the SchemaView.
Improved behavior of views when opening a project.
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new_wizard.png (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteSchemaElementAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewAttributeTypeAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewObjectClassAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewSchemaAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizard.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizardPage.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java
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/SchemaHandler.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/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/model/Project.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
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=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Tue Jul 17 07:44:41 2007
@@ -73,6 +73,14 @@
project="true"/>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.newWizardCategory"
+ class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.NewSchemaWizard"
+ hasPages="true"
+ icon="resources/icons/schema_new.gif"
+ id="org.apache.directory.studio.apacheds.schemaeditor.wizards.NewSchemaWizard"
+ name="New Schema"
+ project="false"/>
+ <wizard
+ category="org.apache.directory.studio.apacheds.schemaeditor.newWizardCategory"
class="org.apache.directory.studio.apacheds.schemaeditor.view.wizards.NewAttributeTypeWizard"
hasPages="true"
icon="resources/icons/attribute_type_new.gif"
@@ -127,7 +135,7 @@
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="Schemas as OpenLdap files">
+ name="Schemas as OpenLDAP files">
</wizard>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.exportWizardCategory"
@@ -155,7 +163,7 @@
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="Schemas from OpenLdap files">
+ name="Schemas from OpenLDAP files">
</wizard>
<wizard
category="org.apache.directory.studio.apacheds.schemaeditor.importWizardCategory"
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new.gif?view=auto&rev=556934
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new_wizard.png?view=auto&rev=556934
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/schema_new_wizard.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java Tue Jul 17 07:44:41 2007
@@ -25,6 +25,8 @@
import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaChecker;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.ProblemsView;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
import org.apache.directory.studio.apacheds.schemaeditor.view.widget.SchemaCodeScanner;
import org.apache.directory.studio.apacheds.schemaeditor.view.widget.SchemaTextAttributeProvider;
import org.eclipse.jface.text.rules.ITokenScanner;
@@ -61,6 +63,12 @@
/** The ProjectsHandler */
private ProjectsHandler projectsHandler;
+ /** The SchemaView */
+ private SchemaView schemaView;
+
+ /** The ProblemsView */
+ private ProblemsView problemsView;
+
/**
* Creates a new instance of Activator.
@@ -74,28 +82,40 @@
public void openProjectChanged( Project oldProject, Project newProject )
{
- // TODO Auto-generated method stub
-
+ if ( newProject == null )
+ {
+ schemaHandler = null;
+ schemaChecker = null;
+ }
+ else
+ {
+ // Registering the SchemaHandler and SchemaChecker
+ schemaHandler = newProject.getSchemaHandler();
+ schemaChecker = newProject.getSchemaChecker();
+ schemaChecker.enableModificationsListening();
+
+ // Reloading views
+ schemaView = ( SchemaView ) getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(
+ SchemaView.ID );
+ problemsView = ( ProblemsView ) getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(
+ ProblemsView.ID );
+ schemaView.reloadViewer();
+ problemsView.reloadViewer();
+ }
}
public void projectAdded( Project project )
{
PluginUtils.saveProjects();
-
}
public void projectRemoved( Project project )
{
PluginUtils.saveProjects();
-
}
-
} );
-
- schemaHandler = SchemaHandler.getInstance();
- schemaChecker = new SchemaChecker();
}
@@ -110,8 +130,6 @@
// Loading the projects
PluginUtils.loadProjects();
- // FakeLoader.loadSchemas(); // TODO Remove after testing
- // schemaChecker.enableModificationsListening();
}
@@ -121,8 +139,6 @@
*/
public void stop( BundleContext context ) throws Exception
{
- System.out.println( "stop" );
-
// Saving the projects
PluginUtils.saveProjects();
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=556934&r1=556933&r2=556934
==============================================================================
--- 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 Tue Jul 17 07:44:41 2007
@@ -60,6 +60,8 @@
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_SCHEMA_NEW = "resources/icons/schema_new.gif";
+ public static final String IMG_SCHEMA_NEW_WIZARD = "resources/icons/schema_new_wizard.png";
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";
@@ -70,10 +72,21 @@
public static final String CMD_CONNECT = Activator.PLUGIN_ID + ".commands.connect";
public static final String CMD_CLOSE_PROJECT = Activator.PLUGIN_ID + ".commands.closeProject";
public static final String CMD_DELETE_PROJECT = Activator.PLUGIN_ID + ".commands.deleteProject";
+ public static final String CMD_DELETE_SCHEMA_ELEMENT = Activator.PLUGIN_ID + ".commands.deleteSchemaElement";
public static final String CMD_EXPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.exportProjects";
+ public static final String CMD_EXPORT_SCHEMAS_AS_OPENLDAP = Activator.PLUGIN_ID
+ + ".commands.exportSchemasAsOpenLDAP";
+ public static final String CMD_EXPORT_SCHEMAS_AS_XML = Activator.PLUGIN_ID + ".commands.exportSchemasAsXML";
public static final String CMD_IMPORT_PROJECTS = Activator.PLUGIN_ID + ".commands.importProjects";
+ public static final String CMD_IMPORT_SCHEMAS_FROM_OPENLDAP = Activator.PLUGIN_ID
+ + ".commands.importSchemasFromOpenLDAP";
+ public static final String CMD_IMPORT_SCHEMAS_FROM_XML = Activator.PLUGIN_ID + ".commands.importSchemasFromXML";
+ public static final String CMD_OPEN_ELEMENT = Activator.PLUGIN_ID + ".commands.openElement";
public static final String CMD_OPEN_PROJECT = Activator.PLUGIN_ID + ".commands.openProject";
+ public static final String CMD_NEW_ATTRIBUTE_TYPE = Activator.PLUGIN_ID + ".commands.newAttributeType";
+ public static final String CMD_NEW_OBJECT_CLASS = Activator.PLUGIN_ID + ".commands.newObjectClass";
public static final String CMD_NEW_PROJECT = Activator.PLUGIN_ID + ".commands.newProject";
+ public static final String CMD_NEW_SCHEMA = Activator.PLUGIN_ID + ".commands.newSchema";
public static final String CMD_RENAME_PROJECT = Activator.PLUGIN_ID + ".commands.renameProject";
// Preferences
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProblemsViewController.java Tue Jul 17 07:44:41 2007
@@ -89,7 +89,7 @@
*/
private void initToolbar()
{
-// IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+ // IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
}
@@ -173,26 +173,31 @@
*/
private void initSchemaCheckerListener()
{
- Activator.getDefault().getSchemaChecker().addListener( new SchemaCheckerListener()
+ SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+
+ if ( schemaChecker != null )
{
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaCheckerListener#schemaCheckerUpdated()
- */
- public void schemaCheckerUpdated()
+ schemaChecker.addListener( new SchemaCheckerListener()
{
- Display.getDefault().asyncExec( new Runnable()
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaCheckerListener#schemaCheckerUpdated()
+ */
+ public void schemaCheckerUpdated()
{
- public void run()
+ Display.getDefault().asyncExec( new Runnable()
{
- SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
- int errors = schemaChecker.getErrors().size();
- int warnings = schemaChecker.getWarnings().size();
-
- view.setErrorsAndWarningsCount( errors, warnings );
- view.reloadViewer();
- }
- } );
- }
- } );
+ public void run()
+ {
+ SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+ int errors = schemaChecker.getErrors().size();
+ int warnings = schemaChecker.getWarnings().size();
+
+ view.setErrorsAndWarningsCount( errors, warnings );
+ view.reloadViewer();
+ }
+ } );
+ }
+ } );
+ }
}
}
Modified: 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=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ProjectsViewController.java Tue Jul 17 07:44:41 2007
@@ -59,11 +59,11 @@
/** The associated view */
private ProjectsView view;
- /** The TableViewer */
- private TableViewer viewer;
-
/** The Context Menu */
private MenuManager contextMenu;
+
+ /** The TableViewer */
+ private TableViewer viewer;
/** The ProjectsHandler */
private ProjectsHandler projectsHandler;
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java Tue Jul 17 07:44:41 2007
@@ -44,9 +44,6 @@
*/
public class SchemaHandler
{
- /** The SchemaHandler instance */
- private static SchemaHandler instance;
-
//
// The Lists
//
@@ -87,7 +84,7 @@
/**
* Creates a new instance of SchemaHandler.
*/
- private SchemaHandler()
+ public SchemaHandler()
{
// Lists
schemasList = new ArrayList<Schema>();
@@ -112,23 +109,6 @@
/**
- * Gets the singleton instance of the SchemaHandler.
- *
- * @return
- * the singleton instance of the SchemaHandler
- */
- public static SchemaHandler getInstance()
- {
- if ( instance == null )
- {
- instance = new SchemaHandler();
- }
-
- return instance;
- }
-
-
- /**
* Gets the List of all the attribute types.
*
* @return
@@ -1076,5 +1056,19 @@
}
return false;
+ }
+
+
+ /**
+ * Verifies if the given name for a schema is already taken by another schema.
+ *
+ * @param name
+ * the name
+ * @return
+ * true if the the name is already taken
+ */
+ public boolean isSchemaNameAlreadyTaken( String name )
+ {
+ return schemasMap.containsKey( name.toLowerCase() );
}
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java Tue Jul 17 07:44:41 2007
@@ -21,6 +21,15 @@
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ConnectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.DeleteSchemaElementAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportSchemasAsOpenLdapAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportSchemasAsXmlAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportSchemasFromOpenLdapAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportSchemasFromXmlAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewAttributeTypeAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewObjectClassAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewSchemaAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenElementAction;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
@@ -31,12 +40,17 @@
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.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.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -53,8 +67,23 @@
/** The associated view */
private SchemaView view;
+ /** The Context Menu */
+ private MenuManager contextMenu;
+
+ /** The TreeViewer */
+ private TreeViewer viewer;
+
// The Actions
private Action connect;
+ private NewSchemaAction newSchema;
+ private NewAttributeTypeAction newAttributeType;
+ private NewObjectClassAction newObjectClass;
+ private OpenElementAction openElement;
+ private DeleteSchemaElementAction deleteSchemaElement;
+ private ImportSchemasFromOpenLdapAction importSchemasFromOpenLdap;
+ private ImportSchemasFromXmlAction importSchemasFromXml;
+ private ExportSchemasAsOpenLdapAction exportSchemasAsOpenLdap;
+ private ExportSchemasAsXmlAction exportSchemasAsXml;
/**
@@ -66,9 +95,11 @@
public SchemaViewController( SchemaView view )
{
this.view = view;
+ viewer = view.getViewer();
initActions();
initToolbar();
+ initContextMenu();
initDoubleClickListener();
}
@@ -79,6 +110,15 @@
private void initActions()
{
connect = new ConnectAction( view );
+ newSchema = new NewSchemaAction();
+ newAttributeType = new NewAttributeTypeAction();
+ newObjectClass = new NewObjectClassAction();
+ openElement = new OpenElementAction();
+ deleteSchemaElement = new DeleteSchemaElementAction();
+ importSchemasFromOpenLdap = new ImportSchemasFromOpenLdapAction();
+ importSchemasFromXml = new ImportSchemasFromXmlAction();
+ exportSchemasAsOpenLdap = new ExportSchemasAsOpenLdapAction();
+ exportSchemasAsXml = new ExportSchemasAsXmlAction();
}
@@ -89,6 +129,51 @@
{
IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
toolbar.add( connect );
+ toolbar.add( newSchema );
+ toolbar.add( newAttributeType );
+ toolbar.add( newObjectClass );
+ }
+
+
+ /**
+ * 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 newManager = new MenuManager( "New" );
+ MenuManager importManager = new MenuManager( "Import..." );
+ MenuManager exportManager = new MenuManager( "Export..." );
+ manager.add( newManager );
+ newManager.add( newSchema );
+ newManager.add( newAttributeType );
+ newManager.add( newObjectClass );
+ manager.add( new Separator() );
+ manager.add( openElement );
+ manager.add( new Separator() );
+ manager.add( deleteSchemaElement );
+ manager.add( new Separator() );
+ manager.add( importManager );
+ importManager.add( importSchemasFromOpenLdap );
+ importManager.add( importSchemasFromXml );
+ manager.add( exportManager );
+ exportManager.add( exportSchemasAsOpenLdap );
+ exportManager.add( exportSchemasAsXml );
+
+ manager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
+ }
+ } );
+
+ // 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 );
}
@@ -105,7 +190,7 @@
TreeViewer viewer = view.getViewer();
- // What we get from the treeViewer is a StructuredSelection
+ // What we get from the viewer is a StructuredSelection
StructuredSelection selection = ( StructuredSelection ) event.getSelection();
// Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
@@ -140,8 +225,8 @@
}
catch ( PartInitException e )
{
-// logger.debug( "error when opening the editor" ); //$NON-NLS-1$
- e.printStackTrace();
+ // logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+ e.printStackTrace();
}
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteSchemaElementAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteSchemaElementAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteSchemaElementAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteSchemaElementAction.java Tue Jul 17 07:44:41 2007
@@ -0,0 +1,98 @@
+/*
+ * 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.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action deletes one or more Schema Elements from the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteSchemaElementAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of DeleteSchemaElementAction.
+ */
+ public DeleteSchemaElementAction()
+ {
+ super( "Delete" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_DELETE_SCHEMA_ELEMENT );
+ setImageDescriptor( AbstractUIPlugin
+ .imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_DELETE ) );
+ setEnabled( true );
+ }
+
+
+ /* (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
+ }
+}
Modified: 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=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportProjectsAction.java Tue Jul 17 07:44:41 2007
@@ -47,7 +47,7 @@
*/
public ExportProjectsAction()
{
- super( "Export Schema Projects" );
+ super( "Schema Projects" );
setToolTipText( getText() );
setId( PluginConstants.CMD_EXPORT_PROJECTS );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java Tue Jul 17 07:44:41 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.ExportSchemasAsOpenLdapWizard;
+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 ExportSchemasAsOpenLdapWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSchemasAsOpenLdapAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of ExportSchemasAsOpenLdapAction.
+ */
+ public ExportSchemasAsOpenLdapAction()
+ {
+ 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 );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Instantiates and initializes the wizard
+ ExportSchemasAsOpenLdapWizard wizard = new ExportSchemasAsOpenLdapWizard();
+ 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/ExportSchemasAsXmlAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java Tue Jul 17 07:44:41 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.ExportSchemasAsXmlWizard;
+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 ExportSchemasAsXmlWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSchemasAsXmlAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of ExportSchemasAsXmlAction.
+ */
+ public ExportSchemasAsXmlAction()
+ {
+ 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 );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Instantiates and initializes the wizard
+ ExportSchemasAsXmlWizard wizard = new ExportSchemasAsXmlWizard();
+ 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
+ }
+}
Modified: 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=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportProjectsAction.java Tue Jul 17 07:44:41 2007
@@ -47,7 +47,7 @@
*/
public ImportProjectsAction()
{
- super( "Import Schema Projects" );
+ super( "Schema Projects" );
setToolTipText( getText() );
setId( PluginConstants.CMD_IMPORT_PROJECTS );
setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromOpenLdapAction.java Tue Jul 17 07:44:41 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.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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ImportSchemasFromXmlAction.java Tue Jul 17 07:44:41 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.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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewAttributeTypeAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewAttributeTypeAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewAttributeTypeAction.java Tue Jul 17 07:44:41 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.NewAttributeTypeWizard;
+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 NewAttributeTypeWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewAttributeTypeAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of NewAttributeTypeAction.
+ */
+ public NewAttributeTypeAction()
+ {
+ super( "New Attribute Type" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_NEW_ATTRIBUTE_TYPE );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_ATTRIBUTE_TYPE_NEW ) );
+ setEnabled( true );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Instantiates and initializes the wizard
+ NewAttributeTypeWizard wizard = new NewAttributeTypeWizard();
+ 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/NewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewObjectClassAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewObjectClassAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewObjectClassAction.java Tue Jul 17 07:44:41 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.NewObjectClassWizard;
+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 NewObjectClassWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewObjectClassAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of NewObjectClassAction.
+ */
+ public NewObjectClassAction()
+ {
+ super( "New Object Class" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_NEW_OBJECT_CLASS );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_OBJECT_CLASS_NEW ) );
+ setEnabled( true );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ // Instantiates and initializes the wizard
+ NewObjectClassWizard wizard = new NewObjectClassWizard();
+ 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/NewSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewSchemaAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewSchemaAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/NewSchemaAction.java Tue Jul 17 07:44:41 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.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 Schema" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_NEW_SCHEMA );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_SCHEMA_NEW ) );
+ setEnabled( true );
+ }
+
+
+ /* (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
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java Tue Jul 17 07:44:41 2007
@@ -0,0 +1,94 @@
+/*
+ * 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.PluginConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This action opens the selected element in the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenElementAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /**
+ * Creates a new instance of DeleteSchemaElementAction.
+ */
+ public OpenElementAction()
+ {
+ super( "Open" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_OPEN_ELEMENT );
+ setEnabled( true );
+ }
+
+
+ /* (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
+ }
+}
Modified: 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=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Project.java Tue Jul 17 07:44:41 2007
@@ -20,6 +20,10 @@
package org.apache.directory.studio.apacheds.schemaeditor.model;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaChecker;
+
+
/**
* This class implements a Project.
*
@@ -65,6 +69,12 @@
/** The state of the project */
private ProjectState state;
+ /** The SchemaHandler */
+ private SchemaHandler schemaHandler;
+
+ /** The SchemaCheker */
+ private SchemaChecker schemaChecker;
+
/**
* Creates a new instance of Project.
@@ -79,6 +89,8 @@
this.type = type;
this.name = name;
this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
}
@@ -90,6 +102,8 @@
{
type = ProjectType.OFFLINE;
this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
}
@@ -103,6 +117,8 @@
{
this.type = type;
this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
}
@@ -175,6 +191,30 @@
public void setState( ProjectState state )
{
this.state = state;
+ }
+
+
+ /**
+ * Gets the SchemaHandler
+ *
+ * @return
+ * the SchemaHandler
+ */
+ public SchemaHandler getSchemaHandler()
+ {
+ return schemaHandler;
+ }
+
+
+ /**
+ * Gets the SchemaChecker
+ *
+ * @return
+ * the SchemaChecker
+ */
+ public SchemaChecker getSchemaChecker()
+ {
+ return schemaChecker;
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java Tue Jul 17 07:44:41 2007
@@ -165,6 +165,7 @@
{
if ( !listeningToModifications )
{
+ schemaHandler = Activator.getDefault().getSchemaHandler();
schemaHandler.addListener( schemaHandlerListener );
listeningToModifications = true;
checkWholeSchema();
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsView.java Tue Jul 17 07:44:41 2007
@@ -22,6 +22,7 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.controller.ProblemsViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaChecker;
import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ProblemsViewRoot;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -103,8 +104,6 @@
contentProvider = new ProblemsViewContentProvider( treeViewer );
treeViewer.setContentProvider( contentProvider );
treeViewer.setLabelProvider( new ProblemsViewLabelProvider() );
- treeViewer.setInput( new ProblemsViewRoot() );
- treeViewer.expandAll();
}
@@ -136,6 +135,8 @@
{
treeViewer.setInput( new ProblemsViewRoot() );
treeViewer.expandAll();
+ SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+ setErrorsAndWarningsCount( schemaChecker.getErrors().size(), schemaChecker.getWarnings().size() );
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java Tue Jul 17 07:44:41 2007
@@ -116,7 +116,6 @@
treeViewer.setContentProvider( contentProvider );
treeViewer.setLabelProvider( new DecoratingLabelProvider( new SchemaViewLabelProvider(), Activator.getDefault()
.getWorkbench().getDecoratorManager().getLabelDecorator() ) );
- treeViewer.setInput( new SchemaViewRoot() );
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java?view=diff&rev=556934&r1=556933&r2=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java Tue Jul 17 07:44:41 2007
@@ -22,7 +22,7 @@
import java.util.List;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
@@ -103,7 +103,7 @@
if ( root.getChildren().isEmpty() )
{
- List<Schema> schemas = SchemaHandler.getInstance().getSchemas();
+ List<Schema> schemas = Activator.getDefault().getSchemaHandler().getSchemas();
for ( Schema schema : schemas )
{
root.addChild( new SchemaWrapper( schema, root ) );
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizard.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizard.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizard.java Tue Jul 17 07:44:41 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaImpl;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * This class represents the wizard to create a new Schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewSchemaWizard extends Wizard implements INewWizard
+{
+ // The pages of the wizard
+ private NewSchemaWizardPage page;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages()
+ {
+ // Creating pages
+ page = new NewSchemaWizardPage();
+
+ // Adding pages
+ addPage( page );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish()
+ {
+ SchemaImpl schema = new SchemaImpl( page.getSchemaName() );
+ Activator.getDefault().getSchemaHandler().addSchema( schema );
+
+ 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 )
+ {
+ // Nothing to do.
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizardPage.java?view=auto&rev=556934
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizardPage.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewSchemaWizardPage.java Tue Jul 17 07:44:41 2007
@@ -0,0 +1,152 @@
+/*
+ * 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.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents the WizardPage of the NewSchemaWizard.
+ * <p>
+ * It is used to let the user create a new Schema
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewSchemaWizardPage extends WizardPage
+{
+ /** The ProjectsHandler */
+ private SchemaHandler schemaHandler;
+
+ // UI Fields
+ private Text nameText;
+
+
+ /**
+ * Creates a new instance of NewProjectWizardPage.
+ */
+ protected NewSchemaWizardPage()
+ {
+ super( "NewSchemaWizardPage" );
+ setTitle( "Create a Schema" );
+ setDescription( "Please specify a name to create a new schema." );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_SCHEMA_NEW_WIZARD ) );
+ schemaHandler = Activator.getDefault().getSchemaHandler();
+ }
+
+
+ /* (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( 2, false );
+ composite.setLayout( layout );
+
+ // Name
+ Label nameLabel = new Label( composite, SWT.NONE );
+ nameLabel.setText( "Schema name:" );
+ nameText = new Text( composite, SWT.BORDER );
+ nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ nameText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dialogChanged();
+ }
+ } );
+
+ initFields();
+
+ setControl( composite );
+ }
+
+
+ /**
+ * Initializes the UI Fields.
+ */
+ private void initFields()
+ {
+ displayErrorMessage( null );
+ setPageComplete( false );
+ }
+
+
+ /**
+ * This method is called when the user modifies something in the UI.
+ */
+ private void dialogChanged()
+ {
+ // Name
+ if ( nameText.getText().equals( "" ) )
+ {
+ displayErrorMessage( "A name must be specified." );
+ return;
+ }
+ else if ( schemaHandler.isSchemaNameAlreadyTaken( nameText.getText() ) )
+ {
+ displayErrorMessage( "A schema with this name already exists." );
+ 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 name of the schema.
+ *
+ * @return
+ * the name of the schema
+ */
+ public String getSchemaName()
+ {
+ return nameText.getText();
+ }
+}