directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r529075 - in /directory/ldapstudio/trunk: ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/ ldapstud...
Date Sun, 15 Apr 2007 21:36:35 GMT
Author: seelmann
Date: Sun Apr 15 14:36:34 2007
New Revision: 529075

URL: http://svn.apache.org/viewvc?view=rev&rev=529075
Log:
Improved Event Handling: 
- Added EventRunner and two implemtations for UI and non-UI thread execution
- Each EventListener has to pass its specific EventRunner
- Removed EventDispatcher

Added:
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/UiThreadEventRunner.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/CoreEventRunner.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunner.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/EventDispatcherSync.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventDispatcher.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventPerformanceMeter.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/BrowserActionProxy.java
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/browser/BrowserUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/connection/ConnectionUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCorePlugin.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ConnectionManager.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/BookmarkUpdateListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ConnectionUpdateListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EntryUpdateListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunnable.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SearchUpdateListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/DelegateEntry.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorCursor.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryAttributesWizardPage.java
    directory/ldapstudio/trunk/ldapstudio-ldifeditor/src/main/java/org/apache/directory/ldapstudio/ldifeditor/editor/LdifEditor.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java Sun Apr 15 14:36:34 2007
@@ -5,7 +5,7 @@
 import java.net.URL;
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
-import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.EventRunner;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtension;
@@ -58,11 +58,11 @@
 
     /** The filter template context type registry. */
     private ContributionContextTypeRegistry filterTemplateContextTypeRegistry;
-    
-    /** The event dispatcher */
-    private EventDispatcherSync eventDispatcher;
-    
-    
+
+    /** The event runner. */
+    private EventRunner eventRunner;
+
+
     /**
      * The constructor
      */
@@ -78,31 +78,29 @@
     public void start( BundleContext context ) throws Exception
     {
         super.start( context );
-        
+
+        if ( eventRunner == null )
+        {
+            eventRunner = new UiThreadEventRunner();
+        }
+
         if ( fontRegistry == null )
         {
             fontRegistry = new FontRegistry( getWorkbench().getDisplay() );
         }
-        
+
         if ( colorRegistry == null )
         {
             colorRegistry = new ColorRegistry( getWorkbench().getDisplay() );
         }
-        
+
         if ( exceptionHandler == null )
         {
             exceptionHandler = new ExceptionHandler();
         }
 
-        if ( eventDispatcher == null )
-        {
-            eventDispatcher = new EventDispatcherSync();
-            eventDispatcher.startEventDispatcher();
-        }
-        EventRegistry.init( eventDispatcher );
-        
         valueEditorPreferences = new ValueEditorsPreferences();
-        
+
         if ( filterTemplateContextTypeRegistry == null )
         {
             filterTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
@@ -114,9 +112,9 @@
         if ( filterTemplateStore == null )
         {
 
-
-        BrowserCorePlugin.getDefault().setAuthHandler( new BrowserCommonAuthHandler() );
-        BrowserCorePlugin.getDefault().setReferralHandler( new BrowserCommonReferralHandler() );}
+            BrowserCorePlugin.getDefault().setAuthHandler( new BrowserCommonAuthHandler() );
+            BrowserCorePlugin.getDefault().setReferralHandler( new BrowserCommonReferralHandler() );
+        }
     }
 
 
