directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1213770 [1/2] - in /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/ controller/actions/ model/schemachecker/ view/dialogs/ view/editors/ view/editors/attributetype/ view/edito...
Date Tue, 13 Dec 2011 16:29:44 GMT
Author: pamarcelot
Date: Tue Dec 13 16:29:43 2011
New Revision: 1213770

URL: http://svn.apache.org/viewvc?rev=1213770&view=rev
Log:
Part of a fix for DIRSTUDIO-446 (Allow the user to rename any item using the F2 shortcut).

Added:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
Removed:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeAdapter.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/AttributeTypeListener.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassAdapter.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ObjectClassListener.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaAdapter.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaListener.java
Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerAdapter.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerListener.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/RenameSchemaElementAction.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditor.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_de.properties
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_fr.properties
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java Tue Dec 13 16:29:43 2011
@@ -76,9 +76,6 @@ public class SchemaHandler
     // The Listeners Lists
     //
     private List<SchemaHandlerListener> schemaHandlerListeners;
-    private MultiValueMap schemaListeners;
-    private MultiValueMap attributeTypeListeners;
-    private MultiValueMap objectClassListeners;
 
 
     /**
@@ -102,9 +99,6 @@ public class SchemaHandler
 
         // Listeners
         schemaHandlerListeners = new ArrayList<SchemaHandlerListener>();
-        schemaListeners = new MultiValueMap();
-        attributeTypeListeners = new MultiValueMap();
-        objectClassListeners = new MultiValueMap();
     }
 
 
@@ -381,99 +375,6 @@ public class SchemaHandler
 
 
     /**
-     * Adds a SchemaListener to the given schema.
-     *
-     * @param schema
-     *      the schema
-     * @param listener
-     *      the listener
-     */
-    public void addListener( Schema schema, SchemaListener listener )
-    {
-        if ( !schemaListeners.containsValue( schema, listener ) )
-        {
-            schemaListeners.put( schema, listener );
-        }
-    }
-
-
-    /**
-     * Removes a SchemaListener to the given schema.
-     *
-     * @param schema
-     *      the schema
-     * @param listener
-     *      the listener
-     */
-    public void removeListener( Schema schema, SchemaListener listener )
-    {
-        schemaListeners.remove( schema, listener );
-    }
-
-
-    /**
-     * Adds an AttributeTypeListener to the given attribute type.
-     *
-     * @param at
-     *      the attribute type
-     * @param listener
-     *      the listener
-     */
-    public void addListener( AttributeType at, AttributeTypeListener listener )
-    {
-        if ( !attributeTypeListeners.containsValue( at, listener ) )
-        {
-            attributeTypeListeners.put( at, listener );
-        }
-    }
-
-
-    /**
-     * Removes an AttributeTypeListener to the given attribute type.
-     *
-     * @param at
-     *      the attribute type
-     * @param listener
-     *      the listener
-     */
-    public void removeListener( AttributeType at, AttributeTypeListener listener )
-    {
-        attributeTypeListeners.remove( at, listener );
-    }
-
-
-    /**
-     * Adds an ObjectClassListener to the given object class.
-     *
-     * @param oc
-     *      the object class
-     * @param listener
-     *      the listener
-     */
-    public void addListener( ObjectClass oc, ObjectClassListener listener )
-    {
-        if ( !objectClassListeners.containsValue( oc, listener ) )
-        {
-            objectClassListeners.put( oc, listener );
-        }
-    }
-
-
-    /**
-     * Removes an ObjectClassListener to the given object class.
-     *
-     * @param oc
-     *      the object class
-     * @param listener
-     *      the listener
-     */
-    public void removeListener( ObjectClass oc, ObjectClassListener listener )
-    {
-        objectClassListeners.remove( oc, listener );
-    }
-
-
-    /**
      * Adds a schema
      *
      * @param schema
@@ -688,6 +589,46 @@ public class SchemaHandler
 
 
     /**
+     * Renames the given schema. 
+     *
+     * @param schema the schema
+     * @param newName the new name
+     */
+    public void renameSchema( Schema schema, String newName )
+    {
+        schemasMap.remove( Strings.toLowerCase( schema.getSchemaName() ) );
+        schema.setSchemaName( newName );
+        schemasMap.put( Strings.toLowerCase( schema.getSchemaName() ), schema );
+
+        // Removing its attribute types
+        for ( AttributeType at : schema.getAttributeTypes() )
+        {
+            at.setSchemaName( newName );
+        }
+
+        // Removing its matching rules
+        for ( MatchingRule mr : schema.getMatchingRules() )
+        {
+            mr.setSchemaName( newName );
+        }
+
+        // Removing its object classes
+        for ( ObjectClass oc : schema.getObjectClasses() )
+        {
+            oc.setSchemaName( newName );
+        }
+
+        // Removing its syntaxes
+        for ( LdapSyntax syntax : schema.getSyntaxes() )
+        {
+            syntax.setSchemaName( newName );
+        }
+
+        notifySchemaRenamed( schema );
+    }
+
+
+    /**
      * Adds the given attribute type.
      *
      * @param at
@@ -697,11 +638,6 @@ public class SchemaHandler
     {
         Schema schema = getSchema( at.getSchemaName() );
 
-        if ( schema == null )
-        {
-            // TODO Throw an exception
-        }
-
         schema.addAttributeType( at );
         addSchemaObject( at );
 
@@ -758,11 +694,6 @@ public class SchemaHandler
     {
         Schema schema = getSchema( at.getSchemaName() );
 
-        if ( schema == null )
-        {
-            // TODO Throw an exception
-        }
-
         schema.removeAttributeType( at );
         removeSchemaObject( at );
 
@@ -781,11 +712,6 @@ public class SchemaHandler
     {
         Schema schema = getSchema( oc.getSchemaName() );
 
-        if ( schema == null )
-        {
-            // TODO Throw an exception
-        }
-
         schema.addObjectClass( oc );
         addSchemaObject( oc );
 
@@ -836,11 +762,6 @@ public class SchemaHandler
     {
         Schema schema = getSchema( oc.getSchemaName() );
 
-        if ( schema == null )
-        {
-            // TODO Throw an exception
-        }
-
         schema.removeObjectClass( oc );
         removeSchemaObject( oc );
 
@@ -867,7 +788,7 @@ public class SchemaHandler
      * Notifies the given listeners that a schema has been removed.
      *
      * @param schema
-     *      the added schema
+     *      the removed schema
      */
     private void notifySchemaRemoved( Schema schema )
     {
@@ -879,6 +800,21 @@ public class SchemaHandler
 
 
     /**
+     * Notifies the given listeners that a schema has been renamed.
+     *
+     * @param schema
+     *      the renamed schema
+     */
+    private void notifySchemaRenamed( Schema schema )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
+        {
+            listener.schemaRenamed( schema );
+        }
+    }
+
+
+    /**
      * Notifies the SchemaHandler listeners that an attribute type has been added.
      *
      * @param at
@@ -891,16 +827,6 @@ public class SchemaHandler
         {
             listener.attributeTypeAdded( at );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( at.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).attributeTypeAdded( at );
-            }
-        }
     }
 
 
@@ -917,16 +843,6 @@ public class SchemaHandler
         {
             listener.attributeTypeModified( at );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( at.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).attributeTypeModified( at );
-            }
-        }
     }
 
 
@@ -943,26 +859,6 @@ public class SchemaHandler
         {
             listener.attributeTypeRemoved( at );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( at.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).attributeTypeRemoved( at );
-            }
-        }
-
-        // Attribute Type Listeners
-        List<?> atListeners = ( List<?> ) attributeTypeListeners.get( at );
-        if ( atListeners != null )
-        {
-            for ( Object object : atListeners.toArray() )
-            {
-                ( ( AttributeTypeListener ) object ).attributeTypeRemoved();
-            }
-        }
     }
 
 
@@ -979,16 +875,6 @@ public class SchemaHandler
         {
             listener.objectClassAdded( oc );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( oc.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).objectClassAdded( oc );
-            }
-        }
     }
 
 
@@ -1005,16 +891,6 @@ public class SchemaHandler
         {
             listener.objectClassModified( oc );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( oc.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).objectClassModified( oc );
-            }
-        }
     }
 
 
@@ -1031,182 +907,6 @@ public class SchemaHandler
         {
             listener.objectClassRemoved( oc );
         }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( oc.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).objectClassModified( oc );
-            }
-        }
-
-        // Object Class Listeners
-        List<?> ocListeners = ( List<?> ) objectClassListeners.get( oc );
-        if ( ocListeners != null )
-        {
-            for ( Object object : ocListeners.toArray() )
-            {
-                ( ( ObjectClassListener ) object ).objectClassRemoved();
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a matching rule has been added.
-     *
-     * @param mr
-     *      the added matching rule
-     */
-    private void notifyMatchingRuleAdded( MatchingRule mr )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.matchingRuleAdded( mr );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( mr.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).matchingRuleAdded( mr );
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a matching rule has been modified.
-     *
-     * @param mr
-     *      the modified matching rule
-     */
-    private void notifyMatchingRuleModified( MatchingRule mr )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.matchingRuleModified( mr );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( mr.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).matchingRuleModified( mr );
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a matching rule has been removed.
-     *
-     * @param mr
-     *      the removed matching rule
-     */
-    private void notifyMatchingRuleRemoved( MatchingRule mr )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.matchingRuleRemoved( mr );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( mr.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).matchingRuleRemoved( mr );
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a syntax has been added.
-     *
-     * @param syntax
-     *      the added syntax
-     */
-    private void notifySyntaxRuleAdded( LdapSyntax syntax )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.syntaxAdded( syntax );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( syntax.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).syntaxAdded( syntax );
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a syntax has been modified.
-     *
-     * @param syntax
-     *      the modified syntax
-     */
-    private void notifySyntaxRuleModified( LdapSyntax syntax )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.syntaxModified( syntax );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( syntax.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).syntaxModified( syntax );
-            }
-        }
-    }
-
-
-    /**
-     * Notifies the SchemaHandler listeners that a syntax has been removed.
-     *
-     * @param syntax
-     *      the removed syntax
-     */
-    private void notifySyntaxRemoved( LdapSyntax syntax )
-    {
-        // SchemaHandler Listeners
-        for ( SchemaHandlerListener listener : schemaHandlerListeners.toArray( new SchemaHandlerListener[0] ) )
-        {
-            listener.syntaxRemoved( syntax );
-        }
-
-        // Schema Listeners
-        List<?> listeners = ( List<?> ) schemaListeners.get( getSchema( syntax.getSchemaName() ) );
-        if ( listeners != null )
-        {
-            for ( Object object : listeners.toArray() )
-            {
-                ( ( SchemaListener ) object ).syntaxRemoved( syntax );
-            }
-        }
     }
 
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerAdapter.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerAdapter.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerAdapter.java Tue Dec 13 16:29:43 2011
@@ -129,6 +129,14 @@ public abstract class SchemaHandlerAdapt
     /**
      * {@inheritDoc}
      */
