directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r778231 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/ ldapbrowser-core...
Date Sun, 24 May 2009 20:54:43 GMT
Author: seelmann
Date: Sun May 24 20:54:42 2009
New Revision: 778231

URL: http://svn.apache.org/viewvc?rev=778231&view=rev
Log:
Fix for DIRSTUDIO-481 (refreshing of attributes and children):
o Reset the whole subtree including the attributes
o Collapse the subtree of the refreshed entry
o Simplyfied loading of Root DSE


Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FilterChildrenAction.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RefreshAction.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/UnfilterChildrenAction.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsRunnable.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/EntryPropertyPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FilterChildrenAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FilterChildrenAction.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FilterChildrenAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/FilterChildrenAction.java
Sun May 24 20:54:42 2009
@@ -73,7 +73,7 @@
                     getSelectedEntries()[0].setChildrenFilter( newFilter.trim() );
                 }
                 new StudioBrowserJob( new InitializeChildrenRunnable( new IEntry[]
-                    { getSelectedEntries()[0] } ) ).execute();
+                    { getSelectedEntries()[0] }, true ) ).execute();
 
             }
         }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RefreshAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RefreshAction.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RefreshAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/RefreshAction.java
Sun May 24 20:54:42 2009
@@ -23,19 +23,16 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeChildrenRunnable;
-import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeRootDSERunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -70,7 +67,7 @@
 
         if ( entries.size() > 0 && searches.length == 0 && entryInput
== null && searchInput == null )
         {
-            return Messages.getString( "RefreshAction.ReloadAttributesAndChildren" ); //$NON-NLS-1$
+            return entries.size() == 1 ? Messages.getString( "RefreshAction.ReloadEntry"
) : Messages.getString( "RefreshAction.ReloadEntries" ); //$NON-NLS-1$ //$NON-NLS-2$
         }
         else if ( searches.length > 0 && entries.size() == 0 && entryInput
== null && searchInput == null )
         {
@@ -137,25 +134,9 @@
 
         if ( entries.size() > 0 )
         {
-            boolean foa = entries.get( 0 ).getBrowserConnection().isFetchOperationalAttributes()
-                || entries.get( 0 ).isOperationalAttributesInitialized();
-
-            // avoid duplicate search on Root DSE
-            for ( Iterator<IEntry> it = entries.iterator(); it.hasNext(); )
-            {
-                IEntry entry = it.next();
-                if ( entry instanceof IRootDSE )
-                {
-                    new StudioBrowserJob( new InitializeRootDSERunnable( ( IRootDSE ) entry
) ).execute();
-                    it.remove();
-                }
-            }
-
-            InitializeAttributesRunnable initializeAttributesRunnable = new InitializeAttributesRunnable(
entries
-                .toArray( new IEntry[0] ), foa );
             InitializeChildrenRunnable initializeChildrenRunnable = new InitializeChildrenRunnable(
entries
-                .toArray( new IEntry[0] ) );
-            new StudioBrowserJob( initializeAttributesRunnable, initializeChildrenRunnable
).execute();
+                .toArray( new IEntry[0] ), true );
+            new StudioBrowserJob( initializeChildrenRunnable ).execute();
         }
         if ( searches.length > 0 )
         {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/UnfilterChildrenAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/UnfilterChildrenAction.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/UnfilterChildrenAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/UnfilterChildrenAction.java
Sun May 24 20:54:42 2009
@@ -55,7 +55,7 @@
         {
             getSelectedEntries()[0].setChildrenFilter( null );
             new StudioBrowserJob( new InitializeChildrenRunnable( new IEntry[]
-                { getSelectedEntries()[0] } ) ).execute();
+                { getSelectedEntries()[0] }, true ) ).execute();
         }
     }
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
Sun May 24 20:54:42 2009
@@ -74,7 +74,8 @@
 RefreshAction.PerformSearches=Perform Searches
 RefreshAction.Refresh=Refresh
 RefreshAction.RelaodAttributes=Reload Attributes
-RefreshAction.ReloadAttributesAndChildren=Reload Attributes and Children
+RefreshAction.ReloadEntry=Reload Entry
+RefreshAction.ReloadEntries=Reload Entries
 RefreshAction.SearchAgain=Search Again
 RenameAction.BookmarkWithThisNameAlreadyExists=A bookmark with this name already exists.
 RenameAction.ConnectionWithThisNameAlreadyExists=A connection with this name already exists.

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
Sun May 24 20:54:42 2009
@@ -74,7 +74,8 @@
 RefreshAction.PerformSearches=Suchen auf\u00FChren
 RefreshAction.Refresh=Aktualisieren
 RefreshAction.RelaodAttributes=Attribute neu laden