@@ -127,33 +125,32 @@
     {
         plugin = null;
         super.stop( context );
-        
+
+        if ( eventRunner != null )
+        {
+            eventRunner = null;
+        }
+
         if ( fontRegistry != null )
         {
             fontRegistry = null;
         }
-        
+
         if ( colorRegistry != null )
         {
             colorRegistry = null;
         }
-        
+
         if ( exceptionHandler != null )
         {
             exceptionHandler = null;
         }
 
-        if ( eventDispatcher != null )
-        {
-            eventDispatcher.stopEventDispatcher();
-            eventDispatcher = null;
-        }
-        
         if ( filterTemplateContextTypeRegistry != null )
         {
             filterTemplateContextTypeRegistry = null;
         }
-        
+
         if ( filterTemplateStore != null )
         {
             try
@@ -183,7 +180,7 @@
     /**
      * Use this method to get SWT images. Use the IMG_ constants from
      * BrowserWidgetsConstants for the key.
-     * 
+     *
      * @param key
      *                The key (relative path to the image im filesystem)
      * @return The image discriptor or null
@@ -212,7 +209,7 @@
      * <p>
      * Note: Don't dispose the returned SWT Image. It is disposed
      * automatically when the plugin is stopped.
-     * 
+     *
      * @param key
      *                The key (relative path to the image im filesystem)
      * @return The SWT Image or null
@@ -233,14 +230,14 @@
         return image;
     }
 
-    
+
     /**
      * Use this method to get SWT fonts. A FontRegistry is used to manage
      * the FontData[]->Font mapping.
      * <p>
      * Note: Don't dispose the returned SWT Font. It is disposed
      * automatically when the plugin is stopped.
-     * 
+     *
      * @param fontData
      *                the font data
      * @return The SWT Font
@@ -263,7 +260,7 @@
      * <p>
      * Note: Don't dispose the returned color. It is disposed automatically
      * when the plugin is stopped.
-     * 
+     *
      * @param rgb
      *                the rgb color data
      * @return The SWT Color
@@ -277,32 +274,31 @@
 
         return colorRegistry.get( rgb.toString() );
     }
-    
+
 
     /**
-     * 
+     *
      * @return The exception handler
      */
     public ExceptionHandler getExceptionHandler()
     {
         return exceptionHandler;
     }
-    
-    
+
+
     /**
      * Gets the value editors preferences.
-     * 
+     *
      * @return the value editors preferences
      */
     public ValueEditorsPreferences getValueEditorsPreferences()
     {
         return valueEditorPreferences;
     }
-    
 
 
     /**
-     * 
+     *
      * @return The filter template store
      */
     public TemplateStore getFilterTemplateStore()
@@ -312,15 +308,15 @@
 
 
     /**
-     * 
+     *
      * @return The filter template context type registry
      */
     public ContextTypeRegistry getFilterTemplateContextTypeRegistry()
     {
         return filterTemplateContextTypeRegistry;
     }
-    
-    
+
+
     /**
      * Checks, if this plugins runs in the Eclipse IDE or in RCP environment.
      * This is done by looking for the Resource perspective extensions.
@@ -354,8 +350,19 @@
                 }
             }
         }
-        
+
         return false;
     }
-    
+
+
+    /**
+     * Gets the event runner.
+     *
+     * @return the event runner
+     */
+    public EventRunner getEventRunner()
+    {
+        return eventRunner;
+    }
+
 }

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/UiThreadEventRunner.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/UiThreadEventRunner.java?view=auto&rev=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/UiThreadEventRunner.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/UiThreadEventRunner.java Sun Apr 15 14:36:34 2007
@@ -0,0 +1,30 @@
+
+package org.apache.directory.ldapstudio.browser.common;
+
+import org.apache.directory.ldapstudio.browser.core.events.EventRunnable;
+import org.apache.directory.ldapstudio.browser.core.events.EventRunner;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * Implementation of {@link EventRunner} that executes an {@link EventRunnable}
+ * withing the SWT UI thread.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class UiThreadEventRunner implements EventRunner
+{
+
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation executes the given {@link EventRunnable} within
+     * the SWT UI thread.
+     */
+    public void execute( EventRunnable runnable )
+    {
+        Display.getDefault().asyncExec( runnable );
+    }
+
+}

Modified: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/BrowserActionProxy.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/BrowserActionProxy.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/BrowserActionProxy.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/proxy/BrowserActionProxy.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.common.actions.proxy;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.BrowserAction;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateEvent;
@@ -32,9 +33,7 @@
 import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
 import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
 import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateListener;
-
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
@@ -63,10 +62,10 @@
         this.selectionProvider.addSelectionChangedListener( this );
         // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addSelectionListener(this);
 
-        EventRegistry.addConnectionUpdateListener( this );
-        EventRegistry.addEntryUpdateListener( this );
-        EventRegistry.addSearchUpdateListener( this );
-        EventRegistry.addBookmarkUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         this.updateAction();
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/browser/BrowserUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/browser/BrowserUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/browser/BrowserUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/browser/BrowserUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.common.widgets.browser;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.core.events.AttributesInitializedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
 import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateListener;
@@ -54,13 +55,13 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation checks if the collapsed entry more children
-         * than currently fetched. If this is the case cached children are 
+         * than currently fetched. If this is the case cached children are
          * cleared an must be fetched newly when expanding the tree.
-         * 
+         *
          * This could happen when first using a search that returns
-         * only some of an entry's children. 
+         * only some of an entry's children.
          */
         public void treeCollapsed( TreeExpansionEvent event )
         {
@@ -119,8 +120,8 @@
         viewer.addTreeListener( treeViewerListener );
         viewer.addDoubleClickListener( doubleClickListener );
 
-        EventRegistry.addConnectionUpdateListener( this );
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
     }
 
 
@@ -144,8 +145,8 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * This implementation refreshes the tree and collapses the 
+     *
+     * This implementation refreshes the tree and collapses the
      * tree when the connection is closed.
      */
     public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
@@ -167,13 +168,13 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the tree.
      */
     public void entryUpdated( EntryModificationEvent event )
     {
         // Don't handle attribute initalization, could cause double
-        // retrieval of children. 
+        // retrieval of children.
         //
         // When double-clicking an entry two Jobs/Threads are started:
         // - InitializeAttributesJob and

Modified: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/connection/ConnectionUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/connection/ConnectionUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/connection/ConnectionUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/connection/ConnectionUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.common.widgets.connection;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateEvent;
 import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateListener;
 import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
@@ -58,10 +59,10 @@
     {
         this.viewer = viewer;
 
-        EventRegistry.addConnectionUpdateListener( this );
-        EventRegistry.addEntryUpdateListener( this );
-        EventRegistry.addSearchUpdateListener( this );
-        EventRegistry.addBookmarkUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
     }
 
 
@@ -83,7 +84,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the viewer. If a new connection was added
      * this connection is selected.
      */
@@ -102,7 +103,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the viewer.
      */
     public void entryUpdated( EntryModificationEvent event )
@@ -116,7 +117,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the viewer.
      */
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
@@ -134,7 +135,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the viewer.
      */
     public void bookmarkUpdated( BookmarkUpdateEvent bookmarkUpdateEvent )

Modified: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.common.widgets.entryeditor;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.core.events.BulkModificationEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EmptyValueAddedEvent;
@@ -72,7 +73,7 @@
 
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation starts the value editor.
          */
         public void widgetDefaultSelected( SelectionEvent e )
@@ -87,7 +88,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation starts the value editor or expands/collapses the selected attribute.
          */
         public void mouseDoubleClick( MouseEvent e )
@@ -142,7 +143,7 @@
         // register listeners
         viewer.getTree().addSelectionListener( viewerSelectionListener  );
         viewer.getTree().addMouseListener( viewerMouseListener  );
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
     }
 
 
@@ -163,7 +164,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the viewer and selects a value depending
      * on the event.
      */

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCorePlugin.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCorePlugin.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCorePlugin.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCorePlugin.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,23 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core;
 
 
+import org.apache.directory.ldapstudio.browser.core.events.CoreEventRunner;
+import org.apache.directory.ldapstudio.browser.core.events.EventRunner;
 import org.apache.directory.ldapstudio.browser.core.model.IAuthHandler;
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.IReferralHandler;
@@ -51,6 +53,9 @@
     /** The preferences */
     private BrowserCorePreferences preferences;
 
+    /** The event runner. */
+    private EventRunner eventRunner;
+
 
     /**
      * Creates a new instance of BrowserCorePlugin.
@@ -70,6 +75,11 @@
     {
         super.start( context );
 
+        if ( eventRunner == null )
+        {
+            eventRunner = new CoreEventRunner();
+        }
+
         if ( connectionManager == null )
         {
             connectionManager = new ConnectionManager();
@@ -84,6 +94,11 @@
     {
         super.stop( context );
 
+        if ( eventRunner != null )
+        {
+            eventRunner = null;
+        }
+
         if ( connectionManager != null )
         {
             IConnection[] connections = connectionManager.getConnections();
@@ -98,7 +113,7 @@
 
     /**
      * Returns the BrowserPlugin instance.
-     * 
+     *
      * @return The BrowserPlugin instance
      */
     public static BrowserCorePlugin getDefault()
@@ -109,8 +124,8 @@
 
     /**
      * Gets the Connection Manager
-     * 
-     * @return 
+     *
+     * @return
      *      the connection manager
      */
     public ConnectionManager getConnectionManager()
@@ -120,7 +135,7 @@
 
 
     /**
-     * 
+     *
      * @return The preferences
      */
     public BrowserCorePreferences getCorePreferences()
@@ -155,7 +170,7 @@
 
     /**
      * Gets the ReferralHanlder
-     * 
+     *
      * @return
      *      the ReferralHandler
      */
@@ -167,12 +182,23 @@
 
     /**
      * Sets the ReferralHandler
-     * 
+     *
      * @param referralHandler
      *      the ReferralHandler to set
      */
     public void setReferralHandler( IReferralHandler referralHandler )
     {
         this.referralHandler = referralHandler;
+    }
+
+
+    /**
+     * Gets the event runner.
+     *
+     * @return the event runner
+     */
+    public EventRunner getEventRunner()
+    {
+        return eventRunner;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ConnectionManager.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ConnectionManager.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ConnectionManager.java Sun Apr 15 14:36:34 2007
@@ -78,9 +78,9 @@
     {
         this.connectionList = new ArrayList<IConnection>();
         loadConnections();
-        EventRegistry.addConnectionUpdateListener( this );
-        EventRegistry.addSearchUpdateListener( this );
-        EventRegistry.addBookmarkUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner() );
+        EventRegistry.addSearchUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner() );
+        EventRegistry.addBookmarkUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner() );
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/BookmarkUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/BookmarkUpdateListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/BookmarkUpdateListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/BookmarkUpdateListener.java Sun Apr 15 14:36:34 2007
@@ -6,20 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.events;
 