+    public void schemaRenamed( Schema schema )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void syntaxAdded( LdapSyntax syntax )
     {
     }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerListener.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerListener.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandlerListener.java Tue Dec 13 16:29:43 2011
@@ -135,6 +135,15 @@ public interface SchemaHandlerListener
 
 
     /**
+     * Sent when a schema is renamed.
+     *
+     * @param schema
+     *      the removed syntax
+     */
+    public void schemaRenamed( Schema schema );
+
+
+    /**
      * Sent when a syntax is added.
      *
      * @param syntax

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java Tue Dec 13 16:29:43 2011
@@ -206,6 +206,17 @@ public class SchemaViewController
         {
             ( ( SchemaViewContentProvider ) viewer.getContentProvider() ).schemaRemoved( schema );
         }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void schemaRenamed( Schema schema )
+        {
+
+            view.refresh();
+        }
+
     };
 
     /** The SchemaCheckerListener */

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/RenameSchemaElementAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/RenameSchemaElementAction.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/RenameSchemaElementAction.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/RenameSchemaElementAction.java Tue Dec 13 16:29:43 2011
@@ -24,14 +24,16 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.ObjectClass;
 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.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.dialogs.EditAliasesDialog;
 import org.apache.directory.studio.schemaeditor.view.dialogs.RenameSchemaDialog;
