directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r589614 - /directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java
Date Mon, 29 Oct 2007 13:07:32 GMT
Author: pamarcelot
Date: Mon Oct 29 06:07:31 2007
New Revision: 589614

URL: http://svn.apache.org/viewvc?rev=589614&view=rev
Log:
Updated Browser Connection ToolItem to behave correctly when the currently selected connection
is updated and removed.

Modified:
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java?rev=589614&r1=589613&r2=589614&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/BrowserConnectionWidgetContributionItem.java
Mon Oct 29 06:07:31 2007
@@ -21,6 +21,11 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionFolder;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
 import org.apache.directory.studio.ldapbrowser.common.widgets.search.BrowserConnectionWidget;
@@ -43,7 +48,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BrowserConnectionWidgetContributionItem extends ContributionItem
+public class BrowserConnectionWidgetContributionItem extends ContributionItem implements
ConnectionUpdateListener
 {
     /** The schema page */
     private SchemaPage schemaPage;
@@ -95,6 +100,8 @@
             }
         } );
 
+        ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionUIPlugin.getDefault().getEventRunner()
);
+
         // Initializing the width for the toolbar item
         toolitem.setWidth( 250 );
 
@@ -107,6 +114,7 @@
      */
     public void dispose()
     {
+        ConnectionEventRegistry.removeConnectionUpdateListener( this );
         toolItemComposite.dispose();
         toolItemComposite = null;
         browserConnectionWidget = null;
@@ -185,4 +193,65 @@
         browserConnectionWidget.setEnabled( !schemaPage.isShowDefaultSchema() );
     }
 
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionUpdated(org.apache.directory.studio.connection.core.Connection)
+     */
+    public final void connectionUpdated( Connection connection )
+    {
+        IBrowserConnection selectedConnection = browserConnectionWidget.getBrowserConnection();
+        if ( connection.equals( selectedConnection.getConnection() ) )
+        {
+            browserConnectionWidget.setBrowserConnection( browserConnectionWidget.getBrowserConnection()
);
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionAdded(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionAdded( Connection connection )
+    {
+        // Nothing to do
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRemoved(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionRemoved( Connection connection )
+    {
+        IBrowserConnection selectedConnection = browserConnectionWidget.getBrowserConnection();
+        if ( connection.equals( selectedConnection.getConnection() ) )
+        {
+            schemaPage.getSchemaBrowser().setInput( new SchemaBrowserInput( null, null )
);
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionOpened( Connection connection )
+    {
+        // Nothing to do
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionClosed( Connection connection )
+    {
+        // Nothing to do
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
+     */
+    public void connectionFolderModified( ConnectionFolder connectionFolder )
+    {
+        // Nothing to do
+    }
 }



Mime
View raw message