+import java.util.EventListener;
+
 import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
 
 
@@ -34,7 +36,7 @@
 
     /**
      * Called when an {@link IBookmark} was updated.
-     * 
+     *
      * @param bookmarkUpdateEvent the bookmark update event
      */
     public void bookmarkUpdated( BookmarkUpdateEvent bookmarkUpdateEvent );

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ConnectionUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ConnectionUpdateListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ConnectionUpdateListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/ConnectionUpdateListener.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,23 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.events;
 
 
+import java.util.EventListener;
+
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 
 
@@ -35,7 +37,7 @@
 
     /**
      * Called when an {@link IConnection} was updated.
-     * 
+     *
      * @param connectionUpdateEvent the connection update event
      */
     public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent );

Added: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/CoreEventRunner.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/CoreEventRunner.java?view=auto&rev=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/CoreEventRunner.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/CoreEventRunner.java Sun Apr 15 14:36:34 2007
@@ -0,0 +1,25 @@
+package org.apache.directory.ldapstudio.browser.core.events;
+
+
+/**
+ * Default implementation of {@link EventRunner} that executes an {@link EventRunnable}
+ * withing the current thread.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CoreEventRunner implements EventRunner
+{
+
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation executes the given {@link EventRunnable} within
+     * the current thread.
+     */
+    public void execute( EventRunnable runnable )
+    {
+        runnable.run();
+    }
+
+}

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EntryUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EntryUpdateListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EntryUpdateListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EntryUpdateListener.java Sun Apr 15 14:36:34 2007
@@ -6,20 +6,23 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.events;
 