-RefreshAction.ReloadAttributesAndChildren=Attribute und Kind-Eintr\u00E4ge neu laden
+RefreshAction.ReloadEntry=Eintrag neu laden
+RefreshAction.ReloadEntries=Eintr\u00E4ge neu laden
 RefreshAction.SearchAgain=Erneut suchen
 RenameAction.BookmarkWithThisNameAlreadyExists=Ein Lesezeichen mit diesem Namen existiert
bereits.
 RenameAction.ConnectionWithThisNameAlreadyExists=Eine Verbindung mit diesem Namen existiert
bereits.

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
Sun May 24 20:54:42 2009
@@ -74,7 +74,8 @@
 RefreshAction.PerformSearches=Lancer les recherches
 RefreshAction.Refresh=Rafra\u00EEchir
 RefreshAction.RelaodAttributes=Recharger les attributs
-RefreshAction.ReloadAttributesAndChildren=Recharger les attributs et les fils
+RefreshAction.ReloadEntry=Recharger l'entr\u00E9e
+RefreshAction.ReloadEntries=Recharger les entr\u00E9es
 RefreshAction.SearchAgain=Rechercher \u00E0 nouveau
 RenameAction.BookmarkWithThisNameAlreadyExists=Un signet avec ce nom existe d\u00E9j\u00E0.
 RenameAction.ConnectionWithThisNameAlreadyExists=Une connexion avec ce nom existe d\u00E9j\u00E0.

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserContentProvider.java
Sun May 24 20:54:42 2009
@@ -311,7 +311,7 @@
             if ( !rootDSE.isChildrenInitialized() && rootDSE.isDirectoryEntry() )
             {
                 new StudioBrowserJob( new InitializeChildrenRunnable( new IEntry[]
-                    { rootDSE } ) ).execute();
+                    { rootDSE }, false ) ).execute();
                 return new String[]
                     { Messages.getString( "BrowserContentProvider.FetchingEntries" ) }; //$NON-NLS-1$
             }
@@ -339,7 +339,7 @@
             if ( !parentEntry.isChildrenInitialized() && parentEntry.isDirectoryEntry()
)
             {
                 new StudioBrowserJob( new InitializeChildrenRunnable( new IEntry[]
-                    { parentEntry } ) ).execute();
+                    { parentEntry }, false ) ).execute();
                 return new String[]
                     { Messages.getString( "BrowserContentProvider.FetchingEntries" ) }; //$NON-NLS-1$
             }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
Sun May 24 20:54:42 2009
@@ -28,6 +28,7 @@
 import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.core.events.AttributesInitializedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
@@ -244,7 +245,20 @@
             return;
         }
 
-        viewer.refresh( event.getModifiedEntry(), true );
+        if ( event instanceof ChildrenInitializedEvent )
+        {
+            boolean expandedState = viewer.getExpandedState( event.getModifiedEntry() );
+            viewer.collapseToLevel( event.getModifiedEntry(), TreeViewer.ALL_LEVELS );
+            if ( expandedState )
+            {
+                viewer.expandToLevel( event.getModifiedEntry(), 1 );
+            }
+            viewer.refresh( event.getModifiedEntry(), true );
+        }
+        else
+        {
+            viewer.refresh( event.getModifiedEntry(), true );
+        }
     }
 
 

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsRunnable.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsRunnable.java
Sun May 24 20:54:42 2009
@@ -26,7 +26,6 @@
 
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.jobs.StudioBulkRunnableWithProgress;
-import org.apache.directory.studio.connection.core.jobs.StudioConnectionJob;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -98,9 +97,7 @@
         monitor.reportProgress( " " ); //$NON-NLS-1$
         monitor.worked( 1 );
 
