directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r518658 [1/3] - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ META-INF/ ressources/icons/ src/main/java/org/apache/directory/ldapstudio/schemas/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/...
Date Thu, 15 Mar 2007 15:14:44 GMT
Author: pamarcelot
Date: Thu Mar 15 08:14:41 2007
New Revision: 518658

URL: http://svn.apache.org/viewvc?view=rev&rev=518658
Log:
Refactored Model for ModificationEvents of the SchemaPool.
Removed old out-dated tests.
Code cleaning and improvements.
Refactored Wrappers Hierarchy.
Upgraded Apache Commons Collections dependency to version 3.2.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/warning_overlay.gif   (with props)
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/HierarchyViewRoot.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ITreeNode.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemasViewRoot.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/TreeNode.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/test/java/org/
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/.classpath
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/META-INF/MANIFEST.MF
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/build.properties
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ivy.xml
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorHierarchyView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/SaveAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/LDAPModelEvent.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditor.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeSelectionDialogContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditor.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorSourceCodePage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyViewLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/FirstNameSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/OidSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaSorter.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/SchemaWrapper.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/view/wizards/messages.properties

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/.classpath
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/.classpath?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/.classpath (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/.classpath Thu Mar 15 08:14:41 2007
@@ -6,14 +6,15 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
-	<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
 	<classpathentry kind="lib" path="lib/commons-configuration-1.2.jar"/>
 	<classpathentry kind="lib" path="lib/commons-lang-2.1.jar"/>
 	<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
 	<classpathentry kind="lib" path="lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar"/>
 	<classpathentry kind="lib" path="lib/apacheds-core-shared-1.5.0-SNAPSHOT.jar"/>
 	<classpathentry kind="lib" path="lib/shared-ldap-0.9.6-SNAPSHOT.jar"/>
-	<classpathentry kind="lib" path="lib/nlog4j-1.2.24.jar"/>
 	<classpathentry kind="lib" path="lib/velocity-dep-1.4.jar"/>
+	<classpathentry kind="lib" path="lib/nlog4j-1.2.24.jar"/>
+	<classpathentry kind="lib" path="lib/commons-collections-3.2.jar"/>
+	<classpathentry kind="lib" path="lib/shared-asn1-0.9.6-SNAPSHOT.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/META-INF/MANIFEST.MF?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/META-INF/MANIFEST.MF (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/META-INF/MANIFEST.MF Thu Mar 15 08:14:41 2007
@@ -14,7 +14,6 @@
  org.eclipse.search
 Eclipse-LazyStart: true
 Bundle-ClassPath: .,
- lib/commons-collections-3.1.jar,
  lib/commons-configuration-1.2.jar,
  lib/commons-lang-2.1.jar,
  lib/commons-logging-1.1.jar,
@@ -23,4 +22,5 @@
  lib/velocity-dep-1.4.jar,
  lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar,
  lib/apacheds-core-shared-1.5.0-SNAPSHOT.jar,
- lib/shared-asn1-0.9.6-SNAPSHOT.jar
+ lib/shared-asn1-0.9.6-SNAPSHOT.jar,
+ lib/commons-collections-3.2.jar

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/build.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/build.properties?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/build.properties (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/build.properties Thu Mar 15 08:14:41 2007
@@ -8,7 +8,6 @@
                plugin.properties,\
                log4j.conf,\
                ressources/,\
-               lib/commons-collections-3.1.jar,\
                lib/commons-configuration-1.2.jar,\
                lib/commons-lang-2.1.jar,\
                lib/commons-logging-1.1.jar,\
@@ -19,4 +18,5 @@
                lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar,\
                lib/apacheds-core-shared-1.5.0-SNAPSHOT.jar,\
                lib/shared-asn1-0.9.6-SNAPSHOT.jar,\
-               lib/antlr-2.7.6.jar
+               lib/antlr-2.7.6.jar,\
+               lib/commons-collections-3.2.jar

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ivy.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ivy.xml?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ivy.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ivy.xml Thu Mar 15 08:14:41 2007
@@ -19,7 +19,7 @@
 <ivy-module version="1.0">
     <info organisation="org.apache.directory.ldapstudio" module="ldapdtudio-schemas-plugin"/>
     <dependencies>
-		<dependency org="commons-collections" name="commons-collections" rev="3.1"/>
+		<dependency org="commons-collections" name="commons-collections" rev="3.2"/>
 		<dependency org="commons-configuration" name="commons-configuration" rev="1.2"/>
 		<dependency org="commons-lang" name="commons-lang" rev="2.1"/>
 		<dependency org="commons-logging" name="commons-logging" rev="1.1"/>

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/warning_overlay.gif
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/warning_overlay.gif?view=auto&rev=518658
==============================================================================
Binary file - no diff available.

Propchange: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/ressources/icons/warning_overlay.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/PluginConstants.java Thu Mar 15 08:14:41 2007
@@ -190,6 +190,8 @@
     public static final String IMG_OBJECT_CLASS_WARNING = "ressources/icons/object_class_warning.gif"; //$NON-NLS-1$
     public static final String IMG_SCHEMA = "ressources/icons/schema.gif"; //$NON-NLS-1$
     public static final String IMG_SCHEMA_CORE = "ressources/icons/schema_core.gif"; //$NON-NLS-1$
+    public static final String IMG_WARNING_OVERLAY = "ressources/icons/warning_overlay.gif"; //$NON-NLS-1$
+
 
     // Images - Wizards
     public static final String IMG_ATTRIBUTE_TYPE_NEW_WIZARD = "ressources/icons/attribute_type_new_wizard.png"; //$NON-NLS-1$

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java Thu Mar 15 08:14:41 2007
@@ -119,8 +119,8 @@
      */
     private void initActions()
     {
-        hideObjectClasses = new HideObjectClassesAction( view );
-        hideAttributeTypes = new HideAttributeTypesAction( view );
+        hideObjectClasses = new HideObjectClassesAction( view.getViewer() );
+        hideAttributeTypes = new HideAttributeTypesAction( view.getViewer() );
         collapseAll = new CollapseAllAction( view.getViewer() );
         linkWithEditor = new LinkWithEditorHierarchyView( view );
         openSortDialog = new OpenHierarchyViewSortDialogAction();
@@ -229,7 +229,14 @@
             { 
                 if ( authorizedPrefs.contains( event.getProperty() ) )
                 {
-                    view.refresh();
+                    if ( PluginConstants.PREFS_HIERARCHY_VIEW_GROUPING == event.getProperty() )
+                    {
+                        view.completeRefresh();
+                    }
+                    else
+                    {
+                        view.refresh();
+                    }
                 }
             }
         } );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java Thu Mar 15 08:14:41 2007
@@ -144,6 +144,9 @@
     }
 
 