+
+import java.util.EventListener;
+
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 
 
@@ -34,7 +37,7 @@
 
     /**
      * Called when an {@link IEntry} was updated.
-     * 
+     *
      * @param event the event
      */
     public void entryUpdated( EntryModificationEvent event );

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRegistry.java Sun Apr 15 14:36:34 2007
@@ -6,208 +6,357 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.events;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
-import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
-import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
-import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleUseDescription;
-import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
 
+/**
+ * The EventRegistry is a central point to register for LDAP Studio specific
+ * events and to fire events to registered listeners.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class EventRegistry
 {
 
-    private static EventDispatcher eventDispatcher;
+    /** The list of threads with suspended event fireing. */
+    private static Set<Thread> suspendedEventFireringThreads = new HashSet<Thread>();;
+
+    /** The lock used to synchronize event fireings */
+    private static Object lock = new Object();
 
 
-    public static void init( EventDispatcher eventDispatcher )
+    /**
+     * Checks if event fireing is suspended in the current thread.
+     *
+     * @return true, if event fireing is suspended in the current thread
+     */
+    public static boolean isEventFireingSuspendedInCurrentThread()
     {
-        EventRegistry.eventDispatcher = eventDispatcher;
+        return suspendedEventFireringThreads.contains( Thread.currentThread() );
     }
 
 
+    /**
+     * Resumes event fireing in the current thread.
+     */
     public static void resumeEventFireingInCurrentThread()
     {
-        eventDispatcher.resumeEventFireingInCurrentThread();
+        suspendedEventFireringThreads.remove( Thread.currentThread() );
     }
 
 
+    /**
+     * Suspends event fireing in the current thread.
+     */
     public static void suspendEventFireingInCurrentThread()
     {
-        eventDispatcher.suspendEventFireingInCurrentThread();
+        suspendedEventFireringThreads.add( Thread.currentThread() );
     }
 
-    private static List searchUpdateListenerList = new ArrayList();
 
 
-    public static void addSearchUpdateListener( SearchUpdateListener listener )
+    /** The map with search update listeners and their runners */
+    private static Map<SearchUpdateListener, EventRunner> searchUpdateListeners = new HashMap<SearchUpdateListener, EventRunner>();
+
+
+    /**
+     * Adds the search update listener.
+     *
+     * @param listener the listener
+     * @param runner the runner
+     */
+    public static void addSearchUpdateListener( SearchUpdateListener listener, EventRunner runner )
     {
-        if ( !searchUpdateListenerList.contains( listener ) )
-            searchUpdateListenerList.add( listener );
+        assert listener != null;
+        assert runner != null;
+
+        if ( !searchUpdateListeners.containsKey( listener ) )
+        {
+            searchUpdateListeners.put( listener, runner );
+        }
     }
 
 
+    /**
+     * Removes the search update listener.
+     *
+     * @param listener the listener
+     */
     public static void removeSearchUpdateListener( SearchUpdateListener listener )
     {
-        if ( searchUpdateListenerList.contains( listener ) )
-            searchUpdateListenerList.remove( listener );
+        if ( searchUpdateListeners.containsKey( listener ) )
+        {
+            searchUpdateListeners.remove( listener );
+        }
     }
 
 
+    /**
+     * Notifies each {@link SearchUpdateListener} about the the given {@link SearchUpdateEvent}.
+     * Uses the {@link EventRunner}s.
+     *
+     * @param searchUpdateEvent the search update event
+     * @param source the source
+     */
     public static void fireSearchUpdated( final SearchUpdateEvent searchUpdateEvent, final Object source )
     {
-        for ( int i = 0; i < searchUpdateListenerList.size(); i++ )
+        if( isEventFireingSuspendedInCurrentThread() )
+        {
+            return;
+        }
+
+        Iterator<SearchUpdateListener> it = searchUpdateListeners.keySet().iterator();
+        while( it.hasNext() )
         {
-            final SearchUpdateListener listener = ( SearchUpdateListener ) searchUpdateListenerList.get( i );
+            final SearchUpdateListener listener = it.next();
             EventRunnable runnable = new EventRunnable()
             {
-                public Object getEventObject()
-                {
-                    return searchUpdateEvent.getSearch();
-                }
-
-
                 public void run()
                 {
                     listener.searchUpdated( searchUpdateEvent );
                 }
             };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
+
+            EventRunner runner = searchUpdateListeners.get( listener );
+
+            synchronized( lock )
+            {
+                runner.execute( runnable );
+            }
         }
     }
 
-    private static List bookmarkUpdateListenerList = new ArrayList();
+
+    /** The map with bookmark update listeners and their runners */
+    private static Map<BookmarkUpdateListener, EventRunner> bookmarkUpdateListeners = new HashMap<BookmarkUpdateListener, EventRunner>();
 
 
-    public static void addBookmarkUpdateListener( BookmarkUpdateListener listener )
+    /**
+     * Adds the bookmark update listener.
+     *
+     * @param listener the listener
+     * @param runner the runner
+     */
+    public static void addBookmarkUpdateListener( BookmarkUpdateListener listener, EventRunner runner )
     {
-        if ( !bookmarkUpdateListenerList.contains( listener ) )
-            bookmarkUpdateListenerList.add( listener );
+        assert listener != null;
+        assert runner != null;
+
+        if ( !bookmarkUpdateListeners.containsKey( listener ) )
+        {
+            bookmarkUpdateListeners.put( listener, runner );
+        }
     }
 
 
