You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC
svn commit: r592094 [2/35] - in
/directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/directory/
src/main/java/org/apache/directory/studio/ src/ma...
Added: directory/sandbox/felixk/studio-schemaeditor/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/pom.xml?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/pom.xml (added)
+++ directory/sandbox/felixk/studio-schemaeditor/pom.xml Mon Nov 5 09:14:24 2007
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ @version $Id: pom.xml 353 2007-10-28 14:59:35Z felix $
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ </parent>
+ <artifactId>${groupId}.schemaeditor</artifactId>
+ <name>Apache Directory Studio Schema Editor</name>
+ <packaging>jar</packaging>
+
+ <description></description>
+
+ <!-- Set path for local repository -->
+ <properties>
+ <local-repo>${project.basedir}/../local-repository</local-repo>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>prepare-for-eclipse</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-for-eclipse</id>
+ <phase>install</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <overWrite>true</overWrite>
+ <outputDirectory>lib</outputDirectory>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-converter</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-core-plugin</artifactId>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.properties</include>
+ <include>plugin.xml</include>
+ <include>about.ini</include>
+ <include>studio.png</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <overWrite>true</overWrite>
+ <outputDirectory>target/classes/lib</outputDirectory>
+ <artifactItems>
+ <artifactItem>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-converter</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-core-plugin</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>checkstyle</groupId>
+ <artifactId>checkstyle</artifactId>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.jface</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.jface.text</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui.forms</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.text</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.equinox.preferences</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-converter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.core.runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui.editors</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>${pom.groupId}.connection.ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.search</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-core-plugin</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: directory/sandbox/felixk/studio-schemaeditor/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.controller.ProjectsHandler;
+import org.apache.directory.studio.schemaeditor.controller.ProjectsHandlerListener;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.schema.SchemaEditor;
+import org.apache.directory.studio.schemaeditor.view.widget.SchemaCodeScanner;
+import org.apache.directory.studio.schemaeditor.view.widget.SchemaTextAttributeProvider;
+import org.eclipse.jface.text.rules.ITokenScanner;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Activator extends AbstractUIPlugin
+{
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.apache.directory.studio.schemaeditor"; //$NON-NLS-1$
+
+ /** The shared instance */
+ private static Activator plugin;
+
+ /** the Schema Code Scanner */
+ private ITokenScanner schemaCodeScanner;
+
+ /** The Schema Text Attribute Provider */
+ private SchemaTextAttributeProvider schemaTextAttributeProvider;
+
+ /** The SchemaHandler */
+ private SchemaHandler schemaHandler;
+
+ /** The SchemaCheker */
+ private SchemaChecker schemaChecker;
+
+ /** The ProjectsHandler */
+ private ProjectsHandler projectsHandler;
+
+
+ /**
+ * Creates a new instance of Activator.
+ */
+ public Activator()
+ {
+ plugin = this;
+ projectsHandler = ProjectsHandler.getInstance();
+ }
+
+
+ /**
+ * Closes the project editors.
+ */
+ private void closeProjectEditors()
+ {
+ // Listing all the editors from the Schema Editor Plugin.
+ List<IEditorReference> editors = new ArrayList<IEditorReference>();
+ for ( IEditorReference editorReference : getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences() )
+ {
+ if ( ( editorReference.getId().equals( AttributeTypeEditor.ID ) )
+ || ( editorReference.getId().equals( ObjectClassEditor.ID ) )
+ || ( editorReference.getId().equals( SchemaEditor.ID ) ) )
+ {
+ editors.add( editorReference );
+ }
+ }
+
+ // Closing the opened editors
+ if ( !getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditors(
+ editors.toArray( new IEditorReference[0] ), true ) )
+ {
+ // If all the editors have not been closed, we force them to be closed.
+ getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditors(
+ editors.toArray( new IEditorReference[0] ), false );
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+
+ // Loading the projects
+ PluginUtils.loadProjects();
+
+ projectsHandler.addListener( new ProjectsHandlerListener()
+ {
+ public void openProjectChanged( Project oldProject, Project newProject )
+ {
+ closeProjectEditors();
+
+ if ( newProject == null )
+ {
+ schemaHandler = null;
+ schemaChecker = null;
+ }
+ else
+ {
+ // Registering the SchemaHandler and SchemaChecker
+ schemaHandler = newProject.getSchemaHandler();
+ schemaChecker = newProject.getSchemaChecker();
+ }
+
+ PluginUtils.saveProjects();
+ }
+
+
+ public void projectAdded( Project project )
+ {
+ PluginUtils.saveProjects();
+ }
+
+
+ public void projectRemoved( Project project )
+ {
+ PluginUtils.saveProjects();
+ }
+ } );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ // Saving the projects
+ PluginUtils.saveProjects();
+
+ super.stop( context );
+ plugin = null;
+ }
+
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return
+ * the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+
+ /**
+ * Gets the SchemaHandler
+ *
+ * @return
+ * the SchemaHandler
+ */
+ public SchemaHandler getSchemaHandler()
+ {
+ return schemaHandler;
+ }
+
+
+ /**
+ * Gets the SchemaChecker
+ *
+ * @return
+ * the SchemaChecker
+ */
+ public SchemaChecker getSchemaChecker()
+ {
+ return schemaChecker;
+ }
+
+
+ /**
+ * Gets the ProjectsHandler
+ *
+ * @return
+ * the ProjectsHandler
+ */
+ public ProjectsHandler getProjectsHandler()
+ {
+ return projectsHandler;
+ }
+
+
+ /**
+ * Returns the Schema Code Scanner.
+ *
+ * @return
+ * the Schema Code Scanner
+ */
+ public ITokenScanner getSchemaCodeScanner()
+ {
+ if ( schemaCodeScanner == null )
+ {
+ schemaCodeScanner = new SchemaCodeScanner( getSchemaTextAttributeProvider() );
+ }
+
+ return schemaCodeScanner;
+ }
+
+
+ /**
+ * Returns the Schema Text Attribute Provider.
+ *
+ * @return
+ * the Schema Text Attribute Provider
+ */
+ private SchemaTextAttributeProvider getSchemaTextAttributeProvider()
+ {
+ if ( schemaTextAttributeProvider == null )
+ {
+ schemaTextAttributeProvider = new SchemaTextAttributeProvider();
+ }
+
+ return schemaTextAttributeProvider;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor;
+
+
+import org.apache.directory.studio.schemaeditor.view.preferences.HierarchyViewPreferencePage;
+import org.apache.directory.studio.schemaeditor.view.preferences.SchemaViewPreferencePage;
+import org.apache.directory.studio.schemaeditor.view.preferences.SearchViewPreferencePage;
+
+
+/**
+ * This interface contains all the Constants used in the Plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface PluginConstants
+{
+ // Images
+ public static final String IMG_ATTRIBUTE_TYPE = "resources/icons/attribute_type.gif";
+ public static final String IMG_ATTRIBUTE_TYPE_HIERARCHY_SELECTED = "resources/icons/attribute_type_hierarchy_selected.gif";
+ 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_ATTRIBUTE_TYPE_OVERLAY_OPERATION = "resources/icons/attribute_type_overlay_operation.gif";
+ public static final String IMG_ATTRIBUTE_TYPE_OVERLAY_USER_APPLICATION = "resources/icons/attribute_type_overlay_userApplication.gif";
+ public static final String IMG_CONNECT = "resources/icons/connect.gif";
+ public static final String IMG_COMMIT_CHANGES = "resources/icons/commit_changes.gif";
+ public static final String IMG_COMMIT_CHANGES_WIZARD = "resources/icons/commit_changes_wizard.png";
+ public static final String IMG_COLLAPSE_ALL = "resources/icons/collapse_all.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_ATTRIBUTE_TYPE_ADD = "resources/icons/difference_attribute_type_add.gif";
+ public static final String IMG_DIFFERENCE_ATTRIBUTE_TYPE_MODIFY = "resources/icons/difference_attribute_type_modify.gif";
+ public static final String IMG_DIFFERENCE_ATTRIBUTE_TYPE_REMOVE = "resources/icons/difference_attribute_type_remove.gif";
+ public static final String IMG_DIFFERENCE_OBJECT_CLASS_ADD = "resources/icons/difference_object_class_add.gif";
+ public static final String IMG_DIFFERENCE_OBJECT_CLASS_MODIFY = "resources/icons/difference_object_class_modify.gif";
+ public static final String IMG_DIFFERENCE_OBJECT_CLASS_REMOVE = "resources/icons/difference_object_class_remove.gif";
+ public static final String IMG_DIFFERENCE_PROPERTY_ADD = "resources/icons/difference_property_add.gif";
+ public static final String IMG_DIFFERENCE_PROPERTY_MODIFY = "resources/icons/difference_property_modify.gif";
+ public static final String IMG_DIFFERENCE_PROPERTY_REMOVE = "resources/icons/difference_property_remove.gif";
+ public static final String IMG_DIFFERENCE_SCHEMA_ADD = "resources/icons/difference_schema_add.gif";
+ public static final String IMG_DIFFERENCE_SCHEMA_MODIFY = "resources/icons/difference_schema_modify.gif";
+ public static final String IMG_DIFFERENCE_SCHEMA_REMOVE = "resources/icons/difference_schema_remove.gif";
+ public static final String IMG_FOLDER = "resources/icons/folder.gif";
+ public static final String IMG_FOLDER_AT = "resources/icons/folder_at.gif";
+ public static final String IMG_FOLDER_OC = "resources/icons/folder_oc.gif";
+ public static final String IMG_LINK_WITH_EDITOR = "resources/icons/link_with_editor.gif";
+ public static final String IMG_OBJECT_CLASS = "resources/icons/object_class.gif";
+ public static final String IMG_OBJECT_CLASS_HIERARCHY_SELECTED = "resources/icons/object_class_hierarchy_selected.gif";
+ public static final String IMG_OBJECT_CLASS_NEW = "resources/icons/object_class_new.gif";
+ public static final String IMG_OBJECT_CLASS_NEW_WIZARD = "resources/icons/object_class_new_wizard.png";
+ public static final String IMG_OBJECT_CLASS_OVERLAY_ABSTRACT = "resources/icons/object_class_overlay_abstract.gif";
+ public static final String IMG_OBJECT_CLASS_OVERLAY_AUXILIARY = "resources/icons/object_class_overlay_auxiliary.gif";
+ public static final String IMG_OBJECT_CLASS_OVERLAY_STRUCTURAL = "resources/icons/object_class_overlay_structural.gif";
+ public static final String IMG_OVERLAY_ERROR = "resources/icons/overlay_error.gif";
+ public static final String IMG_OVERLAY_WARNING = "resources/icons/overlay_warning.gif";
+ 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_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_FILE = "resources/icons/project_file.gif";
+ 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_PROJECT_ONLINE = "resources/icons/project_online.gif";
+ public static final String IMG_PROJECT_ONLINE_CLOSED = "resources/icons/project_online_closed.gif";
+ public static final String IMG_RENAME = "resources/icons/rename.gif";
+ public static final String IMG_RUN_CURRENT_SEARCH_AGAIN = "resources/icons/run_current_search_again.gif";
+ public static final String IMG_SCHEMA = "resources/icons/schema.gif";
+ public static final String IMG_SCHEMA_CONNECTOR = "resources/icons/schema_connector.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_FOR_ADS = "resources/icons/schemas_export_for_ads.gif";
+ public static final String IMG_SCHEMAS_EXPORT_FOR_ADS_WIZARD = "resources/icons/schemas_export_for_ads_wizard.png";
+ 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_SEARCH = "resources/icons/search.gif";
+ public static final String IMG_SEARCH_HISTORY_ITEM = "resources/icons/search_history_item.gif";
+ public static final String IMG_SHOW_SEARCH_FIELD = "resources/icons/show_search_field.gif";
+ public static final String IMG_SHOW_SEARCH_HISTORY = "resources/icons/show_search_history.gif";
+ public static final String IMG_SHOW_SUBTYPE_HIERARCHY = "resources/icons/hierarchy_subtype.gif";
+ public static final String IMG_SHOW_SUPERTYPE_HIERARCHY = "resources/icons/hierarchy_supertype.gif";
+ public static final String IMG_SHOW_TYPE_HIERARCHY = "resources/icons/hierarchy_type.gif";
+ public static final String IMG_SORTING = "resources/icons/sorting.gif";
+ public static final String IMG_TOOLBAR_MENU = "resources/icons/toolbar_menu.gif";
+ public static final String IMG_TRANSPARENT_16X16 = "resources/icons/transparent_16x16.gif";
+ public static final String IMG_WARNING_32X32 = "resources/icons/warning_32x32.png";
+
+ // Commands
+ public static final String CMD_COMMIT_CHANGES = Activator.PLUGIN_ID + ".commands.commitChanges";
+ 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_COLLAPSE_ALL = Activator.PLUGIN_ID + ".commands.collapseAll";
+ 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_EXPORT_SCHEMAS_FOR_ADS = Activator.PLUGIN_ID + ".commands.exportSchemasForADS";
+ 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_LINK_WITH_EDITOR_SCHEMA_VIEW = Activator.PLUGIN_ID
+ + ".commands.linkWithEditorSchemaView";
+ public static final String CMD_LINK_WITH_EDITOR_HIERARCHY_VIEW = Activator.PLUGIN_ID
+ + ".commands.linkWithEditorHierarchyView";
+ public static final String CMD_OPEN_ELEMENT = Activator.PLUGIN_ID + ".commands.openElement";
+ public static final String CMD_OPEN_HIERARCHY_VIEW_PREFERENCES = Activator.PLUGIN_ID
+ + ".commands.openHierarchyViewPreference";
+ public static final String CMD_OPEN_PROJECT = Activator.PLUGIN_ID + ".commands.openProject";
+ public static final String CMD_OPEN_SCHEMA_VIEW_PREFERENCE = Activator.PLUGIN_ID
+ + ".commands.openSchemaViewPreference";
+ public static final String CMD_OPEN_SCHEMA_VIEW_SORTING_DIALOG = Activator.PLUGIN_ID
+ + ".commands.openSchemaViewSortingDialog";
+ public static final String CMD_OPEN_SEARCH_VIEW_PREFERENCE = Activator.PLUGIN_ID
+ + ".commands.openSearchViewPreference";
+ public static final String CMD_OPEN_SEARCH_VIEW_SORTING_DIALOG = Activator.PLUGIN_ID
+ + ".commands.openSearchViewSortingDialog";
+ public static final String CMD_OPEN_TYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.openTypeHierarchy";
+ 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";
+ public static final String CMD_RUN_CURRENT_SEARCH_AGAIN = Activator.PLUGIN_ID + ".commands.runCurrentSearchAgain";
+ public static final String CMD_SHOW_SEARCH_FIELD = Activator.PLUGIN_ID + ".commands.showSearchField";
+ public static final String CMD_SHOW_SEARCH_HISTORY = Activator.PLUGIN_ID + ".commands.showSearchHistory";
+ public static final String CMD_SHOW_SUBTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSubTypeHierarchy";
+ public static final String CMD_SHOW_SUPERTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSuperTypeHierarchy";
+ public static final String CMD_SHOW_TYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSubTypeHierarchy";
+ public static final String CMD_SWITCH_SCHEMA_PRESENTATION_TO_FLAT = Activator.PLUGIN_ID
+ + ".commands.switchSchemaPresentationToFlat";
+ public static final String CMD_SWITCH_SCHEMA_PRESENTATION_TO_HIERARCHICAL = Activator.PLUGIN_ID
+ + ".commands.switchSchemaPresentationToHierarchical";
+
+ // Preferences - DifferencesWidget
+ /** The preferences ID for DifferencesWidget Grouping */
+ public static final String PREFS_DIFFERENCES_WIDGET_GROUPING = Activator.PLUGIN_ID
+ + ".prefs.DifferencesWidget.grouping";
+ /** The preference value for DifferencesWidget Grouping 'Property' */
+ public static final int PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY = 0;
+ /** The preference value for DifferencesWidget Grouping 'Property' */
+ public static final int PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE = 1;
+
+ // Preferences - SchemaView
+ /** The preference ID for Schema View Schema Presentation */
+ public static final String PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION = SchemaViewPreferencePage.ID
+ + ".schemaPresentation"; //$NON-NLS-1$
+ /** The preference value for Schema View Schema Presentation 'Flat' */
+ public static final int PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT = 0;
+ /** The preference value for Schema View Schema Presentation 'Hierarchical' */
+ public static final int PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL = 1;
+ /** The preference ID for Schema View Label */
+ public static final String PREFS_SCHEMA_VIEW_LABEL = SchemaViewPreferencePage.ID + ".label.labelValue"; //$NON-NLS-1$
+ /** The preference value for Schema View First Name label */
+ public static final int PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME = 0;
+ /** The preference value for Schema View All Aliases label */
+ public static final int PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES = 1;
+ /** The preference value for Schema View OID label */
+ public static final int PREFS_SCHEMA_VIEW_LABEL_OID = 2;
+ /** The preference ID for Schema View Abbreviate */
+ public static final String PREFS_SCHEMA_VIEW_ABBREVIATE = SchemaViewPreferencePage.ID + ".label.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Schema View Abbreviate Max Length*/
+ public static final String PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH = SchemaViewPreferencePage.ID
+ + ".label.abbreviate.maxLength"; //$NON-NLS-1$
+ /** The preference ID for Schema View Display Secondary Label */
+ public static final String PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY = SchemaViewPreferencePage.ID
+ + ".secondaryLabel.display"; //$NON-NLS-1$
+ /** The preference ID for Schema View Secondary Label */
+ public static final String PREFS_SCHEMA_VIEW_SECONDARY_LABEL = SchemaViewPreferencePage.ID
+ + ".secondaryLabel.labelValue"; //$NON-NLS-1$
+ /** The preference ID for Schema View Abbreviate Secondary Label */
+ public static final String PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE = SchemaViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Schema View Abbreviate Secondary Label Max Length*/
+ public static final String PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH = SchemaViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate.maxLength"; //$NON-NLS-1$
+ public static final String PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY = SchemaViewPreferencePage.ID
+ + ".schemaLabel.display"; //$NON-NLS-1$
+ /** The preference ID for Schema View Grouping */
+ public static final String PREFS_SCHEMA_VIEW_GROUPING = Activator.PLUGIN_ID + ".preferences.SchemaView.grouping"; //$NON-NLS-1$
+ /** The preference value for Schema View Grouping 'group ATs and OCs in folders' */
+ public static final int PREFS_SCHEMA_VIEW_GROUPING_FOLDERS = 0;
+ /** The preference value for Schema View Grouping 'mixed' */
+ public static final int PREFS_SCHEMA_VIEW_GROUPING_MIXED = 1;
+ /** The preference ID for Schema View Sorting By */
+ public static final String PREFS_SCHEMA_VIEW_SORTING_BY = Activator.PLUGIN_ID + ".preferences.SchemaView.sortingBy"; //$NON-NLS-1$
+ /** The preference value for Schema View Sorting 'First Name' */
+ public static final int PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME = 0;
+ /** The preference value for Schema View Sorting 'OID' */
+ public static final int PREFS_SCHEMA_VIEW_SORTING_BY_OID = 1;
+ /** The preference ID for Sorting Order */
+ public static final String PREFS_SCHEMA_VIEW_SORTING_ORDER = Activator.PLUGIN_ID
+ + ".preferences.SchemaView.sortingOrder"; //$NON-NLS-1$
+ /** The preference value for Schema View Sorting 'ascending' */
+ public static final int PREFS_SCHEMA_VIEW_SORTING_ORDER_ASCENDING = 0;
+ /** The preference value for Schema View Sorting 'descending' */
+ public static final int PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING = 1;
+
+ // Preferences - Hierarchy View
+ /** The preference ID for Mode of the Hierarchy View */
+ public static final String PREFS_HIERARCHY_VIEW_MODE = Activator.PLUGIN_ID + ".preferences.HierarchyView.mode"; //$NON-NLS-1$
+ /** The preference value for Hierarchy View Mode 'Supertype' */
+ public static final int PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE = 0;
+ /** The preference value for Hierarchy View Mode 'Subtype' */
+ public static final int PREFS_HIERARCHY_VIEW_MODE_SUBTYPE = 1;
+ /** The preference value for Hierarchy View Mode 'Type' */
+ public static final int PREFS_HIERARCHY_VIEW_MODE_TYPE = 2;
+ /** The preference ID for Hierarchy View Label */
+ public static final String PREFS_HIERARCHY_VIEW_LABEL = HierarchyViewPreferencePage.ID + ".label.labelValue"; //$NON-NLS-1$
+ /** The preference value for Hierarchy View First Name label */
+ public static final int PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME = 0;
+ /** The preference value for Hierarchy View All Aliases label */
+ public static final int PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES = 1;
+ /** The preference value for Hierarchy View OID label */
+ public static final int PREFS_HIERARCHY_VIEW_LABEL_OID = 2;
+ /** The preference ID for Hierarchy View Abbreviate */
+ public static final String PREFS_HIERARCHY_VIEW_ABBREVIATE = HierarchyViewPreferencePage.ID + ".label.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Hierarchy View Abbreviate Max Length*/
+ public static final String PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH = HierarchyViewPreferencePage.ID
+ + ".label.abbreviate.maxLength"; //$NON-NLS-1$
+ /** The preference ID for Hierarchy View Display Secondary Label */
+ public static final String PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY = HierarchyViewPreferencePage.ID
+ + ".secondaryLabel.display"; //$NON-NLS-1$
+ /** The preference ID for Hierarchy View Secondary Label */
+ public static final String PREFS_HIERARCHY_VIEW_SECONDARY_LABEL = HierarchyViewPreferencePage.ID
+ + ".secondaryLabel.labelValue"; //$NON-NLS-1$
+ /** The preference ID for Hierarchy View Abbreviate Secondary Label */
+ public static final String PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE = HierarchyViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Hierarchy View Abbreviate Secondary Label Max Length*/
+ public static final String PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH = HierarchyViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate.maxLength"; //$NON-NLS-1$
+
+ // Search - SearchPage
+ /** The preference ID for Search History of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_HISTORY = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.searchHistory"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Aliases' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeAliases"; //$NON-NLS-1$
+ /** The preference ID for Search In 'OID' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_OID = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeOid"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Description' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeDescription"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Superior' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeSuperior"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Syntax' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeSyntax"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Matching Rules' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeMatchingRules"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Superiors' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeSuperiors"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Mandatory Attributes' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeMandatoryAttributes"; //$NON-NLS-1$
+ /** The preference ID for Search In 'Optional Attributes' of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES = Activator.PLUGIN_ID
+ + ".preferences.SearchPage.scopeOptionalAttributes"; //$NON-NLS-1$
+ /** The preference ID for Scope of the SearchPage */
+ public static final String PREFS_SEARCH_PAGE_SCOPE = Activator.PLUGIN_ID + ".preferences.SearchPage.scope"; //$NON-NLS-1$
+ /** The preference value for Scope Attribute Types And Object Classes of the SearchPage */
+ public static final int PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC = 0;
+ /** The preference value for Scope Attribute Types only of the SearchPage */
+ public static final int PREFS_SEARCH_PAGE_SCOPE_AT_ONLY = 1;
+ /** The preference value for Scope Object Classes only of the SearchPage */
+ public static final int PREFS_SEARCH_PAGE_SCOPE_OC_ONLY = 2;
+
+ // Preferences - SearchView
+ /** The preference ID for Search View Label */
+ public static final String PREFS_SEARCH_VIEW_LABEL = SearchViewPreferencePage.ID + ".label.labelValue"; //$NON-NLS-1$
+ /** The preference value for Search View First Name label */
+ public static final int PREFS_SEARCH_VIEW_LABEL_FIRST_NAME = 0;
+ /** The preference value for Search View All Aliases label */
+ public static final int PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES = 1;
+ /** The preference value for Search View OID label */
+ public static final int PREFS_SEARCH_VIEW_LABEL_OID = 2;
+ /** The preference ID for Search View Abbreviate */
+ public static final String PREFS_SEARCH_VIEW_ABBREVIATE = SearchViewPreferencePage.ID + ".label.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Search View Abbreviate Max Length*/
+ public static final String PREFS_SEARCH_VIEW_ABBREVIATE_MAX_LENGTH = SearchViewPreferencePage.ID
+ + ".label.abbreviate.maxLength"; //$NON-NLS-1$
+ /** The preference ID for Search View Display Secondary Label */
+ public static final String PREFS_SEARCH_VIEW_SECONDARY_LABEL_DISPLAY = SearchViewPreferencePage.ID
+ + ".secondaryLabel.display"; //$NON-NLS-1$
+ /** The preference ID for Search View Secondary Label */
+ public static final String PREFS_SEARCH_VIEW_SECONDARY_LABEL = SearchViewPreferencePage.ID
+ + ".secondaryLabel.labelValue"; //$NON-NLS-1$
+ /** The preference ID for Search View Abbreviate Secondary Label */
+ public static final String PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE = SearchViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate"; //$NON-NLS-1$
+ /** The preference ID for Search View Abbreviate Secondary Label Max Length*/
+ public static final String PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH = SearchViewPreferencePage.ID
+ + ".secondaryLabel.abbreviate.maxLength"; //$NON-NLS-1$
+ /** The preference ID for Search View Grouping */
+ public static final String PREFS_SEARCH_VIEW_GROUPING = Activator.PLUGIN_ID + ".preferences.SearchView.grouping"; //$NON-NLS-1$
+ /** The preference value for Search View Grouping 'Display ATs first' */
+ public static final int PREFS_SEARCH_VIEW_GROUPING_ATTRIBUTE_TYPES_FIRST = 0;
+ /** The preference value for Search View Grouping 'Display OCs first' */
+ public static final int PREFS_SEARCH_VIEW_GROUPING_OBJECT_CLASSES_FIRST = 1;
+ /** The preference value for Search View Grouping 'mixed' */
+ public static final int PREFS_SEARCH_VIEW_GROUPING_MIXED = 2;
+ /** The preference ID for Search View Sorting By */
+ public static final String PREFS_SEARCH_VIEW_SORTING_BY = Activator.PLUGIN_ID + ".preferences.SearchView.sortingBy"; //$NON-NLS-1$
+ /** The preference value for Search View Sorting 'First Name' */
+ public static final int PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME = 0;
+ /** The preference value for Search View Sorting 'OID' */
+ public static final int PREFS_SEARCH_VIEW_SORTING_BY_OID = 1;
+ /** The preference ID for Sorting Order */
+ public static final String PREFS_SEARCH_VIEW_SORTING_ORDER = Activator.PLUGIN_ID
+ + ".preferences.SchemaView.sortingOrder"; //$NON-NLS-1$
+ /** The preference value for Search View Sorting 'ascending' */
+ public static final int PREFS_SEARCH_VIEW_SORTING_ORDER_ASCENDING = 0;
+ /** The preference value for Search View Sorting 'descending' */
+ public static final int PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING = 1;
+ /** The preference ID for Search View Display Secondary Label */
+ public static final String PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY = SearchViewPreferencePage.ID
+ + ".schemaLabel.display"; //$NON-NLS-1$
+
+ /** The Context for the SchemaView */
+ public static final String CONTEXT_SCHEMA_VIEW = Activator.PLUGIN_ID + ".contexts.schemaView"; //$NON-NLS-1$
+ /** The Context for the SchemaView */
+ public static final String CONTEXT_PROJECTS_VIEW = Activator.PLUGIN_ID + ".contexts.projectsView"; //$NON-NLS-1$
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,351 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor;
+
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.schemaeditor.controller.ProjectsHandler;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.model.io.ProjectsExporter;
+import org.apache.directory.studio.schemaeditor.model.io.ProjectsImportException;
+import org.apache.directory.studio.schemaeditor.model.io.ProjectsImporter;
+import org.apache.directory.studio.schemaeditor.model.io.SchemaConnector;
+import org.apache.directory.studio.schemaeditor.model.io.XMLSchemaFileImportException;
+import org.apache.directory.studio.schemaeditor.model.io.XMLSchemaFileImporter;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.schemaeditor.view.wizards.NewProjectWizardSchemasSelectionPage.ServerTypeEnum;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+
+/**
+ * This class contains helper methods.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PluginUtils
+{
+ /**
+ * Verifies that the given name is syntaxely correct according to the RFC 2252
+ * (Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions).
+ *
+ * @param name
+ * the name to test
+ * @return
+ * true if the name is correct, false if the name is not correct.
+ */
+ public static boolean verifyName( String name )
+ {
+ return name.matches( "[a-zA-Z]+[a-zA-Z0-9;-]*" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Returns a clone of the given attribute type.
+ *
+ * @param at
+ * the attribute type to clone
+ * @return
+ * a clone of the given attribute type
+ */
+ public static AttributeTypeImpl getClone( AttributeTypeImpl at )
+ {
+ AttributeTypeImpl clone = new AttributeTypeImpl( at.getOid() );
+ clone.setNames( at.getNames() );
+ clone.setSchema( at.getSchema() );
+ clone.setDescription( at.getDescription() );
+ clone.setSuperiorName( at.getSuperiorName() );
+ clone.setUsage( at.getUsage() );
+ clone.setSyntaxOid( at.getSyntaxOid() );
+ clone.setLength( at.getLength() );
+ clone.setObsolete( at.isObsolete() );
+ clone.setSingleValue( at.isSingleValue() );
+ clone.setCollective( at.isCollective() );
+ clone.setCanUserModify( at.isCanUserModify() );
+ clone.setEqualityName( at.getEqualityName() );
+ clone.setOrderingName( at.getOrderingName() );
+ clone.setSubstrName( at.getSubstrName() );
+
+ return clone;
+ }
+
+
+ /**
+ * Returns a clone of the given object class.
+ *
+ * @param oc
+ * the object class to clone
+ * @return
+ * a clone of the given object class
+ */
+ public static ObjectClassImpl getClone( ObjectClassImpl oc )
+ {
+ ObjectClassImpl clone = new ObjectClassImpl( oc.getOid() );
+ clone.setNames( oc.getNames() );
+ clone.setSchema( oc.getSchema() );
+ clone.setDescription( oc.getDescription() );
+ clone.setSuperClassesNames( oc.getSuperClassesNames() );
+ clone.setType( oc.getType() );
+ clone.setObsolete( oc.isObsolete() );
+ clone.setMustNamesList( oc.getMustNamesList() );
+ clone.setMayNamesList( oc.getMayNamesList() );
+
+ return clone;
+ }
+
+
+ /**
+ * Gets the Projects (where is stored information about the loaded Projects).
+ *
+ * @return
+ * the Projects File
+ */
+ private static File getProjectsFile()
+ {
+ return Activator.getDefault().getStateLocation().append( "projects.xml" ).toFile(); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Loads the projects saved in the Projects File.
+ */
+ public static void loadProjects()
+ {
+ ProjectsHandler projectsHandler = Activator.getDefault().getProjectsHandler();
+ File projectsFile = getProjectsFile();
+
+ if ( projectsFile.exists() )
+ {
+ Project[] projects = null;
+ try
+ {
+ projects = ProjectsImporter.getProjects( projectsFile.getAbsolutePath() );
+ }
+ catch ( ProjectsImportException e )
+ {
+ PluginUtils.logError( "An error occured when loading the projects.", e );
+ ViewUtils.displayErrorMessageBox( "Projects Loading Error",
+ "An error occured when loading the projects." );
+ }
+
+ for ( Project project : projects )
+ {
+ projectsHandler.addProject( project );
+ }
+ }
+ }
+
+
+ /**
+ * Saves the projects in the Projects File.
+ */
+ public static void saveProjects()
+ {
+ try
+ {
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
+ outformat.setEncoding( "UTF-8" );
+ XMLWriter writer = new XMLWriter( new FileOutputStream( getProjectsFile() ), outformat );
+ writer.write( ProjectsExporter.toDocument( Activator.getDefault().getProjectsHandler().getProjects()
+ .toArray( new Project[0] ) ) );
+ writer.flush();
+ }
+ catch ( IOException e )
+ {
+ PluginUtils.logError( "An error occured when saving the projects.", e );
+ ViewUtils.displayErrorMessageBox( "Projects Saving Error", "An error occured when saving the projects." );
+ }
+ }
+
+
+ /**
+ * Logs the given message and exception with the ERROR status level.
+ *
+ * @param message
+ * the message
+ * @param exception
+ * the exception
+ */
+ public static void logError( String message, Throwable exception )
+ {
+ Activator.getDefault().getLog().log(
+ new Status( Status.ERROR, Activator.getDefault().getBundle().getSymbolicName(), Status.OK, message,
+ exception ) );
+ }
+
+
+ /**
+ * Logs the given message and exception with the WARNING status level.
+ *
+ * @param message
+ * the message
+ * @param exception
+ * the exception
+ */
+ public static void logWarning( String message, Throwable exception )
+ {
+ Activator.getDefault().getLog().log(
+ new Status( Status.WARNING, Activator.getDefault().getBundle().getSymbolicName(), Status.OK, message,
+ exception ) );
+ }
+
+
+ /**
+ * Loads the 'core' corresponding to the given name.
+ *
+ * @param schemaName
+ * the name of the 'core' schema
+ * @return
+ * the corresponding schema, or null if no schema has been found
+ */
+ public static Schema loadCoreSchema( ServerTypeEnum serverType, String schemaName )
+ {
+ Schema schema = null;
+
+ try
+ {
+ URL url = Platform.getBundle( Activator.PLUGIN_ID ).getResource(
+ "resources/schemas/" + getFolderName( serverType ) + "/" + schemaName + ".xml" );
+
+ if ( url == null )
+ {
+ PluginUtils.logError( "An error occured when loading the schema " + schemaName + ".", null );
+ ViewUtils.displayErrorMessageBox( "Projects Saving Error", "An error occured when loading the schema "
+ + schemaName + "." );
+ }
+ else
+ {
+ schema = XMLSchemaFileImporter.getSchema( url.toString() );
+ }
+ }
+ catch ( XMLSchemaFileImportException e )
+ {
+ PluginUtils.logError( "An error occured when loading the schema " + schemaName + ".", e );
+ ViewUtils.displayErrorMessageBox( "Projects Saving Error", "An error occured when loading the schema "
+ + schemaName + "." );
+ }
+
+ return schema;
+ }
+
+
+ /**
+ * The name of the folder for the given Server Type.
+ *
+ * @param serverType
+ * the Server Type
+ * @return
+ * the name of the folder for the given Server Type
+ */
+ private static String getFolderName( ServerTypeEnum serverType )
+ {
+ if ( ServerTypeEnum.APACHE_DS.equals( serverType ) )
+ {
+ return "apacheds";
+ }
+ else if ( ServerTypeEnum.OPENLDAP.equals( serverType ) )
+ {
+ return "openldap";
+ }
+
+ // Default
+ return null;
+ }
+
+
+ /**
+ * Gets a Connection from the given id.
+ *
+ * @param id
+ * the id of the Connection
+ * @return
+ * the corresponding Connection, or null if no connection was found.
+ */
+ public static Connection getConnection( String id )
+ {
+ Connection[] connectionsArray = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
+
+ HashMap<String, Connection> connections = new HashMap<String, Connection>();
+ for ( Connection connection : connectionsArray )
+ {
+ connections.put( connection.getId(), connection );
+ }
+
+ return connections.get( id );
+ }
+
+
+ /**
+ * Gets the List of SchemaConnectors defined using the ExtensionPoint.
+ *
+ * @return
+ * the List of SchemaConnectors defined using the ExtensionPoint
+ */
+ public static List<SchemaConnector> getSchemaConnectors()
+ {
+ List<SchemaConnector> schemaConnectors = new ArrayList<SchemaConnector>();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
+ "org.apache.directory.studio.schemaeditor.schemaConnectors" );
+ IConfigurationElement[] members = extensionPoint.getConfigurationElements();
+
+ if ( members != null )
+ {
+ // Creating each SchemaConnector
+ for ( IConfigurationElement member : members )
+ {
+ try
+ {
+ SchemaConnector schemaConnector = ( SchemaConnector ) member.createExecutableExtension( "class" );
+ schemaConnector.setName( member.getAttribute( "name" ) );
+ schemaConnector.setId( member.getAttribute( "id" ) );
+ schemaConnector.setDescription( member.getAttribute( "description" ) );
+
+ schemaConnectors.add( schemaConnector );
+ }
+ catch ( CoreException e )
+ {
+ PluginUtils.logError( "An error occured when loading the schema connectors.", e );
+ ViewUtils.displayErrorMessageBox( "Error", "An error occured when loading the schema connectors." );
+ }
+ }
+ }
+
+ return schemaConnectors;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor;
+
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * This class initializes the preferences of the plug-in.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences()
+ {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ // DifferencesWidget
+ store.setDefault( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING,
+ PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY );
+
+ // SchemaView Preference Page
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION,
+ PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_LABEL, PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE, true );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY, true );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE, false );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY, false );
+
+ // SchemaView Sorting
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING,
+ PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY,
+ PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME );
+ store.setDefault( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER,
+ PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_ASCENDING );
+
+ // HierarchyView Preference Page
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES );
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE, true );
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY, true );
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID );
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE, false );
+ store.setDefault( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+
+ // SearchView Preference Page
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_LABEL, PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE, true );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_DISPLAY, true );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE, false );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH, "50" ); //$NON-NLS-1$
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY, true );
+
+ // SearchView Sorting
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_GROUPING, PluginConstants.PREFS_SEARCH_VIEW_GROUPING_MIXED );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY,
+ PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME );
+ store.setDefault( PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER,
+ PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_ASCENDING );
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PreferenceInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.controller;
+
+
+/**
+ * This adapter class provides default implementations for the methods
+ * described by the AttributeTypeListener interface.
+ * <p>
+ * Classes that wish to deal with attribute type events can extend this class
+ * and override only the methods which they are interested in.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AttributeTypeAdapter implements AttributeTypeListener
+{
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.AttributeTypeListener#attributeTypeModified()
+ */
+ public void attributeTypeModified()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.AttributeTypeListener#attributeTypeRemoved()
+ */
+ public void attributeTypeRemoved()
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.controller;
+
+
+/**
+ * Classes which implement this interface provide methods that deal with the
+ * events that are generated when an event occurs on an attribute type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface AttributeTypeListener
+{
+ /**
+ * Sent when the attribute type is modified.
+ */
+ public void attributeTypeModified();
+
+
+ /**
+ * Sent when the attribute type is removed.
+ */
+ public void attributeTypeRemoved();
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/HierarchyViewController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/HierarchyViewController.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/HierarchyViewController.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/HierarchyViewController.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,312 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.controller;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.PluginUtils;
+import org.apache.directory.studio.schemaeditor.controller.actions.LinkWithEditorHierarchyViewAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.OpenHierarchyViewPreferencesAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.ShowSubtypeHierarchyAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.ShowSupertypeHierarchyAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.ShowTypeHierarchyAction;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
+import org.apache.directory.studio.schemaeditor.view.views.HierarchyView;
+import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Controller for the Hierarchy View
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyViewController
+{
+ /** The associated view */
+ private HierarchyView view;
+
+ /** The authorized Preferences keys*/
+ List<String> authorizedPrefs;
+
+ /** The ProjectsHandlerListener */
+ private ProjectsHandlerListener projectsHandlerListener = new ProjectsHandlerAdapter()
+ {
+ public void openProjectChanged( Project oldProject, Project newProject )
+ {
+ // Since we're changing of project, let's set the input as null
+ view.setInput( null );
+
+ if ( newProject != null )
+ {
+ view.getViewer().getTree().setEnabled( true );
+ showTypeHierarchy.setEnabled( true );
+ showSupertypeHierarchy.setEnabled( true );
+ showSubtypeHierarchy.setEnabled( true );
+ linkWithEditor.setEnabled( true );
+ openPreferencePage.setEnabled( true );
+ }
+ else
+ {
+ view.getViewer().getTree().setEnabled( false );
+ showTypeHierarchy.setEnabled( false );
+ showSupertypeHierarchy.setEnabled( false );
+ showSubtypeHierarchy.setEnabled( false );
+ linkWithEditor.setEnabled( false );
+ openPreferencePage.setEnabled( false );
+ }
+ }
+ };
+
+ /** The IDoubleClickListener */
+ private IDoubleClickListener doubleClickListener = new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ // What we get from the treeViewer is a StructuredSelection
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+ // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+ Object objectSelection = selection.getFirstElement();
+ IEditorInput input = null;
+ String editorId = null;
+
+ // Selecting the right editor and input
+ if ( objectSelection instanceof AttributeTypeWrapper )
+ {
+ input = new AttributeTypeEditorInput( ( ( AttributeTypeWrapper ) objectSelection ).getAttributeType() );
+ editorId = AttributeTypeEditor.ID;
+ }
+ else if ( objectSelection instanceof ObjectClassWrapper )
+ {
+ input = new ObjectClassEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getObjectClass() );
+ editorId = ObjectClassEditor.ID;
+ }
+
+ // Let's open the editor
+ if ( input != null )
+ {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try
+ {
+ page.openEditor( input, editorId );
+ }
+ catch ( PartInitException e )
+ {
+ PluginUtils.logError( "An error occured when opening the editor.", e );
+ ViewUtils.displayErrorMessageBox( "Error", "An error occured when opening the editor." );
+ }
+ }
+ }
+ };
+
+ /** The IPropertyChangeListener */
+ private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
+ {
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ if ( authorizedPrefs.contains( event.getProperty() ) )
+ {
+ view.refresh();
+ }
+ }
+ };
+
+ // The Actions
+ private Action showTypeHierarchy;
+ private Action showSupertypeHierarchy;
+ private Action showSubtypeHierarchy;
+ private Action linkWithEditor;
+ private Action openPreferencePage;
+
+
+ /**
+ * Creates a new instance of SchemasViewController.
+ *
+ * @param view
+ * the associated view
+ */
+ public HierarchyViewController( HierarchyView view )
+ {
+ this.view = view;
+
+ initAuthorizedPrefs();
+ initActions();
+ initToolbar();
+ initMenu();
+ initProjectsHandlerListener();
+ initDoubleClickListener();
+ initPreferencesListener();
+ initState();
+ }
+
+
+ /**
+ * Initializes the values for the authorized preferences.
+ */
+ private void initAuthorizedPrefs()
+ {
+ authorizedPrefs = new ArrayList<String>();
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE );
+ authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
+ }
+
+
+ /**
+ * Initializes the Actions.
+ */
+ private void initActions()
+ {
+ // Setting up the default key value (if needed)
+ if ( Activator.getDefault().getDialogSettings().get( PluginConstants.PREFS_HIERARCHY_VIEW_MODE ) == null )
+ {
+ Activator.getDefault().getDialogSettings().put( PluginConstants.PREFS_HIERARCHY_VIEW_MODE,
+ PluginConstants.PREFS_HIERARCHY_VIEW_MODE_TYPE );
+ }
+ showTypeHierarchy = new ShowTypeHierarchyAction( view );
+ showSupertypeHierarchy = new ShowSupertypeHierarchyAction( view );
+ showSubtypeHierarchy = new ShowSubtypeHierarchyAction( view );
+ linkWithEditor = new LinkWithEditorHierarchyViewAction( view );
+ openPreferencePage = new OpenHierarchyViewPreferencesAction();
+ }
+
+
+ /**
+ * Initializes the Toolbar.
+ */
+ private void initToolbar()
+ {
+ IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+ toolbar.add( showTypeHierarchy );
+ toolbar.add( showSupertypeHierarchy );
+ toolbar.add( showSubtypeHierarchy );
+ toolbar.add( new Separator() );
+ toolbar.add( linkWithEditor );
+ }
+
+
+ /**
+ * Initializes the Menu.
+ */
+ private void initMenu()
+ {
+ IMenuManager menu = view.getViewSite().getActionBars().getMenuManager();
+ menu.add( showTypeHierarchy );
+ menu.add( showSupertypeHierarchy );
+ menu.add( showSubtypeHierarchy );
+ menu.add( new Separator() );
+ menu.add( linkWithEditor );
+ menu.add( new Separator() );
+ menu.add( openPreferencePage );
+ }
+
+
+ /**
+ * Initializes the ProjectsHandlerListener.
+ */
+ private void initProjectsHandlerListener()
+ {
+ Activator.getDefault().getProjectsHandler().addListener( projectsHandlerListener );
+ }
+
+
+ /**
+ * Initializes the DoubleClickListener.
+ */
+ private void initDoubleClickListener()
+ {
+ view.getViewer().addDoubleClickListener( doubleClickListener );
+ }
+
+
+ /**
+ * Initializes the listener on the preferences store.
+ */
+ private void initPreferencesListener()
+ {
+ Activator.getDefault().getPreferenceStore().addPropertyChangeListener( propertyChangeListener );
+ }
+
+
+ /**
+ * Initializes the state of the View.
+ */
+ private void initState()
+ {
+ if ( Activator.getDefault().getProjectsHandler().getOpenProject() != null )
+ {
+ view.getViewer().getTree().setEnabled( true );
+ showTypeHierarchy.setEnabled( true );
+ showSupertypeHierarchy.setEnabled( true );
+ showSubtypeHierarchy.setEnabled( true );
+ linkWithEditor.setEnabled( true );
+ openPreferencePage.setEnabled( true );
+ }
+ else
+ {
+ view.getViewer().getTree().setEnabled( false );
+ showTypeHierarchy.setEnabled( false );
+ showSupertypeHierarchy.setEnabled( false );
+ showSubtypeHierarchy.setEnabled( false );
+ linkWithEditor.setEnabled( false );
+ openPreferencePage.setEnabled( false );
+ }
+ }
+
+
+ /**
+ * This method is called when the view is disposed.
+ */
+ public void dispose()
+ {
+ Activator.getDefault().getProjectsHandler().removeListener( projectsHandlerListener );
+ view.getViewer().removeDoubleClickListener( doubleClickListener );
+ Activator.getDefault().getPreferenceStore().removePropertyChangeListener( propertyChangeListener );
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/HierarchyViewController.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.controller;
+
+
+/**
+ * This adapter class provides default implementations for the methods
+ * described by the ObjectChangeListener interface.
+ * <p>
+ * Classes that wish to deal with object class events can extend this class
+ * and override only the methods which they are interested in.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class ObjectClassAdapter implements ObjectClassListener
+{
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.ObjectClassListener#objectClassModified()
+ */
+ public void objectClassModified()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.ObjectClassListener#objectClassRemoved()
+ */
+ public void objectClassRemoved()
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassListener.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassListener.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassListener.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.controller;
+
+
+/**
+ * Classes which implement this interface provide methods that deal with the
+ * events that are generated when an event occurs on an object class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ObjectClassListener
+{
+ /**
+ * Sent when the object class is modified.
+ */
+ public void objectClassModified();
+
+
+ /**
+ * Sent when the object class is removed.
+ */
+ public void objectClassRemoved();
+}