+import org.apache.directory.studio.schemaeditor.view.editors.EditorsUtils;
 import org.apache.directory.studio.schemaeditor.view.wrappers.AttributeTypeWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWrapper;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -91,30 +93,48 @@ public class RenameSchemaElementAction e
         {
             Object selectedElement = selection.getFirstElement();
 
-            // SCHEMA
-            if ( selectedElement instanceof SchemaWrapper )
+            // Saving all dirty editors before processing the renaming
+            if ( EditorsUtils.saveAllDirtyEditors() )
             {
-                Schema schema = ( ( SchemaWrapper ) selectedElement ).getSchema();
-
-                RenameSchemaDialog dialog = new RenameSchemaDialog( schema.getSchemaName() );
-                if ( dialog.open() == Dialog.OK )
+                // SCHEMA
+                if ( selectedElement instanceof SchemaWrapper )
                 {
-                    // TODO
+                    Schema schema = ( ( SchemaWrapper ) selectedElement ).getSchema();
+
+                    RenameSchemaDialog dialog = new RenameSchemaDialog( schema.getSchemaName() );
+                    if ( dialog.open() == RenameSchemaDialog.OK )
+                    {
+                        Activator.getDefault().getSchemaHandler().renameSchema( schema, dialog.getNewName() );
+                    }
                 }
-            }
-            // ATTRIBUTE TYPE
-            else if ( selectedElement instanceof AttributeTypeWrapper )
-            {
-                AttributeType attributeType = ( ( AttributeTypeWrapper ) selectedElement ).getAttributeType();
+                // ATTRIBUTE TYPE
+                else if ( selectedElement instanceof AttributeTypeWrapper )
+                {
+                    AttributeType attributeType = ( ( AttributeTypeWrapper ) selectedElement ).getAttributeType();
 
-                // TODO
-            }
-            // OBJECT CLASS
-            else if ( selectedElement instanceof ObjectClassWrapper )
-            {
-                ObjectClass objectClass = ( ( ObjectClassWrapper ) selectedElement ).getObjectClass();
+                    EditAliasesDialog dialog = new EditAliasesDialog( attributeType.getNames() );
+                    if ( dialog.open() == EditAliasesDialog.OK )
+                    {
+                        AttributeType modifiedAttributeType = PluginUtils.getClone( attributeType );
+                        modifiedAttributeType.setNames( dialog.getAliases() );
+                        Activator.getDefault().getSchemaHandler()
+                            .modifyAttributeType( attributeType, modifiedAttributeType );
+                    }
+                }
+                // OBJECT CLASS
+                else if ( selectedElement instanceof ObjectClassWrapper )
+                {
+                    ObjectClass objectClass = ( ( ObjectClassWrapper ) selectedElement ).getObjectClass();
 
-                // TODO
+                    EditAliasesDialog dialog = new EditAliasesDialog( objectClass.getNames() );
+                    if ( dialog.open() == EditAliasesDialog.OK )
+                    {
+                        ObjectClass modifiedObjectClass = PluginUtils.getClone( objectClass );
+                        modifiedObjectClass.setNames( dialog.getAliases() );
+                        Activator.getDefault().getSchemaHandler()
+                            .modifyObjectClass( objectClass, modifiedObjectClass );
+                    }
+                }
             }
         }
     }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java Tue Dec 13 16:29:43 2011
@@ -150,6 +150,12 @@ public class SchemaChecker
                 recheckWholeSchema();
             }
         }
+
+
+        public void schemaRenamed( Schema schema )
+        {
+            // Nothing to do, this is a simple renaming
+        }
     };
 
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java Tue Dec 13 16:29:43 2011
@@ -470,7 +470,7 @@ public class EditAliasesDialog extends D
         return aliases.toArray( new String[0] );
     }
 
-
+    
     /**
      * Gets the Dirty flag of the dialog
      *

Added: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java?rev=1213770&view=auto
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java (added)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java Tue Dec 13 16:29:43 2011
@@ -0,0 +1,134 @@
+/*
+ *  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. 
+ *  
+ */
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.apache.directory.studio.schemaeditor.view.editors;
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ListDialog;
+
+
+/**
+ * This class implements a utility class for the editors.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EditorsUtils
+{
+    /**
+     * Saves all the dirty editors (asking the user if they need to be saved or not).
+     *
+     * @return <code>true</code> if all the dirty editors were saved successfully,
+     *          <code>false</code> if not (if the user decided to not save them, or 
+     *          if an error occurred when saving).
+     */
+    public static boolean saveAllDirtyEditors()
+    {
+        IEditorPart[] dirtyEditors = getDirtyEditors();
+
+        if ( dirtyEditors.length == 0 )
+        {
+            return true;
+        }
+
+        if ( !askSaveAllDirtyEditors( dirtyEditors ) )
+        {
+            return false;
+        }
+
+        return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getWorkbench().saveAllEditors( false );
+    }
+
+
+    /**
+     * Asks the user if all the dirty editors must be saved.
+     *
+     * @param dirtyEditors the dirty editors
+     * @return <code>true</code> if the dirty editors must be saved,
+     *         <code>false</code> if not.
+     */
+    private static boolean askSaveAllDirtyEditors( IEditorPart[] dirtyEditors )
+    {
+        ListDialog dialog = new ListDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        dialog.setTitle( "Save All Modified Resources" );
+        dialog.setAddCancelButton( true );
+        dialog.setLabelProvider( new LabelProvider() );
+        dialog.setMessage( "All modified resources must be saved before this operation." );
+        dialog.setContentProvider( new ArrayContentProvider() );
+        dialog.setInput( dirtyEditors );
+        return dialog.open() == Window.OK;
+    }
+
+
+    /**
+     * Returns an array of all editors that have an unsaved content. If the identical content is 
+     * presented in more than one editor, only one of those editor parts is part of the result.
+     * 
+     * @return an array of all dirty editor parts.
+     */
+    public static IEditorPart[] getDirtyEditors()
+    {
+        Set<IEditorInput> inputs = new HashSet<IEditorInput>();
+        List<IEditorPart> result = new ArrayList<IEditorPart>( 0 );
+        IWorkbench workbench = PlatformUI.getWorkbench();
+        IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+        for ( int i = 0; i < windows.length; i++ )
+        {
+            IWorkbenchPage[] pages = windows[i].getPages();
+            for ( int x = 0; x < pages.length; x++ )
+            {
+                IEditorPart[] editors = pages[x].getDirtyEditors();
+                for ( int z = 0; z < editors.length; z++ )
+                {
+                    IEditorPart ep = editors[z];
+                    IEditorInput input = ep.getEditorInput();
+                    if ( !inputs.contains( input ) )
+                    {
+                        inputs.add( input );
+                        result.add( ep );
+                    }
+                }
+            }
+        }
+        return result.toArray( new IEditorPart[result.size()] );
+    }
+}

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java Tue Dec 13 16:29:43 2011
@@ -25,8 +25,6 @@ import org.apache.directory.shared.ldap.
 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.AttributeTypeAdapter;