+    /**
+     * Removes the bookmark update listener.
+     *
+     * @param listener the listener
+     */
     public static void removeBookmarkUpdateListener( BookmarkUpdateListener listener )
     {
-        if ( bookmarkUpdateListenerList.contains( listener ) )
-            bookmarkUpdateListenerList.remove( listener );
+        if ( bookmarkUpdateListeners.containsKey( listener ) )
+        {
+            bookmarkUpdateListeners.remove( listener );
+        }
     }
 
 
+    /**
+     * Notifies each {@link BookmarkUpdateListener} about the the given {@link BookmarkUpdateEvent}.
+     * Uses the {@link EventRunner}s.
+     *
+     * @param bookmarkUpdateEvent the bookmark update event
+     * @param source the source
+     */
     public static void fireBookmarkUpdated( final BookmarkUpdateEvent bookmarkUpdateEvent, final Object source )
     {
-        for ( int i = 0; i < bookmarkUpdateListenerList.size(); i++ )
+        if( isEventFireingSuspendedInCurrentThread() )
+        {
+            return;
+        }
+
+        Iterator<BookmarkUpdateListener> it = bookmarkUpdateListeners.keySet().iterator();
+        while( it.hasNext() )
         {
-            final BookmarkUpdateListener listener = ( BookmarkUpdateListener ) bookmarkUpdateListenerList.get( i );
+            final BookmarkUpdateListener listener = it.next();
             EventRunnable runnable = new EventRunnable()
             {
-                public Object getEventObject()
-                {
-                    return bookmarkUpdateEvent.getBookmark();
-                }
-
-
                 public void run()
                 {
                     listener.bookmarkUpdated( bookmarkUpdateEvent );
                 }
             };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
+
+            EventRunner runner = bookmarkUpdateListeners.get( listener );
+            synchronized( lock )
+            {
+                runner.execute( runnable );
+            }
         }
     }
 
-    private static List connectionUpdateListenerList = new ArrayList();
+    /** The map with connection update listeners and their runners */
+    private static Map<ConnectionUpdateListener, EventRunner> connectionUpdateListeners = new HashMap<ConnectionUpdateListener, EventRunner>();
 
 
-    public static void addConnectionUpdateListener( ConnectionUpdateListener listener )
+    /**
+     * Adds the connection update listener.
+     *
+     * @param listener the listener
+     * @param runner the runner
+     */
+    public static void addConnectionUpdateListener( ConnectionUpdateListener listener, EventRunner runner )
     {
-        if ( !connectionUpdateListenerList.contains( listener ) )
-            connectionUpdateListenerList.add( listener );
+        assert listener != null;
+        assert runner != null;
+
+        if ( !connectionUpdateListeners.containsKey( listener ) )
+        {
+            connectionUpdateListeners.put( listener, runner );
+        }
     }
 
 
+    /**
+     * Removes the connection update listener.
+     *
+     * @param listener the listener
+     */
     public static void removeConnectionUpdateListener( ConnectionUpdateListener listener )
     {
-        if ( connectionUpdateListenerList.contains( listener ) )
-            connectionUpdateListenerList.remove( listener );
+        if ( connectionUpdateListeners.containsKey( listener ) )
+        {
+            connectionUpdateListeners.remove( listener );
+        }
     }
 
 
+    /**
+     * Notifies each {@link ConnectionUpdateListener} about the the given {@link ConnectionUpdateEvent}.
+     * Uses the {@link EventRunner}s.
+     *
+     * @param connectionUpdateEvent the connection update event
+     * @param source the source
+     */
     public static void fireConnectionUpdated( final ConnectionUpdateEvent connectionUpdateEvent, final Object source )
     {
-        for ( int i = 0; i < connectionUpdateListenerList.size(); i++ )
+        if( isEventFireingSuspendedInCurrentThread() )
+        {
+            return;
+        }
+
+        Iterator<ConnectionUpdateListener> it = connectionUpdateListeners.keySet().iterator();
+        while( it.hasNext() )
         {
-            final ConnectionUpdateListener listener = ( ConnectionUpdateListener ) connectionUpdateListenerList.get( i );
+            final ConnectionUpdateListener listener = it.next();
             EventRunnable runnable = new EventRunnable()
             {
-                public Object getEventObject()
-                {
-                    return connectionUpdateEvent.getConnection();
-                }
-
-
                 public void run()
                 {
                     listener.connectionUpdated( connectionUpdateEvent );
                 }
             };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
+
+            EventRunner runner = connectionUpdateListeners.get( listener );
+            synchronized( lock )
+            {
+                runner.execute( runnable );
+            }
         }
     }
 
-    private static List entryUpdateListenerList = new ArrayList();
 
+    /** The map with entry update listeners and their runners */
+    private static Map<EntryUpdateListener, EventRunner> entryUpdateListeners = new HashMap<EntryUpdateListener, EventRunner>();
 
