directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r575718 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/ProblemsViewController.java view/views/ProblemsView.java
Date Fri, 14 Sep 2007 15:14:57 GMT
Author: pamarcelot
Date: Fri Sep 14 08:14:56 2007
New Revision: 575718

URL: http://svn.apache.org/viewvc?rev=575718&view=rev
Log:
Fixed DIRSTUDIO-196 (Error dialog displayed after Problems View is closed).

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java?rev=575718&r1=575717&r2=575718&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
Fri Sep 14 08:14:56 2007
@@ -74,8 +74,30 @@
         }
     };
 
+    /** The ProjectHandlerListener */
+    private ProjectsHandlerListener projectsHandlerListener = new ProjectsHandlerAdapter()
+    {
+        public void openProjectChanged( Project oldProject, Project newProject )
+        {
+            if ( oldProject != null )
+            {
+                removeSchemaCheckerListener( oldProject );
+
+            }
+
+            if ( newProject != null )
+            {
+                addSchemaCheckerListener( newProject );
+                view.reloadViewer();
+            }
+            else
+            {
+                view.setErrorsAndWarningsCount( 0, 0 );
+                view.getViewer().setInput( null );
+            }
+        }
+    };
 
-    // The Actions
 
     /**
      * Creates a new instance of SchemasViewController.
@@ -87,58 +109,17 @@
     {
         this.view = view;
 
-        initActions();
-        initToolbar();
-        initProjectsHandlerListener();
-        initDoubleClickListener();
-        initSchemaCheckerListener();
-    }
-
-
-    /**
-     * Initializes the Actions.
-     */
-    private void initActions()
-    {
-    }
-
-
-    /**
-     * Initializes the Toolbar.
-     */
-    private void initToolbar()
-    {
-        //        IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
-    }
-
+        // ProjectsHandlerListener
+        Activator.getDefault().getProjectsHandler().addListener( projectsHandlerListener
);
 
-    /**
-     * Initializes the ProjectsHandlerListener.
-     */
-    private void initProjectsHandlerListener()
-    {
-        Activator.getDefault().getProjectsHandler().addListener( new ProjectsHandlerAdapter()
+        // SchemaCheckerListener
+        Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
+        if ( project != null )
         {
-            public void openProjectChanged( Project oldProject, Project newProject )
-            {
-                if ( oldProject != null )
-                {
-                    removeSchemaCheckerListener( oldProject );
-
-                }
+            addSchemaCheckerListener( project );
+        }
 
-                if ( newProject != null )
-                {
-                    addSchemaCheckerListener( newProject );
-                    view.reloadViewer();
-                }
-                else
-                {
-                    view.setErrorsAndWarningsCount( 0, 0 );
-                    view.getViewer().setInput( null );
-                }
-            }
-        } );
+        initDoubleClickListener();
     }
 
 
@@ -253,30 +234,18 @@
 
 
     /**
-     * Initializes the SchemaCheckerListener.
+     * Disposes the listeners.
      */
-    private void initSchemaCheckerListener()
+    public void dispose()
     {
-        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();
+        // ProjectsHandlerListener
+        Activator.getDefault().getProjectsHandler().removeListener( projectsHandlerListener
);
 
-        if ( schemaChecker != null )
+        // SchemaCheckerListener
+        Project project = Activator.getDefault().getProjectsHandler().getOpenProject();
+        if ( project != null )
         {
-            schemaChecker.addListener( new SchemaCheckerListener()
-            {
-                /* (non-Javadoc)
-                 * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaCheckerListener#schemaCheckerUpdated()
-                 */
-                public void schemaCheckerUpdated()
-                {
-                    Display.getDefault().asyncExec( new Runnable()
-                    {
-                        public void run()
-                        {
-                            view.reloadViewer();
-                        }
-                    } );
-                }
-            } );
+            removeSchemaCheckerListener( project );
         }
     }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java?rev=575718&r1=575717&r2=575718&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsView.java
Fri Sep 14 08:14:56 2007
@@ -59,6 +59,9 @@
 
     /** The SchemaChecker */
     private SchemaChecker schemaChecker;
+    
+    /** The Controller */
+    private ProblemsViewController controller;
 
 
     /* (non-Javadoc)
@@ -90,7 +93,7 @@
         initViewer( parent );
 
         // Adding the controller
-        new ProblemsViewController( this );
+        controller = new ProblemsViewController( this );
     }
 
 
@@ -194,5 +197,13 @@
         }
 
         overviewLabel.setText( sb.toString() );
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+     */
+    public void dispose()
+    {
+        controller.dispose();
     }
 }



Mime
View raw message