directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r829069 - in /directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs: CopyEntriesJob.java DeleteEntriesJob.java
Date Fri, 23 Oct 2009 14:01:36 GMT
Author: seelmann
Date: Fri Oct 23 14:01:35 2009
New Revision: 829069

URL: http://svn.apache.org/viewvc?rev=829069&view=rev
Log:
Some optimizations in event firing

Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java?rev=829069&r1=829068&r2=829069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
Fri Oct 23 14:01:35 2009
@@ -49,7 +49,7 @@
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.jobs.EntryExistsCopyStrategyDialog.EntryExistsCopyStrategy;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -174,7 +174,10 @@
      */
     protected void runNotification()
     {
-        EventRegistry.fireEntryUpdated( new ChildrenInitializedEvent( parent ), this );
+        // don't fire an EntryCreatedEvent for each created entry
+        // that would cause massive UI updates
+        // instead we fire a BulkModificationEvent
+        EventRegistry.fireEntryUpdated( new BulkModificationEvent( parent.getBrowserConnection()
), this );
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=829069&r1=829068&r2=829069&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
Fri Oct 23 14:01:35 2009
@@ -44,7 +44,7 @@
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -78,9 +78,6 @@
     /** The deleted entries. */
     private Set<IEntry> deletedEntriesSet;
 
-    /** The entries to update. */
-    private Set<IEntry> entriesToUpdateSet;
-
     /** The searches to update. */
     private Set<ISearch> searchesToUpdateSet;
 
@@ -99,7 +96,6 @@
         this.useTreeDeleteControl = useTreeDeleteControl;
 
         this.deletedEntriesSet = new HashSet<IEntry>();
-        this.entriesToUpdateSet = new HashSet<IEntry>();
         this.searchesToUpdateSet = new HashSet<ISearch>();
 
         setName( entriesToDelete.size() == 1 ? BrowserCoreMessages.jobs__delete_entries_name_1
@@ -161,7 +157,6 @@
                     //entryToDelete.setChildrenInitialized( false );
 
                     // delete from parent entry
-                    entriesToUpdateSet.add( entryToDelete.getParententry() );
                     entryToDelete.getParententry().setChildrenInitialized( false );
                     entryToDelete.getParententry().deleteChild( entryToDelete );
 
@@ -197,7 +192,6 @@
             }
             else
             {
-                entriesToUpdateSet.add( entryToDelete );
                 entryToDelete.setChildrenInitialized( false );
             }
 
@@ -320,11 +314,10 @@
     {
         // don't fire an EntryDeletedEvent for each deleted entry
         // that would cause massive UI updates
-        // instead we fire a ChildrenInitializedEvent for each parent
-        for ( IEntry parent : entriesToUpdateSet )
-        {
-            EventRegistry.fireEntryUpdated( new ChildrenInitializedEvent( parent ), this
);
-        }
+        // instead we unset children information and fire a BulkModificationEvent
+        IBrowserConnection browserConnection = entriesToDelete.iterator().next().getBrowserConnection();
+        EventRegistry.fireEntryUpdated( new BulkModificationEvent( browserConnection ), this
);
+
         for ( ISearch search : searchesToUpdateSet )
         {
             EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search,



Mime
View raw message