-    public static void addEntryUpdateListener( EntryUpdateListener listener )
+
+    /**
+     * Adds the entry update listener.
+     *
+     * @param listener the listener
+     * @param runner the runner
+     */
+    public static void addEntryUpdateListener( EntryUpdateListener listener, EventRunner runner )
     {
-        if ( !entryUpdateListenerList.contains( listener ) )
-            entryUpdateListenerList.add( listener );
+        assert listener != null;
+        assert runner != null;
+
+        if ( !entryUpdateListeners.containsKey( listener ) )
+        {
+            entryUpdateListeners.put( listener, runner );
+        }
     }
 
 
+    /**
+     * Removes the entry update listener.
+     *
+     * @param listener the listener
+     */
     public static void removeEntryUpdateListener( EntryUpdateListener listener )
     {
-        if ( entryUpdateListenerList.contains( listener ) )
-            entryUpdateListenerList.remove( listener );
+        if ( entryUpdateListeners.containsKey( listener ) )
+        {
+            entryUpdateListeners.remove( listener );
+        }
     }
 
 
-    public static void fireEntryUpdated( final EntryModificationEvent event, final Object source )
+    /**
+     * Notifies each {@link EntryUpdateListener} about the the given {@link EntryModificationEvent}.
+     * Uses the {@link EventRunner}s.
+     *
+     * @param entryUpdateEvent the entry update event
+     * @param source the source
+     */
+    public static void fireEntryUpdated( final EntryModificationEvent entryUpdateEvent, final Object source )
     {
-        for ( int i = 0; i < entryUpdateListenerList.size(); i++ )
+        if( isEventFireingSuspendedInCurrentThread() )
+        {
+            return;
+        }
+
+        Iterator<EntryUpdateListener> it = entryUpdateListeners.keySet().iterator();
+        while( it.hasNext() )
         {
-            final EntryUpdateListener listener = ( EntryUpdateListener ) entryUpdateListenerList.get( i );
+            final EntryUpdateListener listener = it.next();
             EventRunnable runnable = new EventRunnable()
             {
-                public Object getEventObject()
-                {
-                    return event;
-                }
-
-
                 public void run()
                 {
-                    listener.entryUpdated( event );
+                    listener.entryUpdated( entryUpdateEvent );
                 }
             };
-            eventDispatcher.dispatchEvent( source, listener, runnable );
+
+            EventRunner runner = entryUpdateListeners.get( listener );
+            synchronized( lock )
+            {
+                runner.execute( runnable );
+            }
         }
     }
+
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunnable.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunnable.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunnable.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunnable.java Sun Apr 15 14:36:34 2007
@@ -6,24 +6,30 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.events;
 
 
+/**
+ * The <code>EventRunnable</code> interface should be implemented by any
+ * class whose instances are intended to be executed by an {@link EventRunner}.
+ * The class must define a method of no arguments called <code>run</code>.
+ * <p>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public interface EventRunnable extends Runnable
 {
-
-    public Object getEventObject();
-
 }

Added: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunner.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunner.java?view=auto&rev=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunner.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/EventRunner.java Sun Apr 15 14:36:34 2007
@@ -0,0 +1,20 @@
+package org.apache.directory.ldapstudio.browser.core.events;
+
+
+/**
+ * An EventRunner is used to execute an {@link EventRunnable}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface EventRunner
+{
+
+    /**
+     * Executes the given {@link EventRunnable}.
+     *
+     * @param runnable the event runnable to run
+     */
+    public void execute( EventRunnable runnable );
+
+}

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SearchUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SearchUpdateListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SearchUpdateListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/events/SearchUpdateListener.java Sun Apr 15 14:36:34 2007
@@ -21,6 +21,8 @@
 package org.apache.directory.ldapstudio.browser.core.events;
 
 
+import java.util.EventListener;
+
 import org.apache.directory.ldapstudio.browser.core.model.ISearch;
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/DelegateEntry.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/DelegateEntry.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/DelegateEntry.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/DelegateEntry.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.core.internal.model;
@@ -74,7 +74,7 @@
         this.dn = dn;
         this.entryDoesNotExist = false;
         this.delegate = null;
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner() );
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ConnectionComboContributionItem.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.widgets.connection.ConnectionContentProvider;
 import org.apache.directory.ldapstudio.browser.common.widgets.connection.ConnectionLabelProvider;
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
@@ -94,7 +95,7 @@
         {
             public void selectionChanged( SelectionChangedEvent event )
             {
-                // Do not set the input of the schema browser if 
+                // Do not set the input of the schema browser if
                 // the selection was changed programatically.
                 if ( !inChange )
                 {
@@ -104,7 +105,7 @@
             }
         } );
 