-import org.apache.directory.studio.schemaeditor.controller.AttributeTypeListener;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
@@ -63,9 +61,9 @@ public class AttributeTypeEditor extends
     private boolean dirty = false;
 
     // The pages
-    private AttributeTypeEditorOverviewPage overview;
-    private AttributeTypeEditorSourceCodePage sourceCode;
-    private AttributeTypeEditorUsedByPage usedBy;
+    private AttributeTypeEditorOverviewPage overviewPage;
+    private AttributeTypeEditorSourceCodePage sourceCodePage;
+    private AttributeTypeEditorUsedByPage usedByPage;
 
     /** The original attribute type */
     private AttributeType originalAttributeType;
@@ -85,36 +83,54 @@ public class AttributeTypeEditor extends
 
             if ( selectedPage instanceof AttributeTypeEditorOverviewPage )
             {
-                if ( !sourceCode.canLeaveThePage() )
+                if ( !sourceCodePage.canLeaveThePage() )
                 {
                     notifyError( Messages.getString( "AttributeTypeEditor.CodeErrors" ) ); //$NON-NLS-1$
                     return;
                 }
 
-                overview.refreshUI();
+                overviewPage.refreshUI();
             }
             else if ( selectedPage instanceof AttributeTypeEditorSourceCodePage )
             {
-                if ( sourceCode.canLeaveThePage() )
+                if ( sourceCodePage.canLeaveThePage() )
                 {
-                    sourceCode.refreshUI();
+                    sourceCodePage.refreshUI();
                 }
             }
         }
     };
 
-    /** The attribute type listener */
-    private AttributeTypeListener attributeTypeListener = new AttributeTypeAdapter()
+    /** The SchemaHandler listener */
+    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
     {
-        public void attributeTypeRemoved()
+        public void attributeTypeModified( AttributeType at )
         {
-            getEditorSite().getPage().closeEditor( instance, false );
+            if ( at.equals( originalAttributeType ) )
+            {
+                // Updating the modified attribute type
+                modifiedAttributeType = PluginUtils.getClone( originalAttributeType );
+
+                // Refreshing the editor pages
+                overviewPage.refreshUI();
+                sourceCodePage.refreshUI();
+                usedByPage.refreshUI();
+
+                // Refreshing the part name (in case of a change in the name)
+                setPartName( getEditorInput().getName() );
+            }
         }
-    };
 
-    /** The SchemaHandler listener */
-    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
-    {
+
+        public void attributeTypeRemoved( AttributeType at )
+        {
+            if ( at.equals( originalAttributeType ) )
+            {
+                getEditorSite().getPage().closeEditor( instance, false );
+            }
+        }
+
+
         public void schemaRemoved( Schema schema )
         {
             if ( schema.equals( originalSchema ) )
@@ -122,6 +138,21 @@ public class AttributeTypeEditor extends
                 getEditorSite().getPage().closeEditor( instance, false );
             }
         }
+
+
+        public void schemaRenamed( Schema schema )
+        {
+            if ( schema.equals( originalSchema ) )
+            {
+                // Updating the modified attribute type
+                modifiedAttributeType = PluginUtils.getClone( originalAttributeType );
+
+                // Refreshing the editor pages
+                overviewPage.refreshUI();
+                sourceCodePage.refreshUI();
+                usedByPage.refreshUI();
+            }
+        }
     };
 
 
@@ -143,7 +174,6 @@ public class AttributeTypeEditor extends
 
         SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
         originalSchema = schemaHandler.getSchema( originalAttributeType.getSchemaName() );
-        schemaHandler.addListener( originalAttributeType, attributeTypeListener );
         schemaHandler.addListener( schemaHandlerListener );
 
         addPageChangedListener( pageChangedListener );
