directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r560906 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors: attributetype/AttributeTypeEditor.java schema/SchemaEditor.java
Date Mon, 30 Jul 2007 09:39:24 GMT
Author: pamarcelot
Date: Mon Jul 30 02:39:23 2007
New Revision: 560906

URL: http://svn.apache.org/viewvc?view=rev&rev=560906
Log:
Updated the Schema Editor to automatically be closed when the schema is closed.

Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java?view=diff&rev=560906&r1=560905&r2=560906
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
Mon Jul 30 02:39:23 2007
@@ -112,7 +112,7 @@
         }
     };
 
-    /** The originalSchema listener */
+    /** The SchemaHandler listener */
     private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
     {
         public void schemaRemoved( Schema schema )

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java?view=diff&rev=560906&r1=560905&r2=560906
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java
Mon Jul 30 02:39:23 2007
@@ -22,6 +22,8 @@
 
 
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerAdapter;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener;
 import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
 import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -45,6 +47,9 @@
     /** The ID of the Editor */
     public static final String ID = Activator.PLUGIN_ID + ".view.schemaEditor"; //$NON-NLS-1$
 
+    /** The editor */
+    private SchemaEditor instance;
+
     /** The Overview Page */
     private SchemaEditorOverviewPage overview;
 
@@ -54,16 +59,32 @@
     /** The associated schema */
     private Schema schema;
 
+    /** The SchemaHandler listener */
+    private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
+    {
+        public void schemaRemoved( Schema s )
+        {
+            if ( schema.equals( s ) )
+            {
+                getEditorSite().getPage().closeEditor( instance, false );
+            }
+        }
+    };
+
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
      */
     public void init( IEditorSite site, IEditorInput input ) throws PartInitException
     {
+        instance = this;
+
         setSite( site );
         setInput( input );
         setPartName( input.getName() );
 
+        Activator.getDefault().getSchemaHandler().addListener( schemaHandlerListener );
+
         schema = ( ( SchemaEditorInput ) getEditorInput() ).getSchema();
     }
 
@@ -84,6 +105,17 @@
         {
             logger.debug( "error when adding pages" ); //$NON-NLS-1$
         }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
+     */
+    public void dispose()
+    {
+        Activator.getDefault().getSchemaHandler().removeListener( schemaHandlerListener );
+
+        super.dispose();
     }
 
 



Mime
View raw message