-        EventRegistry.addConnectionUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         // Initialize width of combo
         toolitem.setWidth( comboViewer.getCombo().computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
@@ -126,7 +127,7 @@
     /**
      * The control item implementation of this <code>IContributionItem</code>
      * method calls the <code>createControl</code> method.
-     * 
+     *
      * @param parent the parent of the control to fill
      */
     public final void fill( Composite parent )
@@ -138,7 +139,7 @@
     /**
      * The control item implementation of this <code>IContributionItem</code>
      * method throws an exception since controls cannot be added to menus.
-     * 
+     *
      * @param parent the menu
      * @param index menu index
      */
@@ -153,7 +154,7 @@
      * method calls the <code>createControl</code>  method to
      * create a control under the given parent, and then creates
      * a new tool item to hold it.
-     * 
+     *
      * @param parent the ToolBar to add the new control to
      * @param index the index
      */
@@ -179,7 +180,7 @@
 
     /**
      * Gets the connection.
-     * 
+     *
      * @return the connection
      */
     public IConnection getConnection()
@@ -196,7 +197,7 @@
 
     /**
      * Sets the connection.
-     * 
+     *
      * @param connection the connection
      */
     public void setConnection( IConnection connection )

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
@@ -78,7 +79,7 @@
     private void init()
     {
         this.selectionProvider.addSelectionChangedListener( this );
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         this.selectedSearch = null;
         this.selectedSearchResult = null;

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorCursor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorCursor.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorCursor.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorCursor.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
@@ -25,6 +25,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
 import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
@@ -63,7 +64,7 @@
         setBackground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION ) );
         setForeground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION_TEXT ) );
 
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         initSelectionChecker();
         initSelectionProvider();

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
@@ -27,6 +27,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.core.events.EmptyValueAddedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
@@ -109,7 +110,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation sets the editor's input when a search is selected.
          */
         public void selectionChanged( IWorkbenchPart part, ISelection selection )
@@ -138,7 +139,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation deactivates the shortcuts when the part is deactivated.
          */
         public void partDeactivated( IWorkbenchPartReference partRef )
@@ -158,7 +159,7 @@
 
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation activates the shortcuts when the part is activated.
          */
         public void partActivated( IWorkbenchPartReference partRef )
@@ -232,7 +233,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation opens the search result when clicking thd DN link.
          */
         public void linkActivated( HyperlinkEvent e )
@@ -274,7 +275,7 @@
 
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation removed the DN link.
          */
         public void mouseExit( MouseEvent e )
@@ -297,7 +298,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation renders the DN link.
          */
         public void mouseMove( MouseEvent e )
@@ -319,7 +320,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation renders the DN link.
          */
         public void mouseMove( MouseEvent e )
@@ -342,7 +343,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation sets the cursor's background color.
          */
         public void widgetSelected( SelectionEvent e )
@@ -369,7 +370,7 @@
 
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation starts the value editor when pressing enter.
          */
         public void widgetDefaultSelected( SelectionEvent e )
@@ -386,7 +387,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation starts the value editor when double-clicking a cell.
          */
         public void mouseDoubleClick( MouseEvent e )
@@ -419,7 +420,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation starts the value editor when a non-control key is pressed.
          */
         public void keyPressed( KeyEvent e )
@@ -493,8 +494,8 @@
         editor.getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener( BrowserView.getId(),
             searchSelectionListener );
 
-        EventRegistry.addSearchUpdateListener( this );
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
     }
 
 
@@ -523,7 +524,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the search result editor.
      */
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
@@ -537,8 +538,8 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * This implementation refreshes the search result editor 
+     *
+     * This implementation refreshes the search result editor
      * or starts the value editor if an empty value was added.
      */
     public void entryUpdated( EntryModificationEvent event )
@@ -677,7 +678,7 @@
 
 
     /**
-     * Ensures that the table contains at least the number of 
+     * Ensures that the table contains at least the number of
      * the requested columns.
      *
      * @param count the requested number of columns

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.views.browser;
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.common.widgets.browser.BrowserUniversalListener;
 import org.apache.directory.ldapstudio.browser.core.events.AttributesInitializedEvent;
@@ -92,7 +93,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation sets the input when another connection was selected.
          */
         public void selectionChanged( IWorkbenchPart part, ISelection selection )
@@ -120,7 +121,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation deactivates the shortcuts when the part is deactivated.
          */
         public void partDeactivated( IWorkbenchPartReference partRef )
@@ -140,7 +141,7 @@
 
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation activates the shortcuts when the part is activated.
          */
         public void partActivated( IWorkbenchPartReference partRef )
@@ -225,7 +226,7 @@
 
     /**
      * Creates a new instance of BrowserViewUniversalListener.
-     * 
+     *
      * @param view the browser view
      */
     public BrowserViewUniversalListener( BrowserView view )
@@ -238,10 +239,10 @@
         connectionToSelectedElementMap = new HashMap<IConnection, ISelection>();
 
         // register listeners