@@ -156,7 +186,6 @@ public class AttributeTypeEditor extends
     public void dispose()
     {
         SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
-        schemaHandler.removeListener( originalAttributeType, attributeTypeListener );
         schemaHandler.removeListener( schemaHandlerListener );
 
         super.dispose();
@@ -170,12 +199,12 @@ public class AttributeTypeEditor extends
     {
         try
         {
-            overview = new AttributeTypeEditorOverviewPage( this );
-            addPage( overview );
-            sourceCode = new AttributeTypeEditorSourceCodePage( this );
-            addPage( sourceCode );
-            usedBy = new AttributeTypeEditorUsedByPage( this );
-            addPage( usedBy );
+            overviewPage = new AttributeTypeEditorOverviewPage( this );
+            addPage( overviewPage );
+            sourceCodePage = new AttributeTypeEditorSourceCodePage( this );
+            addPage( sourceCodePage );
+            usedByPage = new AttributeTypeEditorUsedByPage( this );
+            addPage( usedByPage );
         }
         catch ( PartInitException e )
         {
@@ -190,7 +219,7 @@ public class AttributeTypeEditor extends
     public void doSave( IProgressMonitor monitor )
     {
         // Verifying if there is an error on the source code page
-        if ( !sourceCode.canLeaveThePage() )
+        if ( !sourceCodePage.canLeaveThePage() )
         {
             notifyError( Messages.getString( "AttributeTypeEditor.AttributeErrors" ) ); //$NON-NLS-1$
             monitor.setCanceled( true );

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java Tue Dec 13 16:29:43 2011
@@ -50,7 +50,6 @@ import org.eclipse.jface.viewers.ComboVi
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -90,10 +89,10 @@ public class AttributeTypeEditorOverview
     /** The page ID*/
     public static final String ID = AttributeTypeEditor.ID + ".overviewPage"; //$NON-NLS-1$
 
-    /** The original object class */
+    /** The original attribute type */
     private AttributeType originalAttributeType;
 
-    /** The modified object class */
+    /** The modified attribute type */
     private AttributeType modifiedAttributeType;
 
     /** The original schema */
@@ -105,27 +104,18 @@ public class AttributeTypeEditorOverview
     /** The SchemaHandler Listener */
     private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerListener()
     {
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeAdded( AttributeType at )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeModified( AttributeType at )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeRemoved( AttributeType at )
         {
             if ( !at.equals( originalAttributeType ) )
@@ -135,72 +125,48 @@ public class AttributeTypeEditorOverview
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleAdded( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleModified( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleRemoved( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassAdded( ObjectClass oc )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassModified( ObjectClass oc )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassRemoved( ObjectClass oc )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void schemaAdded( Schema schema )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void schemaRemoved( Schema schema )
         {
             if ( !schema.equals( originalSchema ) )
@@ -210,27 +176,24 @@ public class AttributeTypeEditorOverview
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
+        public void schemaRenamed( Schema schema )
+        {
+            refreshUI();
+        }
+
+
         public void syntaxAdded( LdapSyntax syntax )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void syntaxModified( LdapSyntax syntax )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void syntaxRemoved( LdapSyntax syntax )
         {
             refreshUI();
@@ -292,7 +255,7 @@ public class AttributeTypeEditorOverview
         public void widgetSelected( SelectionEvent e )
         {
             EditAliasesDialog editDialog = new EditAliasesDialog( modifiedAttributeType.getNames() );
-            if ( editDialog.open() != Window.OK )
+            if ( editDialog.open() != EditAliasesDialog.OK )
             {
                 return;
             }
@@ -690,11 +653,6 @@ public class AttributeTypeEditorOverview
      */
     protected void createFormContent( IManagedForm managedForm )
     {
-        // Getting the original and modified attribute types
-        modifiedAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getModifiedAttributeType();
-        originalAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getOriginalAttributeType();
-        originalSchema = schemaHandler.getSchema( originalAttributeType.getSchemaName() );
-
         // Creating the base UI
         ScrolledForm form = managedForm.getForm();
         FormToolkit toolkit = managedForm.getToolkit();
@@ -913,6 +871,11 @@ public class AttributeTypeEditorOverview
      */
     private void fillInUiFields()
     {
+        // Getting the original and modified attribute types
+        modifiedAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getModifiedAttributeType();
+        originalAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getOriginalAttributeType();
+        originalSchema = schemaHandler.getSchema( originalAttributeType.getSchemaName() );
+
         // ALIASES Label
         if ( ( modifiedAttributeType.getNames() != null ) && ( modifiedAttributeType.getNames().size() != 0 ) )
         {
@@ -1244,22 +1207,25 @@ public class AttributeTypeEditorOverview
 
 
     /**
-     * Refreshes the UI.
+     * {@inheritDoc}
      */
-    public void refreshUI()
+    public void dispose()
     {
         removeListeners();
-        fillInUiFields();
-        addListeners();
+
+        schemaHandler.removeListener( schemaHandlerListener );
+
+        super.dispose();
     }
 
 
     /**
-     * {@inheritDoc}
+     * Refreshes the UI.
      */
-    public void dispose()
+    public void refreshUI()
     {
-        schemaHandler.removeListener( schemaHandlerListener );
-        super.dispose();
+        removeListeners();
+        fillInUiFields();
+        addListeners();
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java Tue Dec 13 16:29:43 2011
@@ -55,6 +55,9 @@ public class AttributeTypeEditorSourceCo
     /** The page ID */
     public static final String ID = AttributeTypeEditor.ID + "sourceCodePage"; //$NON-NLS-1$
 
+    /** The flag to indicate if the page has been initialized */
+    private boolean initialized = false;
+
     /** The modified attribute type */
     private AttributeType modifiedAttributeType;
 
@@ -122,8 +125,6 @@ public class AttributeTypeEditorSourceCo
         form.getBody().setLayout( layout );
         toolkit.paintBordersFor( form.getBody() );
 
-        modifiedAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getModifiedAttributeType();
-
         // SOURCE CODE Field
         schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.BORDER | SWT.H_SCROLL
             | SWT.V_SCROLL );
@@ -140,12 +141,33 @@ public class AttributeTypeEditorSourceCo
 
         // Initialization from the "input" attribute type
         fillInUiFields();
-
-        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener );
+        
+        // Listeners initialization
+        addListeners();
 
         // Help Context for Dynamic Help
         PlatformUI.getWorkbench().getHelpSystem().setHelp( form,
             PluginConstants.PLUGIN_ID + "." + "attribute_type_editor" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        initialized = true;
+    }
+
+
+    /**
+     * Adds listeners to UI fields
+     */
+    private void addListeners()
+    {
+        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener );
+    }
+
+
+    /**
+     * Adds listeners to UI fields
+     */
+    private void removeListeners()
+    {
+        schemaSourceViewer.getTextWidget().removeModifyListener( schemaSourceViewerListener );
     }
 
 
@@ -154,6 +176,9 @@ public class AttributeTypeEditorSourceCo
      */
     private void fillInUiFields()
     {
+        // Getting the modified attribute type
+        modifiedAttributeType = ( ( AttributeTypeEditor ) getEditor() ).getModifiedAttributeType();
+
         // SOURCE CODE Field
         schemaSourceViewer.getDocument().set( OpenLdapSchemaFileExporter.toSourceCode( modifiedAttributeType ) );
     }
@@ -199,6 +224,22 @@ public class AttributeTypeEditorSourceCo
      */
     public void refreshUI()
     {
-        fillInUiFields();
+        if ( initialized )
+        {
+            removeListeners();
+            fillInUiFields();
+            addListeners();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        removeListeners();
+
+        super.dispose();
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java Tue Dec 13 16:29:43 2011
@@ -27,7 +27,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.ObjectClass;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
-import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
 import org.apache.directory.studio.schemaeditor.model.Schema;
@@ -64,15 +63,15 @@ public class AttributeTypeEditorUsedByPa
     /** The page ID */
     public static final String ID = AttributeTypeEditor.ID + "usedByPage"; //$NON-NLS-1$
 
+    /** The flag to indicate if the page has been initialized */
+    private boolean initialized = false;
+
     /** The modified attribute type */
     private AttributeType modifiedAttributeType;
 
     /** The original attribute type */
     private AttributeType originalAttributeType;
 
-    /** The Schema Handler */
-    private SchemaHandler schemaHandler;
-
     /** The Schema listener */
     private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
     {
@@ -213,8 +212,7 @@ public class AttributeTypeEditorUsedByPa
     public AttributeTypeEditorUsedByPage( FormEditor editor )
     {
         super( editor, ID, Messages.getString( "AttributeTypeEditorUsedByPage.UsedBy" ) ); //$NON-NLS-1$
-        schemaHandler = Activator.getDefault().getSchemaHandler();
-        schemaHandler.addListener( schemaHandlerListener );
+        Activator.getDefault().getSchemaHandler().addListener( schemaHandlerListener );
     }
 
 
@@ -248,6 +246,8 @@ public class AttributeTypeEditorUsedByPa
         // Help Context for Dynamic Help
         PlatformUI.getWorkbench().getHelpSystem().setHelp( form,
             PluginConstants.PLUGIN_ID + "." + "attribute_type_editor" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        initialized = true;
     }
 
 
@@ -366,6 +366,16 @@ public class AttributeTypeEditorUsedByPa
 
 
     /**
+     * Removes listeners to UI fields
+     */
+    private void removeListeners()
+    {
+        mandatoryAttributeTable.removeMouseListener( mandatoryAttributeTableListener );
+        optionalAttibuteTable.removeMouseListener( optionalAttibuteTableListener );
+    }
+
+
+    /**
      * Refreshes the Table Viewers
      */
     public void refreshTableViewers()
@@ -386,9 +396,24 @@ public class AttributeTypeEditorUsedByPa
      */
     public void dispose()
     {
-        schemaHandler.removeListener( schemaHandlerListener );
+        removeListeners();
+
+        Activator.getDefault().getSchemaHandler().removeListener( schemaHandlerListener );
 
         super.dispose();
     }
 
+
+    /**
+     * Refreshes the UI.
+     */
+    public void refreshUI()
+    {
+        if ( initialized )
+        {
+            removeListeners();
+            fillInUiFields();
+            addListeners();
+        }
+    }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditor.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditor.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditor.java Tue Dec 13 16:29:43 2011
@@ -25,8 +25,6 @@ import org.apache.directory.shared.ldap.
 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.ObjectClassAdapter;
-import org.apache.directory.studio.schemaeditor.controller.ObjectClassListener;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
@@ -57,11 +55,9 @@ public class ObjectClassEditor extends F
     /** The editor */
     private ObjectClassEditor instance;
 
-    /** The Overview page */
-    private ObjectClassEditorOverviewPage overview;
-
-    /** The Source Code page */
-    private ObjectClassEditorSourceCodePage sourceCode;
+    // The pages
+    private ObjectClassEditorOverviewPage overviewPage;
+    private ObjectClassEditorSourceCodePage sourceCodePage;
 
     /** The dirty state flag */
     private boolean dirty = false;
@@ -84,36 +80,53 @@ public class ObjectClassEditor extends F
 
             if ( selectedPage instanceof ObjectClassEditorOverviewPage )
             {
-                if ( !sourceCode.canLeaveThePage() )
+                if ( !sourceCodePage.canLeaveThePage() )
                 {
                     notifyError( Messages.getString( "ObjectClassEditor.CodeError" ) ); //$NON-NLS-1$
                     return;
                 }
 
-                overview.refreshUI();
+                overviewPage.refreshUI();
             }
             else if ( selectedPage instanceof ObjectClassEditorSourceCodePage )
             {
-                if ( sourceCode.canLeaveThePage() )
+                if ( sourceCodePage.canLeaveThePage() )
                 {
-                    sourceCode.refreshUI();
+                    sourceCodePage.refreshUI();
                 }
             }
         }
     };
 
-    /** The object class listener */
-    private ObjectClassListener objectClassListener = new ObjectClassAdapter()
+    /** The SchemaHandler listener */
+    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
     {
-        public void objectClassRemoved()
+        public void objectClassModified( ObjectClass oc )
         {
-            getEditorSite().getPage().closeEditor( instance, false );
+            if ( oc.equals( originalObjectClass ) )
+            {
+                // Updating the modified object class
+                modifiedObjectClass = PluginUtils.getClone( originalObjectClass );
+
+                // Refreshing the editor pages
+                overviewPage.refreshUI();
+                sourceCodePage.refreshUI();
+
+                // Refreshing the part name (in case of a change in the name)
+                setPartName( getEditorInput().getName() );
+            }
         }
-    };
 
-    /** The SchemaHandler listener */
-    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
-    {
+
+        public void objectClassRemoved( ObjectClass oc )
+        {
+            if ( oc.equals( originalObjectClass ) )
+            {
+                getEditorSite().getPage().closeEditor( instance, false );
+            }
+        }
+
+
         public void schemaRemoved( Schema schema )
         {
             if ( schema.equals( originalSchema ) )
@@ -121,6 +134,20 @@ public class ObjectClassEditor extends F
                 getEditorSite().getPage().closeEditor( instance, false );
             }
         }
+
+
+        public void schemaRenamed( Schema schema )
+        {
+            if ( schema.equals( originalSchema ) )
+            {
+                // Updating the modified object class
+                modifiedObjectClass = PluginUtils.getClone( originalObjectClass );
+
+                // Refreshing the editor pages
+                overviewPage.refreshUI();
+                sourceCodePage.refreshUI();
+            }
+        }
     };
 
 
@@ -142,7 +169,6 @@ public class ObjectClassEditor extends F
 
         SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
         originalSchema = schemaHandler.getSchema( originalObjectClass.getSchemaName() );
-        schemaHandler.addListener( originalObjectClass, objectClassListener );
         schemaHandler.addListener( schemaHandlerListener );
 
         addPageChangedListener( pageChangedListener );
@@ -155,7 +181,6 @@ public class ObjectClassEditor extends F
     public void dispose()
     {
         SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
-        schemaHandler.removeListener( originalObjectClass, objectClassListener );
         schemaHandler.removeListener( schemaHandlerListener );
 
         super.dispose();
@@ -169,10 +194,10 @@ public class ObjectClassEditor extends F
     {
         try
         {
-            overview = new ObjectClassEditorOverviewPage( this ); //$NON-NLS-1$ //$NON-NLS-2$
-            addPage( overview );
-            sourceCode = new ObjectClassEditorSourceCodePage( this ); //$NON-NLS-1$ //$NON-NLS-2$
-            addPage( sourceCode );
+            overviewPage = new ObjectClassEditorOverviewPage( this ); //$NON-NLS-1$ //$NON-NLS-2$
+            addPage( overviewPage );
+            sourceCodePage = new ObjectClassEditorSourceCodePage( this ); //$NON-NLS-1$ //$NON-NLS-2$
+            addPage( sourceCodePage );
         }
         catch ( PartInitException e )
         {
@@ -187,7 +212,7 @@ public class ObjectClassEditor extends F
     public void doSave( IProgressMonitor monitor )
     {
         // Verifying if there is an error on the source code page
-        if ( !sourceCode.canLeaveThePage() )
+        if ( !sourceCodePage.canLeaveThePage() )
         {
             notifyError( Messages.getString( "ObjectClassEditor.CodeErrorObject" ) ); //$NON-NLS-1$
             monitor.setCanceled( true );

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java Tue Dec 13 16:29:43 2011
@@ -51,7 +51,6 @@ import org.apache.directory.studio.schem
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -110,81 +109,54 @@ public class ObjectClassEditorOverviewPa
     /** The SchemaHandler Listener */
     private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerListener()
     {
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeAdded( AttributeType at )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeModified( AttributeType at )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void attributeTypeRemoved( AttributeType at )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleAdded( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleModified( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void matchingRuleRemoved( MatchingRule mr )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassAdded( ObjectClass oc )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassModified( ObjectClass oc )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void objectClassRemoved( ObjectClass oc )
         {
             if ( !oc.equals( originalObjectClass ) )
@@ -194,18 +166,12 @@ public class ObjectClassEditorOverviewPa
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void schemaAdded( Schema schema )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void schemaRemoved( Schema schema )
         {
             if ( !schema.equals( originalSchema ) )
@@ -215,27 +181,24 @@ public class ObjectClassEditorOverviewPa
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
+        public void schemaRenamed( Schema schema )
+        {
+            refreshUI();
+        }
+
+
         public void syntaxAdded( LdapSyntax syntax )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void syntaxModified( LdapSyntax syntax )
         {
             refreshUI();
         }
 
 
-        /**
-         * {@inheritDoc}
-         */
         public void syntaxRemoved( LdapSyntax syntax )
         {
             refreshUI();
@@ -294,7 +257,7 @@ public class ObjectClassEditorOverviewPa
         public void widgetSelected( SelectionEvent e )
         {
             EditAliasesDialog editDialog = new EditAliasesDialog( modifiedObjectClass.getNames() );
-            if ( editDialog.open() != Window.OK )
+            if ( editDialog.open() != EditAliasesDialog.OK )
             {
                 return;
             }
@@ -485,7 +448,7 @@ public class ObjectClassEditorOverviewPa
             }
             dialog.setHiddenAttributeTypes( hiddenATs.toArray( new AttributeType[0] ) );
 
-            if ( dialog.open() != Window.OK )
+            if ( dialog.open() != AttributeTypeSelectionDialog.OK )
             {
                 return;
             }
@@ -622,7 +585,7 @@ public class ObjectClassEditorOverviewPa
             }
             dialog.setHiddenAttributeTypes( hiddenATs.toArray( new AttributeType[0] ) );
 
-            if ( dialog.open() != Window.OK )
+            if ( dialog.open() != AttributeTypeSelectionDialog.OK )
             {
                 return;
             }
@@ -756,7 +719,7 @@ public class ObjectClassEditorOverviewPa
             hiddenOCs.add( originalObjectClass );
             dialog.setHiddenObjectClasses( hiddenOCs.toArray( new ObjectClass[0] ) );
 
-            if ( dialog.open() != Window.OK )
+            if ( dialog.open() != ObjectClassSelectionDialog.OK )
             {
                 return;
             }
@@ -864,11 +827,6 @@ public class ObjectClassEditorOverviewPa
      */
     protected void createFormContent( IManagedForm managedForm )
     {
-        // Getting the original and modified object classes
-        modifiedObjectClass = ( ( ObjectClassEditor ) getEditor() ).getModifiedObjectClass();
-        originalObjectClass = ( ( ObjectClassEditor ) getEditor() ).getOriginalObjectClass();
-        originalSchema = schemaHandler.getSchema( originalObjectClass.getSchemaName() );
-
         // Creating the base UI
         ScrolledForm form = managedForm.getForm();
         FormToolkit toolkit = managedForm.getToolkit();
@@ -1106,6 +1064,11 @@ public class ObjectClassEditorOverviewPa
      */
     private void fillInUiFields()
     {
+        // Getting the original and modified object classes
+        modifiedObjectClass = ( ( ObjectClassEditor ) getEditor() ).getModifiedObjectClass();
+        originalObjectClass = ( ( ObjectClassEditor ) getEditor() ).getOriginalObjectClass();
+        originalSchema = schemaHandler.getSchema( originalObjectClass.getSchemaName() );
+
         // ALIASES Label
         if ( ( modifiedObjectClass.getNames() != null ) && ( modifiedObjectClass.getNames().size() != 0 ) )
         {
@@ -1278,23 +1241,25 @@ public class ObjectClassEditorOverviewPa
 
 
     /**
-     * Refreshes the UI.
+     * {@inheritDoc}
      */
-    public void refreshUI()
+    public void dispose()
     {
         removeListeners();
-        fillInUiFields();
-        addListeners();
+        
+        schemaHandler.removeListener( schemaHandlerListener );
+
+        super.dispose();
     }
 
 
     /**
-     * {@inheritDoc}
+     * Refreshes the UI.
      */
-    public void dispose()
+    public void refreshUI()
     {
-        schemaHandler.removeListener( schemaHandlerListener );
-
-        super.dispose();
+        removeListeners();
+        fillInUiFields();
+        addListeners();
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java Tue Dec 13 16:29:43 2011
@@ -55,8 +55,8 @@ public class ObjectClassEditorSourceCode
     /** The page ID */
     public static final String ID = ObjectClassEditor.ID + "sourceCodePage"; //$NON-NLS-1$
 
-    /** The page title*/
-    public static final String TITLE = "Source Code"; //$NON-NLS-1$
+    /** The flag to indicate if the page has been initialized */
+    private boolean initialized = false;
 
     /** The modified object class */
     private ObjectClass modifiedObjectClass;
@@ -108,7 +108,7 @@ public class ObjectClassEditorSourceCode
      */
     public ObjectClassEditorSourceCodePage( FormEditor editor )
     {
-        super( editor, ID, TITLE );
+        super( editor, ID, Messages.getString( "ObjectClassEditorSourceCodePage.SourceCode" ) ); //$NON-NLS-1$
     }
 
 
@@ -125,8 +125,6 @@ public class ObjectClassEditorSourceCode
         form.getBody().setLayout( layout );
         toolkit.paintBordersFor( form.getBody() );
 
-        modifiedObjectClass = ( ( ObjectClassEditor ) getEditor() ).getModifiedObjectClass();
-
         // SOURCE CODE Field
         schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.BORDER | SWT.H_SCROLL
             | SWT.V_SCROLL );
@@ -143,12 +141,33 @@ public class ObjectClassEditorSourceCode
 
         // Initialization from the "input" object class
         fillInUiFields();
-
-        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener );
+        
+        // Listeners initialization
+        addListeners();
 
         // Help Context for Dynamic Help
         PlatformUI.getWorkbench().getHelpSystem().setHelp( form,
             PluginConstants.PLUGIN_ID + "." + "object_class_editor" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        initialized = true;
+    }
+
+
+    /**
+     * Adds listeners to UI fields
+     */
+    private void addListeners()
+    {
+        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener );
+    }
+
+
+    /**
+     * Adds listeners to UI fields
+     */
+    private void removeListeners()
+    {
+        schemaSourceViewer.getTextWidget().removeModifyListener( schemaSourceViewerListener );
     }
 
 
@@ -157,6 +176,9 @@ public class ObjectClassEditorSourceCode
      */
     private void fillInUiFields()
     {
+        // Getting the modified object class
+        modifiedObjectClass = ( ( ObjectClassEditor ) getEditor() ).getModifiedObjectClass();
+
         // SOURCE CODE Field
         schemaSourceViewer.getDocument().set( OpenLdapSchemaFileExporter.toSourceCode( modifiedObjectClass ) );
     }
@@ -195,6 +217,22 @@ public class ObjectClassEditorSourceCode
      */
     public void refreshUI()
     {
-        fillInUiFields();
+        if ( initialized )
+        {
+            removeListeners();
+            fillInUiFields();
+            addListeners();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        removeListeners();
+
+        super.dispose();
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties Tue Dec 13 16:29:43 2011
@@ -43,4 +43,5 @@ ObjectClassEditorOverviewPage.SpecifyMan
 ObjectClassEditorOverviewPage.SpecifyOptionalAttributes=Specify the optional attribute types.
 ObjectClassEditorOverviewPage.Structural=Structural
 ObjectClassEditorOverviewPage.SuperiorClasses=Superior classes:
+ObjectClassEditorSourceCodePage.SourceCode=Source Code
 ObjectClassEditorSuperiorsTableLabelProvider.None=(None)  -  ({0})

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_de.properties?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_de.properties (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_de.properties Tue Dec 13 16:29:43 2011
@@ -43,4 +43,5 @@ ObjectClassEditorOverviewPage.SpecifyMan
 ObjectClassEditorOverviewPage.SpecifyOptionalAttributes=Spezifizieren Sie optionale Attribut-Typen.
 ObjectClassEditorOverviewPage.Structural=Strukturell
 ObjectClassEditorOverviewPage.SuperiorClasses=\u00DCbergeordnete Klassen\:
+ObjectClassEditorSourceCodePage.SourceCode=Source Code
 ObjectClassEditorSuperiorsTableLabelProvider.None=(Keine)  -  ({0})

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_fr.properties?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages_fr.properties Tue Dec 13 16:29:43 2011
@@ -43,4 +43,5 @@ ObjectClassEditorOverviewPage.SpecifyMan
 ObjectClassEditorOverviewPage.SpecifyOptionalAttributes=Pr\u00E9ciser les attributs optionnels.
 ObjectClassEditorOverviewPage.Structural=Structurel
 ObjectClassEditorOverviewPage.SuperiorClasses=Classes h\u00E9rit\u00E9es:
+ObjectClassEditorSourceCodePage.SourceCode=Code source
 ObjectClassEditorSuperiorsTableLabelProvider.None=(Pas de nom)  -  ({0})

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java?rev=1213770&r1=1213769&r2=1213770&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java Tue Dec 13 16:29:43 2011
@@ -51,10 +51,10 @@ public class SchemaEditor extends FormEd
     private SchemaEditor instance;
 
     /** The Overview Page */
-    private SchemaEditorOverviewPage overview;
+    private SchemaEditorOverviewPage overviewPage;
 
     /** The Source Code page */
-    private SchemaEditorSourceCodePage sourceCode;
+    private SchemaEditorSourceCodePage sourceCodePage;
 
     /** The associated schema */
     private Schema schema;
@@ -69,6 +69,18 @@ public class SchemaEditor extends FormEd
                 getEditorSite().getPage().closeEditor( instance, false );
             }
         }
+
+
+        public void schemaRenamed( Schema schema )
+        {
+            // Refreshing the editor pages
+            overviewPage.refreshUI();
+            sourceCodePage.refreshUI();
+
+            // Refreshing the part name (in case of a change in the name)
+            setPartName( getEditorInput().getName() );
+
+        }
     };
 
 
@@ -98,10 +110,10 @@ public class SchemaEditor extends FormEd
     {
         try
         {
-            overview = new SchemaEditorOverviewPage( this );
-            addPage( overview );
-            sourceCode = new SchemaEditorSourceCodePage( this );
-            addPage( sourceCode );
+            overviewPage = new SchemaEditorOverviewPage( this );
+            addPage( overviewPage );
+            sourceCodePage = new SchemaEditorSourceCodePage( this );
+            addPage( sourceCodePage );
         }
         catch ( PartInitException e )
         {



Mime
View raw message