-        IRootDSE rootDSE = connection.getRootDSE();
-        InitializeRootDSERunnable runnable = new InitializeRootDSERunnable( rootDSE );
-        runnable.run( monitor );
+        InitializeRootDSERunnable.loadRootDSE( connection, monitor );
 
         IEntry[] baseDNEntries = connection.getRootDSE().getChildren();
         if ( baseDNEntries != null )

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
Sun May 24 20:54:42 2009
@@ -215,16 +215,7 @@
         if ( entry instanceof IRootDSE )
         {
             // special handling for Root DSE
-            InitializeRootDSERunnable runnable = new InitializeRootDSERunnable( ( IRootDSE
) entry );
-            StudioConnectionJob job = new StudioConnectionJob( runnable );
-            job.execute();
-            try
-            {
-                job.join();
-            }
-            catch ( InterruptedException e )
-            {
-            }
+            InitializeRootDSERunnable.loadRootDSE( entry.getBrowserConnection(), monitor
);
         }
         else
         {

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
Sun May 24 20:54:42 2009
@@ -29,7 +29,6 @@
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
 import org.apache.directory.studio.connection.core.jobs.StudioBulkRunnableWithProgress;
-import org.apache.directory.studio.connection.core.jobs.StudioConnectionJob;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -60,6 +59,9 @@
     /** The entries. */
     private IEntry[] entries;
 
+    /** The purge all caches flag. */
+    boolean purgeAllCaches;
+
     /** The paged search control, only used internally. */
     private StudioControl pagedSearchControl;
 
@@ -68,10 +70,12 @@
      * Creates a new instance of InitializeChildrenRunnable.
      * 
      * @param entries the entries
+     * @param purgeAllCaches true to purge all caches
      */
-    public InitializeChildrenRunnable( IEntry[] entries )
+    public InitializeChildrenRunnable( IEntry[] entries, boolean purgeAllCaches )
     {
         this.entries = entries;
+        this.purgeAllCaches = purgeAllCaches;
     }
 
 
@@ -153,16 +157,7 @@
                 if ( entry instanceof IRootDSE )
                 {
                     // special handling for Root DSE
-                    InitializeRootDSERunnable runnable = new InitializeRootDSERunnable( (
IRootDSE ) entry );
-                    StudioConnectionJob job = new StudioConnectionJob( runnable );
-                    job.execute();
-                    try
-                    {
-                        job.join();
-                    }
-                    catch ( InterruptedException e )
-                    {
-                    }
+                    InitializeRootDSERunnable.loadRootDSE( browserConnection, monitor );
                     continue;
                 }
 
@@ -200,7 +195,7 @@
      * @param monitor the progress monitor
      * @param pagedSearchControl the paged search control
      */
-    private static void initializeChildren( IEntry parent, StudioProgressMonitor monitor,
+    private void initializeChildren( IEntry parent, StudioProgressMonitor monitor,
         StudioControl pagedSearchControl )
     {
         monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_sub,
@@ -208,7 +203,7 @@
                 { parent.getDn().getUpName() } ) );
 
         // clear old children
-        clearParent( parent );
+        clearCaches( parent, purgeAllCaches );
 
         // create search
         ISearch search = createSearch( parent, pagedSearchControl, false );
@@ -221,7 +216,7 @@
         {
             // clearing old children before filling new children is
             // necessary to handle aliases and referrals.
-            clearParent( parent );
+            clearCaches( parent, false );
 
             do
             {
@@ -382,19 +377,34 @@
     }
 
 
-    private static void clearParent( IEntry parent )
+    static void clearCaches( IEntry entry, boolean purgeAllCaches )
     {
-        IEntry[] oldChildren = parent.getChildren();
-        for ( int i = 0; oldChildren != null && i < oldChildren.length; i++ )
+        // clear the parent-child relationship, recursively
+        IEntry[] children = entry.getChildren();
+        if ( children != null )
         {
-            if ( oldChildren[i] != null )
+            for ( IEntry child : children )
             {
-                parent.deleteChild( oldChildren[i] );
+                if ( child != null )
+                {
+                    entry.deleteChild( child );
+                    clearCaches( child, purgeAllCaches );
+                }
             }
         }
-        parent.setChildrenInitialized( false );
-        parent.setTopPageChildrenRunnable( null );
-        parent.setNextPageChildrenRunnable( null );
+        entry.setChildrenInitialized( false );
+
+        // reset paging runnables
+        entry.setTopPageChildrenRunnable( null );
+        entry.setNextPageChildrenRunnable( null );
+
+        // reset attributes and additional flags
+        if ( purgeAllCaches )
+        {
+            entry.setAttributesInitialized( false );
+            entry.setHasChildrenHint( true );
+            entry.setHasMoreChildren( false );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
Sun May 24 20:54:42 2009
@@ -77,7 +77,7 @@
      * 
      * @param rootDSE the root DSE
      */
-    public InitializeRootDSERunnable( IRootDSE rootDSE )
+    private InitializeRootDSERunnable( IRootDSE rootDSE )
     {
         this.rootDSE = rootDSE;
     }
@@ -158,21 +158,10 @@
      * 
      * @throws Exception the exception
      */
-    private static synchronized void loadRootDSE( IBrowserConnection browserConnection, StudioProgressMonitor
monitor )
+    public static synchronized void loadRootDSE( IBrowserConnection browserConnection, StudioProgressMonitor
monitor )
     {
-        // delete old children
-        IEntry[] oldChildren = browserConnection.getRootDSE().getChildren();
-        if ( oldChildren != null )
-        {
-            for ( IEntry entry : oldChildren )
-            {
-                if ( entry != null )
-                {
-                    browserConnection.getRootDSE().deleteChild( entry );
-                }
-            }
-        }
-        browserConnection.getRootDSE().setChildrenInitialized( false );
+        // clear old children
+        InitializeChildrenRunnable.clearCaches( browserConnection.getRootDSE(), true );
 
         // delete old attributes
         IAttribute[] oldAttributes = browserConnection.getRootDSE().getAttributes();
@@ -231,7 +220,8 @@
             {
                 for ( String namingContext : namingContextSet )
                 {
-                    if ( !"".equals( namingContext ) ) { //$NON-NLS-1$
+                    if ( !"".equals( namingContext ) ) //$NON-NLS-1$
+                    {
                         try
                         {
                             LdapDN dn = new LdapDN( namingContext );

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
Sun May 24 20:54:42 2009
@@ -137,7 +137,10 @@
 
         if ( ci != null )
         {
-            ci.childrenSet.remove( childToDelete );
+            if ( ci.childrenSet != null )
+            {
+                ci.childrenSet.remove( childToDelete );
+            }
             if ( ci.childrenSet == null || ci.childrenSet.isEmpty() )
             {
                 getBrowserConnectionImpl().setChildrenInfo( this, null );
@@ -846,12 +849,16 @@
     public Collection<ObjectClassDescription> getObjectClassDescriptions()
     {
         Collection<ObjectClassDescription> ocds = new ArrayList<ObjectClassDescription>();
-        String[] ocNames = getAttribute( SchemaConstants.OBJECT_CLASS_AT ).getStringValues();
-        Schema schema = getBrowserConnection().getSchema();
-        for ( String ocName : ocNames )
+        IAttribute ocAttribute = getAttribute( SchemaConstants.OBJECT_CLASS_AT );
+        if ( ocAttribute != null )
         {
-            ObjectClassDescription ocd = schema.getObjectClassDescription( ocName );
-            ocds.add( ocd );
+            String[] ocNames = getAttribute( SchemaConstants.OBJECT_CLASS_AT ).getStringValues();
+            Schema schema = getBrowserConnection().getSchema();
+            for ( String ocName : ocNames )
+            {
+                ObjectClassDescription ocd = schema.getObjectClassDescription( ocName );
+                ocds.add( ocd );
+            }
         }
         return ocds;
     }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/EntryPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/EntryPropertyPage.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/EntryPropertyPage.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/EntryPropertyPage.java
Sun May 24 20:54:42 2009
@@ -258,7 +258,7 @@
     {
         IEntry entry = EntryPropertyPage.getEntry( getElement() );
         InitializeChildrenRunnable runnable1 = new InitializeChildrenRunnable( new IEntry[]
-            { entry } );
+            { entry }, false );
         InitializeAttributesRunnable runnable2 = new InitializeAttributesRunnable( new IEntry[]
             { entry }, true );
         RunnableContextRunner.execute( runnable1, null, true );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java?rev=778231&r1=778230&r2=778231&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
Sun May 24 20:54:42 2009
@@ -36,6 +36,7 @@
 import org.apache.directory.studio.ldapbrowser.core.events.BookmarkUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.BookmarkUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryAddedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryDeletedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
@@ -60,6 +61,7 @@
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.INullSelectionListener;
 import org.eclipse.ui.IPartListener2;
 import org.eclipse.ui.IWorkbenchPart;
@@ -530,6 +532,16 @@
         {
             viewer.refresh();
         }
+        else if ( event instanceof ChildrenInitializedEvent )
+        {
+            boolean expandedState = viewer.getExpandedState( event.getModifiedEntry() );
+            viewer.collapseToLevel( event.getModifiedEntry(), TreeViewer.ALL_LEVELS );
+            if ( expandedState )
+            {
+                viewer.expandToLevel( event.getModifiedEntry(), 1 );
+            }
+            viewer.refresh( event.getModifiedEntry(), true );
+        }
         else
         {
             viewer.refresh( event.getModifiedEntry(), true );



Mime
View raw message