-        EventRegistry.addSearchUpdateListener( this );
-        EventRegistry.addBookmarkUpdateListener( this );
-        EventRegistry.addEntryUpdateListener( this );
-        EventRegistry.addConnectionUpdateListener( this );
+        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         view.getSite().getPage().addPartListener( partListener );
         view.getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener( ConnectionView.getId(),
@@ -252,7 +253,7 @@
 
 
     /**
-     * Ensures that the entry editor or the search result editor are 
+     * Ensures that the entry editor or the search result editor are
      * opended and ready to show the given selection.
      *
      * @param selection the browser's selection.
@@ -391,8 +392,8 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * This implementation refreshes the tree and expands/collapses the 
+     *
+     * This implementation refreshes the tree and expands/collapses the
      * tree when the connection is opened/closed.
      */
     public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
@@ -402,7 +403,7 @@
             // expand viewer
             viewer.refresh( connectionUpdateEvent.getConnection() );
             viewer.expandToLevel( 2 );
-            
+
             // expand root DSE to show base entries
             IRootDSE rootDSE = connectionUpdateEvent.getConnection().getRootDSE();
             viewer.expandToLevel( rootDSE, 1 );
@@ -429,7 +430,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This viewer selects the updated search.
      */
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
@@ -460,14 +461,14 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * This implementation refreshes the tree and 
+     *
+     * This implementation refreshes the tree and
      * selects an entry depending on the event type.
      */
     public void entryUpdated( EntryModificationEvent event )
     {
         // Don't handle attribute initalization, could cause double
-        // retrieval of children. 
+        // retrieval of children.
         //
         // When double-clicking an entry two Jobs/Threads are started:
         // - InitializeAttributesJob and

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/modificationlogs/ModificationLogsViewUniversalListener.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.views.modificationlogs;
@@ -24,6 +24,7 @@
 import java.io.File;
 import java.io.FileReader;
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.core.events.AttributesInitializedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.ChildrenInitializedEvent;
@@ -58,7 +59,7 @@
     {
         /**
          * {@inheritDoc}
-         * 
+         *
          * This implementation sets the input when another connection was selected.
          */
         public void selectionChanged( IWorkbenchPart part, ISelection selection )
@@ -90,7 +91,7 @@
         this.view = view;
         this.input = null;
 
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
         view.getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener( ConnectionView.getId(),
             connectionSelectionListener );
     }
@@ -125,7 +126,7 @@
 
     /**
      * Sets the input.
-     * 
+     *
      * @param input the input
      */
     void setInput( ModificationLogsViewInput input )
@@ -165,7 +166,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * This implementation refreshes the input.
      */
     public void entryUpdated( EntryModificationEvent event )

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryAttributesWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryAttributesWizardPage.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryAttributesWizardPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryAttributesWizardPage.java Sun Apr 15 14:36:34 2007
@@ -6,21 +6,22 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.browser.ui.wizards;
 
 
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
 import org.apache.directory.ldapstudio.browser.common.widgets.entryeditor.EntryEditorWidget;
 import org.apache.directory.ldapstudio.browser.common.widgets.entryeditor.EntryEditorWidgetActionGroup;
 import org.apache.directory.ldapstudio.browser.common.widgets.entryeditor.EntryEditorWidgetActionGroupWithAttribute;
@@ -73,7 +74,7 @@
 
     /**
      * Creates a new instance of NewEntryAttributesWizardPage.
-     * 
+     *
      * @param pageName the page name
      * @param wizard the wizard
      */
@@ -112,8 +113,8 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * This implementation initializes the must attributes of the 
+     *
+     * This implementation initializes the must attributes of the
      * protoype entry and initializes the entry widget when this
      * page becomes visible.
      */
@@ -251,7 +252,7 @@
         // create the listener
         universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(), actionGroup
             .getOpenDefaultEditorAction() );
-        EventRegistry.addEntryUpdateListener( this );
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
 
         setControl( composite );
     }
@@ -271,7 +272,7 @@
 
     /**
      * Checks if is disposed.
-     * 
+     *
      * @return true, if is disposed
      */
     private boolean isDisposed()

Modified: directory/ldapstudio/trunk/ldapstudio-ldifeditor/src/main/java/org/apache/directory/ldapstudio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-ldifeditor/src/main/java/org/apache/directory/ldapstudio/ldifeditor/editor/LdifEditor.java?view=diff&rev=529075&r1=529074&r2=529075
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-ldifeditor/src/main/java/org/apache/directory/ldapstudio/ldifeditor/editor/LdifEditor.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-ldifeditor/src/main/java/org/apache/directory/ldapstudio/ldifeditor/editor/LdifEditor.java Sun Apr 15 14:36:34 2007
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.ldapstudio.ldifeditor.editor;
@@ -235,7 +235,7 @@
 
         super.init( site, input );
 
-        EventRegistry.addConnectionUpdateListener( this );
+        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
         getSite().getPage().addPartListener( this );
 
         this.valueEditorManager = new ValueEditorManager( getSite().getShell() );
@@ -611,7 +611,7 @@
 
     /**
      * This implementation checks if the input is of type
-     * NonExistingLdifEditorInput. In that case doSaveAs() is 
+     * NonExistingLdifEditorInput. In that case doSaveAs() is
      * called to prompt for a new file name and location.
      */
     public void doSave( IProgressMonitor progressMonitor )
@@ -632,16 +632,16 @@
      * - NonExistingLdifEditorInput: New file, not yet saved
      * - PathEditorInput: file opened with our internal "Open File.." action
      * - FileEditorInput: file is within workspace
-     * - JavaFileEditorInput: file opend with "Open File..." action from org.eclipse.ui.editor 
-     * 
+     * - JavaFileEditorInput: file opend with "Open File..." action from org.eclipse.ui.editor
+     *
      * In RCP the FileDialog appears.
      * In IDE the super implementation is called.
      * To detect if this plugin runs in IDE the org.eclipse.ui.ide extension point is checked.
-     * 
+     *
      */
     protected void performSaveAs( IProgressMonitor progressMonitor )
     {
-        // detect IDE or RCP: 
+        // detect IDE or RCP:
         // check if perspective org.eclipse.ui.resourcePerspective is available
         boolean isIDE = BrowserCommonActivator.isIDEEnvironment();
 



Mime
View raw message