+    /**
+     * Initializes the values for the authorized preferences.
+     */
     private void initAuthorizedPrefs()
     {
         authorizedPrefs = new ArrayList<String>();
@@ -291,7 +294,7 @@
 
 
     /**
-     * Initializes the DragNDrop support
+     * Initializes the DragNDrop support.
      */
     private void initDragAndDrop()
     {
@@ -355,7 +358,7 @@
 
 
     /**
-     * Initializes the DoubleClickListener
+     * Initializes the DoubleClickListener.
      */
     private void initDoubleClickListener()
     {
@@ -417,7 +420,7 @@
 
     /**
      * Registers a Listener on the Schemas View and enable/disable the
-     * Actions according to the selection
+     * Actions according to the selection.
      */
     private void registerUpdateActions()
     {
@@ -540,7 +543,7 @@
 
 
     /**
-     * Initializes the listener on the preferences store
+     * Initializes the listener on the preferences store.
      */
     private void initPreferencesListener()
     {
@@ -553,7 +556,14 @@
             {
                 if ( authorizedPrefs.contains( event.getProperty() ) )
                 {
-                    view.refresh();
+                    if ( PluginConstants.PREFS_SCHEMAS_VIEW_GROUPING == event.getProperty() )
+                    {
+                        view.completeRefresh();
+                    }
+                    else
+                    {
+                        view.refresh();
+                    }
                 }
             }
         } );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java Thu Mar 15 08:14:41 2007
@@ -24,7 +24,6 @@
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.model.Schema;
-import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
@@ -72,62 +71,53 @@
             .findView( SchemasView.ID ); //$NON-NLS-1$
         Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
 
-        String schemaName = null;
+        Schema schema = null;
 
         // We have to check on which node we are to get the schema name
         if ( selection instanceof SchemaWrapper )
         {
-            schemaName = ( ( SchemaWrapper ) selection ).getName();
+            schema = ( ( SchemaWrapper ) selection ).getMySchema();
         }
         else if ( selection instanceof AttributeTypeWrapper )
         {
-            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType().getOriginatingSchema();
         }
         else if ( selection instanceof ObjectClassWrapper )
         {
-            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( ObjectClassWrapper ) selection ).getMyObjectClass().getOriginatingSchema();
         }
         else if ( selection instanceof IntermediateNode )
         {
-            schemaName = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getName();
+            schema = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getMySchema();
         }
-
-        if ( schemaName == null )
+        else
         {
             MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                 SWT.OK | SWT.ICON_ERROR );
             messageBox.setMessage( Messages.getString( "CreateANewAttributeTypeAction.A_schema_must_be_selected" ) ); //$NON-NLS-1$
             messageBox.open();
+            return;
+        }
+
+        // Check if the schema isn't a core schema (core schema can't be modified
+        if ( schema.type == Schema.SchemaType.coreSchema )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox
+                .setMessage( Messages.getString( "CreateANewAttributeTypeAction.The_schema" ) + schema.getName() + Messages.getString( "CreateANewAttributeTypeAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+            messageBox.open();
         }
         else
         {
-            //Getting the SchemaPool
-            SchemaPool pool = SchemaPool.getInstance();
-            // Getting the right schema
-            Schema schema = pool.getSchema( schemaName );
-
-            // Check if the schema isn't a core schema (core schema can't be modified
-            if ( schema.type == Schema.SchemaType.coreSchema )
-            {
-                MessageBox messageBox = new MessageBox(
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
-                messageBox
-                    .setMessage( Messages.getString( "CreateANewAttributeTypeAction.The_schema" ) + schemaName + Messages.getString( "CreateANewAttributeTypeAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                messageBox.open();
-            }
-            else
-            {
-                // Instantiates and initializes the wizard
-                CreateANewAttributeTypeWizard wizard = new CreateANewAttributeTypeWizard( schemaName );
-                wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
-                // Instantiates the wizard container with the wizard and opens it
-                WizardDialog dialog = new WizardDialog(
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
-                dialog.create();
-                dialog.open();
-            }
+            // Instantiates and initializes the wizard
+            CreateANewAttributeTypeWizard wizard = new CreateANewAttributeTypeWizard( schema.getName() );
+            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();
         }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java Thu Mar 15 08:14:41 2007
@@ -24,7 +24,6 @@
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.model.Schema;
-import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
 import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
@@ -72,62 +71,53 @@
             .findView( SchemasView.ID ); //$NON-NLS-1$
         Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
 
-        String schemaName = null;
+        Schema schema = null;
 
         // We have to check on which node we are to get the schema name
         if ( selection instanceof SchemaWrapper )
         {
-            schemaName = ( ( SchemaWrapper ) selection ).getName();
+            schema = ( ( SchemaWrapper ) selection ).getMySchema();
         }
         else if ( selection instanceof AttributeTypeWrapper )
         {
-            // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType().getOriginatingSchema();
         }
         else if ( selection instanceof ObjectClassWrapper )
         {
-            // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( ObjectClassWrapper ) selection ).getMyObjectClass().getOriginatingSchema();
         }
         else if ( selection instanceof IntermediateNode )
         {
-            schemaName = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getName();
+            schema = ( ( SchemaWrapper ) ( ( IntermediateNode ) selection ).getParent() ).getMySchema();
         }
-
-        if ( schemaName == null )
+        else
         {
             MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                 SWT.OK | SWT.ICON_ERROR );
             messageBox.setMessage( Messages.getString( "CreateANewObjectClassAction.A_schema_must_be_selected" ) ); //$NON-NLS-1$
             messageBox.open();
+            return;
+        }
+
+        // Check if the schema isn't a core schema (core schema can't be modified
+        if ( schema.type == Schema.SchemaType.coreSchema )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox
+                .setMessage( Messages.getString( "CreateANewObjectClassAction.The_schema" ) + schema.getName() + Messages.getString( "CreateANewObjectClassAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+            messageBox.open();
         }
         else
         {
-            // Getting the SchemaPool
-            SchemaPool pool = SchemaPool.getInstance();
-            // Getting the right schema
-            Schema schema = pool.getSchema( schemaName );
-
-            // Check if the schema isn't a core schema (core schema can't be modified
-            if ( schema.type == Schema.SchemaType.coreSchema )
-            {
-                MessageBox messageBox = new MessageBox(
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
-                messageBox
-                    .setMessage( Messages.getString( "CreateANewObjectClassAction.The_schema" ) + schemaName + Messages.getString( "CreateANewObjectClassAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                messageBox.open();
-            }
-            else
-            {
-                // Instantiates and initializes the wizard
-                CreateANewObjectClassWizard wizard = new CreateANewObjectClassWizard( schemaName );
-                wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
-                // Instantiates the wizard container with the wizard and opens it
-                WizardDialog dialog = new WizardDialog(
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
-                dialog.create();
-                dialog.open();
-            }
+            // Instantiates and initializes the wizard
+            CreateANewObjectClassWizard wizard = new CreateANewObjectClassWizard( schema.getName() );
+            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();
         }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java Thu Mar 15 08:14:41 2007
@@ -26,20 +26,13 @@
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.model.Schema;
-import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
-import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
-import org.apache.log4j.Logger;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -49,8 +42,6 @@
  */
 public class DeleteAction extends Action
 {
-    private static Logger logger = Logger.getLogger( DeleteAction.class );
-
     private enum ItemType
     {
         attributeType, objectClass
@@ -82,96 +73,65 @@
             .findView( SchemasView.ID ); //$NON-NLS-1$
         Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
 
-        String schemaName = null;
+        Schema schema = null;
         ItemType item = null;
 
         if ( selection instanceof AttributeTypeWrapper )
         {
             // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType().getOriginatingSchema();
             item = DeleteAction.ItemType.attributeType;
         }
         else if ( selection instanceof ObjectClassWrapper )
         {
             // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+            schema = ( ( ObjectClassWrapper ) selection ).getMyObjectClass().getOriginatingSchema();
             item = DeleteAction.ItemType.objectClass;
         }
-
-        if ( schemaName == null )
+        else
         {
             MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                 SWT.OK | SWT.ICON_ERROR );
             messageBox.setMessage( Messages.getString( "DeleteAction.This_item_cant_be_deleted" ) ); //$NON-NLS-1$
             messageBox.open();
+            return;
+        }
+
+        // Check if the schema isn't a core schema (core schema can't be modified
+        if ( schema.type == Schema.SchemaType.coreSchema )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox
+                .setMessage( Messages.getString( "DeleteAction.The_schema" ) + schema.getName() + Messages.getString( "DeleteAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+            messageBox.open();
         }
         else
         {
-            // Getting the SchemaPool
-            SchemaPool pool = SchemaPool.getInstance();
-            // Getting the right schema
-            Schema schema = pool.getSchema( schemaName );
-
-            // Check if the schema isn't a core schema (core schema can't be modified
-            if ( schema.type == Schema.SchemaType.coreSchema )
+            if ( item == DeleteAction.ItemType.attributeType )
             {
+                AttributeType attributeType = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType();
                 MessageBox messageBox = new MessageBox(
-                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.CANCEL
+                        | SWT.ICON_QUESTION );
                 messageBox
-                    .setMessage( Messages.getString( "DeleteAction.The_schema" ) + schemaName + Messages.getString( "DeleteAction.Is_a_core_schema_It_cant_be_modified" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                messageBox.open();
-            }
-            else
-            {
-                if ( item == DeleteAction.ItemType.attributeType )
+                    .setMessage( Messages.getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_attribute_type" ) + attributeType.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                if ( messageBox.open() == SWT.OK )
                 {
-                    AttributeType attributeType = ( ( AttributeTypeWrapper ) selection ).getMyAttributeType();
-                    MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-                        .getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION );
-                    messageBox
-                        .setMessage( Messages
-                            .getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_attribute_type" ) + attributeType.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                    if ( messageBox.open() == SWT.OK )
-                    {
-                        schema.removeAttributeType( attributeType );
-                    }
+                    schema.removeAttributeType( attributeType );
                 }
-                else if ( item == DeleteAction.ItemType.objectClass )
+            }
+            else if ( item == DeleteAction.ItemType.objectClass )
+            {
+                ObjectClass objectClass = ( ( ObjectClassWrapper ) selection ).getMyObjectClass();
+                MessageBox messageBox = new MessageBox(
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.CANCEL
+                        | SWT.ICON_QUESTION );
+                messageBox
+                    .setMessage( Messages.getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_object_class" ) + objectClass.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                if ( messageBox.open() == SWT.OK )
                 {
-                    ObjectClass objectClass = ( ( ObjectClassWrapper ) selection ).getMyObjectClass();
-                    MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
-                        .getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION );
-                    messageBox
-                        .setMessage( Messages
-                            .getString( "DeleteAction.Are_you_sure_you_want_to_delete_the_object_class" ) + objectClass.getNames()[0] + Messages.getString( "DeleteAction.Interrogation" ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                    if ( messageBox.open() == SWT.OK )
-                    {
-
-                        //try to close the associated editors before deleting the objectClass
-                        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-                        IEditorReference[] editorReferences = page.getEditorReferences();
-                        for ( IEditorReference reference : editorReferences )
-                        {
-                            try
-                            {
-                                if ( reference.getEditorInput() instanceof ObjectClassFormEditorInput )
-                                {
-                                    ObjectClassFormEditorInput input = ( ObjectClassFormEditorInput ) reference
-                                        .getEditorInput();
-                                    if ( input.getObjectClass().equals( objectClass ) )
-                                    {
-                                        page.closeEditor( reference.getEditor( false ), false );
-                                    }
-                                }
-                            }
-                            catch ( PartInitException e )
-                            {
-                                logger.debug( "error when closing associated editors" ); //$NON-NLS-1$
-                            }
-                        }
-                        //delete the objectClass
-                        schema.removeObjectClass( objectClass );
-                    }
+                    schema.removeObjectClass( objectClass );
                 }
             }
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideAttributeTypesAction.java Thu Mar 15 08:14:41 2007
@@ -22,8 +22,8 @@
 
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
-import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyView;
 import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 
@@ -40,16 +40,16 @@
         + ".dialogsettingkey";
 
     /** The associated view */
-    private HierarchyView hierarchyView;
+    private TreeViewer viewer;
 
 
     /**
      * Creates a new instance of HideObjectClassesAction.
      *
-     * @param view
-     *      the associated view
+     * @param viewer
+     *      the associated viewer
      */
-    public HideAttributeTypesAction( HierarchyView view )
+    public HideAttributeTypesAction( TreeViewer viewer )
     {
         super( "Hide Attribute Types", AS_CHECK_BOX );
         setToolTipText( getText() );
@@ -57,7 +57,7 @@
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
             PluginConstants.IMG_HIDE_ATTRIBUTE_TYPES ) );
         setEnabled( true );
-        hierarchyView = view;
+        this.viewer = viewer;
 
         // Setting up the default key value (if needed)
         if ( Activator.getDefault().getDialogSettings().get( HIDE_ATTRIBUTE_TYPES_DS_KEY ) == null )
@@ -78,6 +78,6 @@
         setChecked( isChecked() );
         Activator.getDefault().getDialogSettings().put( HIDE_ATTRIBUTE_TYPES_DS_KEY, isChecked() );
 
-        hierarchyView.refresh();
+        viewer.refresh();
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/HideObjectClassesAction.java Thu Mar 15 08:14:41 2007
@@ -22,8 +22,8 @@
 
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
-import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyView;
 import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 
@@ -39,17 +39,17 @@
     public static final String HIDE_OBJECT_CLASSES_DS_KEY = HideObjectClassesAction.class.getName()
         + ".dialogsettingkey";
 
-    /** The associated view */
-    private HierarchyView hierarchyView;
+    /** The associated viewer */
+    private TreeViewer viewer;
 
 
     /**
      * Creates a new instance of HideObjectClassesAction.
      *
-     * @param view
-     *      the associated view
+     * @param viewer
+     *      the associated viewer
      */
-    public HideObjectClassesAction( HierarchyView view )
+    public HideObjectClassesAction( TreeViewer viewer )
     {
         super( "Hide Object Classes", AS_CHECK_BOX );
         setToolTipText( getText() );
@@ -57,7 +57,7 @@
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
             PluginConstants.IMG_HIDE_OBJECT_CLASSES ) );
         setEnabled( true );
-        hierarchyView = view;
+        this.viewer = viewer;
 
         // Setting up the default key value (if needed)
         if ( Activator.getDefault().getDialogSettings().get( HIDE_OBJECT_CLASSES_DS_KEY ) == null )
@@ -78,6 +78,6 @@
         setChecked( isChecked() );
         Activator.getDefault().getDialogSettings().put( HIDE_OBJECT_CLASSES_DS_KEY, isChecked() );
 
-        hierarchyView.refresh();
+        viewer.refresh();
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorHierarchyView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorHierarchyView.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorHierarchyView.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorHierarchyView.java Thu Mar 15 08:14:41 2007
@@ -30,7 +30,7 @@
 import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.viewers.HierarchyView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
@@ -156,7 +156,7 @@
             if ( ( selectedObject instanceof SchemaWrapper ) || ( selectedObject instanceof ObjectClassWrapper )
                 || ( selectedObject instanceof AttributeTypeWrapper ) )
             {
-                linkEditorWithView( ( DisplayableTreeElement ) selectedObject );
+                linkEditorWithView( ( ITreeNode ) selectedObject );
             }
         }
     };
@@ -244,7 +244,7 @@
     private void linkViewWithEditor( String editorName, String editorID )
     {
         StructuredSelection structuredSelection = null;
-        DisplayableTreeElement wrapper = null;
+        ITreeNode wrapper = null;
 
         // Only editors for attribute types and object class are accepted
         if ( editorID.equals( AttributeTypeFormEditor.ID ) )
@@ -275,7 +275,7 @@
         else
         // The node we are looking for is not yet loaded in the TreeViewer, we have to find and load it.
         {
-            DisplayableTreeElement foundElement = hierarchyView.findElementInTree( wrapper );
+            ITreeNode foundElement = hierarchyView.findElementInTree( wrapper );
 
             if ( foundElement != null )
             {
@@ -329,7 +329,7 @@
      * @param wrapper
      *      the selected element in the view
      */
-    private void linkEditorWithView( DisplayableTreeElement wrapper )
+    private void linkEditorWithView( ITreeNode wrapper )
     {
         IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
             .getEditorReferences();

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java Thu Mar 15 08:14:41 2007
@@ -31,7 +31,7 @@
 import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
-import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ITreeNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
@@ -158,7 +158,7 @@
             if ( ( selectedObject instanceof SchemaWrapper ) || ( selectedObject instanceof ObjectClassWrapper )
                 || ( selectedObject instanceof AttributeTypeWrapper ) )
             {
-                linkEditorWithView( ( DisplayableTreeElement ) selectedObject );
+                linkEditorWithView( ( ITreeNode ) selectedObject );
             }
         }
     };
@@ -246,7 +246,7 @@
     private void linkViewWithEditor( String editorName, String editorID )
     {
         StructuredSelection structuredSelection = null;
-        DisplayableTreeElement wrapper = null;
+        ITreeNode wrapper = null;
 
         // Only editors for attribute types and object class are accepted
         if ( editorID.equals( AttributeTypeFormEditor.ID ) )
@@ -283,7 +283,7 @@
         else
         // The node we are looking for is not yet loaded in the TreeViewer, we have to find and load it.
         {
-            DisplayableTreeElement foundElement = schemasView.findElementInTree( wrapper );
+            ITreeNode foundElement = schemasView.findElementInTree( wrapper );
 
             if ( foundElement != null )
             {
@@ -337,7 +337,7 @@
      * @param wrapper
      *      the selected element in the view
      */
-    private void linkEditorWithView( DisplayableTreeElement wrapper )
+    private void linkEditorWithView( ITreeNode wrapper )
     {
         IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
             .getEditorReferences();

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java Thu Mar 15 08:14:41 2007
@@ -73,17 +73,17 @@
         // We have to check on which node we are to get the schema name
         if ( selection instanceof SchemaWrapper )
         {
-            schemaName = ( ( SchemaWrapper ) selection ).getName();
+            schemaName = ( ( SchemaWrapper ) selection ).getMySchema().getName();
         }
         else if ( selection instanceof AttributeTypeWrapper )
         {
             // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getName();
+            schemaName = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() ).getMySchema().getName();
         }
         else if ( selection instanceof ObjectClassWrapper )
         {
             // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
-            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getName();
+            schemaName = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() ).getMySchema().getName();
         }
 
         if ( schemaName != null )

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/SaveAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/SaveAction.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/SaveAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/SaveAction.java Thu Mar 15 08:14:41 2007
@@ -89,15 +89,11 @@
             }
             else if ( selection instanceof AttributeTypeWrapper )
             {
-                // We have to get the parent of the parent ( AttributeTypeWrapper => IntermediateNode => SchemaWrapper )
-                schema = ( ( SchemaWrapper ) ( ( AttributeTypeWrapper ) selection ).getParent().getParent() )
-                    .getMySchema();
+                schema =( ( AttributeTypeWrapper ) selection ).getMyAttributeType().getOriginatingSchema();
             }
             else if ( selection instanceof ObjectClassWrapper )
             {
-                // We have to get the parent of the parent ( ObjectClassWrapper => IntermediateNode => SchemaWrapper )
-                schema = ( ( SchemaWrapper ) ( ( ObjectClassWrapper ) selection ).getParent().getParent() )
-                    .getMySchema();
+                schema = ( ( ObjectClassWrapper ) selection ).getMyObjectClass().getOriginatingSchema();
             }
             else if ( selection instanceof IntermediateNode )
             {

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java Thu Mar 15 08:14:41 2007
@@ -39,7 +39,7 @@
  *
  */
 @SuppressWarnings("unused")//$NON-NLS-1$
-public class AttributeType implements SchemaElement
+public class AttributeType implements SchemaElement, Cloneable
 {
     private static Logger logger = Logger.getLogger( AttributeType.class );
     private AttributeTypeLiteral literal;
@@ -48,10 +48,6 @@
     private AttributeTypeFormEditor editor;
 
 
-    /******************************************
-     *             Constructors               *
-     ******************************************/
-
     /**
      * Default constructor
      * @param literal the literal given by the schema parser that represents this element
@@ -65,10 +61,6 @@
     }
 
 
-    /******************************************
-     *               Accessors                *
-     ******************************************/
-
     /**
      * @return the openldap parser literal associated with this attributeType 
      */
@@ -107,10 +99,6 @@
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
      * Call this method to remove the attributeType<->Editor association
      * @param editor the associated editor
@@ -166,11 +154,6 @@
     }
 
 
-    /******************************************
-     *            Wrapper Methods             *
-     ******************************************/
-
-    //get
     public String getDescription()
     {
         return literal.getDescription();
@@ -234,98 +217,84 @@
     public void setDescription( String description )
     {
         literal.setDescription( description );
-        notifyChanged();
     }
 
 
     public void setEquality( String equality )
     {
         literal.setEquality( equality );
-        notifyChanged();
     }
 
 
     public void setLength( int length )
     {
         literal.setLength( length );
-        notifyChanged();
     }
 
 
     public void setNames( String[] names )
     {
         literal.setNames( names );
-        notifyChanged();
     }
 
 
     public void setOrdering( String ordering )
     {
         literal.setOrdering( ordering );
-        notifyChanged();
     }
 
 
     public void setSubstr( String substr )
     {
         literal.setSubstr( substr );
-        notifyChanged();
     }
 
 
     public void setSuperior( String superior )
     {
         literal.setSuperior( superior );
-        notifyChanged();
     }
 
 
     public void setSyntax( String syntax )
     {
         literal.setSyntax( syntax );
-        notifyChanged();
     }
 
 
     public void setUsage( UsageEnum usage )
     {
         literal.setUsage( usage );
-        notifyChanged();
     }
 
     
     public void setOid( String oid )
     {
         literal.setOid( oid );
-        notifyChanged();
     }
     
     
     public void setObsolete( boolean bool )
     {
         literal.setObsolete( bool );
-        notifyChanged();
     }
 
 
     public void setSingleValue( boolean bool )
     {
         literal.setSingleValue( bool );
-        notifyChanged();
     }
 
 
     public void setCollective( boolean bool )
     {
         literal.setCollective( bool );
-        notifyChanged();
     }
 
 
     public void setNoUserModification( boolean bool )
     {
         literal.setNoUserModification( bool );
-        notifyChanged();
     }
 
 
@@ -353,10 +322,6 @@
     }
 
 
-    /******************************************
-     *                  I/O                   *
-     ******************************************/
-
     public String write()
     {
         StringBuffer sb = new StringBuffer();
@@ -475,20 +440,12 @@
     }
 
 
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
-
     public String toString()
     {
         return getNames()[0];
     }
 
 
-    /******************************************
-     *            Events emmiting             *
-     ******************************************/
-
     public void addListener( SchemaElementListener listener )
     {
         if ( !listeners.contains( listener ) )
@@ -502,18 +459,81 @@
     }
 
 
-    private void notifyChanged()
+    private void notifyChanged( AttributeType oldAttributeType )
     {
         for ( SchemaElementListener listener : listeners )
         {
             try
             {
-                listener.schemaElementChanged( this, new LDAPModelEvent( LDAPModelEvent.Reason.ATModified, this ) );
+                listener.schemaElementChanged( this, new LDAPModelEvent( LDAPModelEvent.Reason.ATModified,
+                    oldAttributeType, this ) );
             }
             catch ( Exception e )
             {
                 logger.debug( "error when notifying listener: " + listener ); //$NON-NLS-1$
             }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#clone()
+     */
+    public Object clone() throws CloneNotSupportedException
+    {
+        AttributeType at = ( AttributeType ) super.clone();
+
+        at.literal = new AttributeTypeLiteral( literal.getOid() );
+        at.literal.setCollective( literal.isCollective() );
+        at.literal.setDescription( literal.getDescription() );
+        at.literal.setEquality( literal.getEquality() );
+        at.literal.setLength( literal.getLength() );
+        at.literal.setNames( literal.getNames() );
+        at.literal.setNoUserModification( literal.isNoUserModification() );
+        at.literal.setObsolete( literal.isObsolete() );
+        at.literal.setOrdering( literal.getOrdering() );
+        at.literal.setSingleValue( literal.isSingleValue() );
+        at.literal.setSubstr( literal.getSubstr() );
+        at.literal.setSuperior( literal.getSuperior() );
+        at.literal.setSyntax( literal.getSyntax() );
+        at.literal.setUsage( literal.getUsage() );
+
+        return at;
+    }
+
+
+    /**
+     * Updates the attribute type.
+     *
+     * @param at
+     *      the attribute type to get values from
+     */
+    public void update( AttributeType at )
+    {
+        try
+        {
+            AttributeType oldAttributeType = ( AttributeType ) clone();
+
+            literal.setCollective( at.isCollective() );
+            literal.setDescription( at.getDescription() );
+            literal.setEquality( at.getEquality() );
+            literal.setLength( at.getLength() );
+            literal.setNames( at.getNames() );
+            literal.setNoUserModification( at.isNoUserModification() );
+            literal.setObsolete( at.isObsolete() );
+            literal.setOid( at.getOid() );
+            literal.setOrdering( at.getOrdering() );
+            literal.setSingleValue( at.isSingleValue() );
+            literal.setSubstr( at.getSubstr() );
+            literal.setSuperior( at.getSuperior() );
+            literal.setSyntax( at.getSyntax() );
+            literal.setUsage( at.getUsage() );
+
+            notifyChanged( oldAttributeType );
+        }
+        catch ( CloneNotSupportedException e )
+        {
+            // Will never occurr.
         }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/LDAPModelEvent.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/LDAPModelEvent.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/LDAPModelEvent.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/LDAPModelEvent.java Thu Mar 15 08:14:41 2007
@@ -33,21 +33,32 @@
 public class LDAPModelEvent
 {
 
+    /**
+     * This Enum is used to indicate the reason of the launch of the event.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
     public enum Reason
     {
         SchemaAdded, SchemaRemoved, multipleSchemaRemoved, multipleSchemaAdded, SchemaSaved, OCAdded, OCRemoved, ATAdded, ATRemoved, OCModified, ATModified, poolCleared
     }
 
-    private Reason reason = null;
-    private Object element = null;
+    /** The reason */
+    private Reason reason;
+
+    /** The old value of the element */
+    private Object oldValue;
 
+    /** The new value of the element */
+    private Object newValue;
 
-    /******************************************
-     *               Constructors             *
-     ******************************************/
 
     /**
-     * Default constructor, takes only a reason as argument
+     * Creates a new instance of LDAPModelEvent.
+     *
+     * @param reason
+     *      the reason
      */
     public LDAPModelEvent( Reason reason )
     {
@@ -56,46 +67,69 @@
 
 
     /**
-     * Constructor for objectClass motivated events
-     * @param reason takes only OCAdded, OCRemoved or OCModified reasons
-     * @param objectClass the incriminated objectClass
-     * @throws Exception if bad reason
+     * Creates a new instance of LDAPModelEvent for object class motivated events.
+     *
+     * @param reason
+     *      the reason (must be OCAdded, OCRemoved or OCModified)
+     * @param oldObjectClass
+     *      the old object class
+     * @param newObjectClass
+     *      the new object class
+     * @throws Exception
+     *      if bad reason
      */
-    public LDAPModelEvent( Reason reason, ObjectClass objectClass ) throws Exception
+    public LDAPModelEvent( Reason reason, ObjectClass oldObjectClass, ObjectClass newObjectClass ) throws Exception
     {
         this( reason );
         if ( ( reason == Reason.OCAdded ) || ( reason == Reason.OCModified ) || ( reason == Reason.OCRemoved ) )
         {
-            this.element = objectClass;
+            newValue = newObjectClass;
+            oldValue = oldObjectClass;
         }
         else
-            throw new Exception( "Event creation exception " + reason + " " + objectClass ); //$NON-NLS-1$ //$NON-NLS-2$
+        {
+            throw new Exception( "Event creation exception " + reason + " " + newObjectClass ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
     }
 
 
     /**
-     * Constructor for attributeType motivated events
-     * @param reason takes only ATAdded, ATRemoved or ATModified reasons
-     * @param attributeType the incriminated attributeType
-     * @throws Exception if bad reason
+     * Creates a new instance of LDAPModelEvent for attribute type motivated events.
+     *
+     * @param reason
+     *      the reason (must be ATAdded, ATRemoved or ATModified)
+     * @param oldAttributeType
+     *      the old attribute type
+     * @param newAttributeType
+     *      the new attribute type
+     * @throws Exception
+     *      if bad reason
      */
-    public LDAPModelEvent( Reason reason, AttributeType attributeType ) throws Exception
+    public LDAPModelEvent( Reason reason, AttributeType oldAttributeType, AttributeType newAttributeType )
+        throws Exception
     {
         this( reason );
         if ( ( reason == Reason.ATAdded ) || ( reason == Reason.ATModified ) || ( reason == Reason.ATRemoved ) )
         {
-            this.element = attributeType;
+            newValue = newAttributeType;
+            oldValue = oldAttributeType;
         }
         else
-            throw new Exception( "Event creation exception " + reason + " " + attributeType ); //$NON-NLS-1$ //$NON-NLS-2$
+        {
+            throw new Exception( "Event creation exception " + reason + " " + oldAttributeType ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
     }
 
 
     /**
-     * Constructor for schema motivated events
-     * @param reason takes only SchemaAdded or SchemaRemoved reasons
-     * @param schema the incriminated schema
-     * @throws Exception if bad reason
+     * Creates a new instance of LDAPModelEvent for schema motivated events.
+     *
+     * @param reason
+     *      the reason (must be SchemaAdded or SchemaRemoved)
+     * @param schema
+     *      the associated schema
+     * @throws Exception
+     *      if bad reason
      */
     public LDAPModelEvent( Reason reason, Schema schema ) throws Exception
     {
@@ -103,32 +137,47 @@
 
         if ( ( reason == Reason.SchemaAdded ) || ( reason == Reason.SchemaRemoved ) )
         {
-            this.element = schema;
+            newValue = schema;
         }
         else
+        {
             throw new Exception( "Event creation exception " + reason + " " + schema ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
     }
 
 
-    /******************************************
-     *              Accessors                 *
-     ******************************************/
+    /**
+     * Gets the reason of the the event.
+     * 
+     * @return
+     *      the reason of the event
+     */
+    public Reason getReason()
+    {
+        return reason;
+    }
+
 
     /**
-     * If specified, returns the element that was the cause of the Event
-     * @return an ObjectClass, an AttributeType, a Schema or null if not specified
+     * Gets the new value of the element.
+     *
+     * @return
+     *      the new value of the element.
      */
-    public Object getElement()
+    public Object getNewValue()
     {
-        return element;
+        return newValue;
     }
 
 
     /**
-     * @return Returns the reason of the event
+     * Gets the new value of the element.
+     *
+     * @return
+     *      the new value of the element.
      */
-    public Reason getReason()
+    public Object getOldValue()
     {
-        return reason;
+        return oldValue;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java Thu Mar 15 08:14:41 2007
@@ -35,8 +35,7 @@
  * elements it's based on the ASN.1 description.
  *
  */
-@SuppressWarnings("unused")//$NON-NLS-1$
-public class ObjectClass implements SchemaElement
+public class ObjectClass implements SchemaElement, Cloneable
 {
     private static Logger logger = Logger.getLogger( ObjectClass.class );
     private ObjectClassLiteral literal;
@@ -45,10 +44,6 @@
     private ObjectClassFormEditor editor;
 
 
-    /******************************************
-     *             Constructors               *
-     ******************************************/
-
     /**
      * Default constructor
      * @param literal the literal given by the schema parser that represents this element
@@ -62,10 +57,6 @@
     }
 
 
-    /******************************************
-     *               Accessors                *
-     ******************************************/
-
     /**
      * @return the openldap parser literal associated with this objectClass 
      */
@@ -104,10 +95,6 @@
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
      * Call this method to remove the objectClass<->Editor association
      * @param editor the associated editor
@@ -163,10 +150,6 @@
     }
 
 
-    /******************************************
-     *            Wrapper Methods             *
-     ******************************************/
-    //get
     public String[] getNames()
     {
         return literal.getNames();
@@ -215,67 +198,54 @@
     }
 
 
-    //set
-
     public void setNames( String[] names )
     {
         literal.setNames( names );
-        notifyChanged();
     }
 
 
     public void setOid( String oid )
     {
         literal.setOid( oid );
-        notifyChanged();
     }
 
 
     public void setDescription( String description )
     {
         literal.setDescription( description );
-        notifyChanged();
     }
 
 
     public void setClassType( ObjectClassTypeEnum type )
     {
         literal.setClassType( type );
-        notifyChanged();
     }
 
 
     public void setObsolete( boolean bool )
     {
         literal.setObsolete( bool );
-        notifyChanged();
     }
 
 
     public void setSuperiors( String[] superiors )
     {
         literal.setSuperiors( superiors );
-        notifyChanged();
     }
 
 
     public void setMay( String[] may )
     {
         literal.setMay( may );
-        notifyChanged();
     }
 
 
     public void setMust( String[] must )
     {
         literal.setMust( must );
-        notifyChanged();
     }
 
 
-    /******************************************
-     *                  I/O                   *
-     ******************************************/
     public String write()
     {
         StringBuffer sb = new StringBuffer();
@@ -316,7 +286,19 @@
         String[] superiors = literal.getSuperiors();
         if ( superiors.length != 0 )
         {
-            sb.append( "\tSUP " + superiors[0] + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+            if ( superiors.length > 1 )
+            {
+                sb.append( "\tSUP (" + superiors[0] );
+                for ( int i = 1; i < superiors.length; i++ )
+                {
+                    sb.append( " $ " + superiors[i] );
+                }
+                sb.append( ") \n" );
+            }
+            else
+            {
+                sb.append( "\tSUP " + superiors[0] + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+            }
         }
 
         // CLASSTYPE
@@ -380,20 +362,12 @@
     }
 
 
-    /******************************************
-     *           Object Redefinition          *
-     ******************************************/
-
     public String toString()
     {
         return getNames()[0];
     }
 
 
-    /******************************************
-     *            Events emmiting             *
-     ******************************************/
-
     public void addListener( SchemaElementListener listener )
     {
         if ( !listeners.contains( listener ) )
@@ -407,18 +381,69 @@
     }
 
 
-    private void notifyChanged()
+    private void notifyChanged( ObjectClass oldObjectClass )
     {
         for ( SchemaElementListener listener : listeners )
         {
             try
             {
-                listener.schemaElementChanged( this, new LDAPModelEvent( LDAPModelEvent.Reason.OCModified, this ) );
+                listener.schemaElementChanged( this, new LDAPModelEvent( LDAPModelEvent.Reason.OCModified,
+                    oldObjectClass, this ) );
             }
             catch ( Exception e )
             {
                 logger.debug( "error when notifying " + listener + " of " + this.getNames()[0] + " modification" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#clone()
+     */
+    public Object clone() throws CloneNotSupportedException
+    {
+        ObjectClass oc = ( ObjectClass ) super.clone();
+
+        oc.literal = new ObjectClassLiteral( literal.getOid() );
+        oc.literal.setClassType( literal.getClassType() );
+        oc.literal.setDescription( literal.getDescription() );
+        oc.literal.setMay( literal.getMay() );
+        oc.literal.setMust( literal.getMust() );
+        oc.literal.setNames( literal.getNames() );
+        oc.literal.setObsolete( literal.isObsolete() );
+        oc.literal.setSuperiors( literal.getSuperiors() );
+
+        return oc;
+    }
+
+
+    /**
+     * Update the object class.
+     *
+     * @param oc
+     *      the object class to get values from
+     */
+    public void update( ObjectClass oc )
+    {
+        try
+        {
+            ObjectClass oldObjectClass = ( ObjectClass ) clone();
+
+            literal.setClassType( oc.getClassType() );
+            literal.setDescription( oc.getDescription() );
+            literal.setMay( oc.getMay() );
+            literal.setMust( oc.getMust() );
+            literal.setNames( oc.getNames() );
+            literal.setObsolete( oc.isObsolete() );
+            literal.setOid( oc.getOid() );
+            literal.setSuperiors( oc.getSuperiors() );
+
+            notifyChanged( oldObjectClass );
+        }
+        catch ( CloneNotSupportedException e )
+        {
+            // Will never occurr.
         }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java?view=diff&rev=518658&r1=518657&r2=518658
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/Schema.java Thu Mar 15 08:14:41 2007
@@ -297,8 +297,8 @@
     public ObjectClass[] getObjectClassesAsArray()
     {
         Set<ObjectClass> set = new HashSet<ObjectClass>();
-        set.addAll(objectClassTable.values());
-        return set.toArray(new ObjectClass[0]);
+        set.addAll( objectClassTable.values() );
+        return set.toArray( new ObjectClass[0] );
     }
 
 
@@ -309,8 +309,8 @@
     public AttributeType[] getAttributeTypesAsArray()
     {
         Set<AttributeType> set = new HashSet<AttributeType>();
-        set.addAll(attributeTypeTable.values());
-        return set.toArray(new AttributeType[0]);
+        set.addAll( attributeTypeTable.values() );
+        return set.toArray( new AttributeType[0] );
     }
 
 
@@ -431,7 +431,7 @@
             objectClassTable.put( alias, oc );
         oc.addListener( this );
         this.modified();
-        notifyChanged( LDAPModelEvent.Reason.OCAdded, oc );
+        notifyChanged( LDAPModelEvent.Reason.OCAdded, null, oc );
     }
 
 
@@ -445,7 +445,7 @@
             attributeTypeTable.put( alias, at );
         at.addListener( this );
         this.modified();
-        notifyChanged( LDAPModelEvent.Reason.ATAdded, at );
+        notifyChanged( LDAPModelEvent.Reason.ATAdded, null, at );
     }
 
 
@@ -459,7 +459,7 @@
             objectClassTable.remove( alias );
         oc.removeListener( this );
         this.modified();
-        notifyChanged( LDAPModelEvent.Reason.OCRemoved, oc );
+        notifyChanged( LDAPModelEvent.Reason.OCRemoved, oc, null );
     }
 
 
@@ -473,7 +473,7 @@
             attributeTypeTable.remove( alias );
         at.removeListener( this );
         this.modified();
-        notifyChanged( LDAPModelEvent.Reason.ATRemoved, at );
+        notifyChanged( LDAPModelEvent.Reason.ATRemoved, at, null );
     }
 
 
@@ -579,7 +579,8 @@
             FileDialog fd = new FileDialog( new Shell(), SWT.SAVE );
             fd.setText( Messages.getString( "Schema.Save_this_schema" ) + this.getName() ); //$NON-NLS-1$
             IEclipsePreferences prefs = new ConfigurationScope().getNode( Activator.PLUGIN_ID );
-            String defaultPath = prefs.get( SchemasEditorPreferencePage.DEFAULT_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
+            String defaultPath = prefs.get( SchemasEditorPreferencePage.DEFAULT_DIRECTORY, System
+                .getProperty( "user.home" ) ); //$NON-NLS-1$
             fd.setFilterPath( defaultPath );
             fd.setFileName( this.name + ".schema" ); //$NON-NLS-1$
             fd.setFilterExtensions( new String[]
@@ -599,7 +600,7 @@
             write( savePath );
             //when we have been written, we are synchronised with the filesystem
             this.saved();
-            notifyChanged( LDAPModelEvent.Reason.SchemaSaved, null );
+            notifyChanged( LDAPModelEvent.Reason.SchemaSaved, this, null );
         }
     }
 
@@ -625,7 +626,8 @@
         FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE );
         fd.setText( Messages.getString( "Schema.Save_this_schema" ) + this.getName() ); //$NON-NLS-1$
         IEclipsePreferences prefs = new ConfigurationScope().getNode( Activator.PLUGIN_ID );
-        String defaultPath = prefs.get( SchemasEditorPreferencePage.DEFAULT_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
+        String defaultPath = prefs
+            .get( SchemasEditorPreferencePage.DEFAULT_DIRECTORY, System.getProperty( "user.home" ) ); //$NON-NLS-1$
         fd.setFilterPath( defaultPath );
         fd.setFileName( this.name + ".schema" ); //$NON-NLS-1$
         fd.setFilterExtensions( new String[]
@@ -658,7 +660,7 @@
                 write( savePath );
                 //when we have been written, we are synchronised with the filesystem
                 this.saved();
-                notifyChanged( LDAPModelEvent.Reason.SchemaSaved, null );
+                notifyChanged( LDAPModelEvent.Reason.SchemaSaved, this, null );
             }
         }
     }
@@ -690,18 +692,26 @@
     }
 
 
-    private void notifyChanged( LDAPModelEvent.Reason reason, Object o )
+    private void notifyChanged( LDAPModelEvent.Reason reason, Object oldValue, Object newValue )
     {
         for ( SchemaListener listener : listeners )
         {
             try
             {
-                if ( o instanceof ObjectClass )
-                    listener.schemaChanged( this, new LDAPModelEvent( reason, ( ObjectClass ) o ) );
-                else if ( o instanceof AttributeType )
-                    listener.schemaChanged( this, new LDAPModelEvent( reason, ( AttributeType ) o ) );
+                if ( ( oldValue instanceof ObjectClass ) || ( newValue instanceof ObjectClass ) )
+                {
+                    listener.schemaChanged( this, new LDAPModelEvent( reason, ( ObjectClass ) oldValue,
+                        ( ObjectClass ) newValue ) );
+                }
+                else if ( ( oldValue instanceof AttributeType ) || ( newValue instanceof AttributeType ) )
+                {
+                    listener.schemaChanged( this, new LDAPModelEvent( reason, ( AttributeType ) oldValue,
+                        ( AttributeType ) newValue ) );
+                }
                 else
+                {
                     listener.schemaChanged( this, new LDAPModelEvent( reason ) );
+                }
             }
             catch ( Exception e )
             {



Mime
View raw message