directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r898857 - in /directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors: EntryEditorManager.java EntryEditorUtils.java
Date Wed, 13 Jan 2010 17:47:31 GMT
Author: pamarcelot
Date: Wed Jan 13 17:47:30 2010
New Revision: 898857

URL: http://svn.apache.org/viewvc?rev=898857&view=rev
Log:
Fix for DIRSTUDIO-616 (Entry Editor Manager does not ensure that the entry's attributes are
initialized (loaded) before testing and opening editors).

Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=898857&r1=898856&r2=898857&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
Wed Jan 13 17:47:30 2010
@@ -47,6 +47,7 @@
 import org.apache.directory.studio.ldapbrowser.core.events.ValueModifiedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueMultiModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueRenamedEvent;
+import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
 import org.apache.directory.studio.ldapbrowser.core.jobs.UpdateEntryRunnable;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
@@ -756,12 +757,32 @@
             entry = null;
         }
 
-        if ( entry != null && entry instanceof IContinuation )
+        if ( entry != null )
         {
-            IContinuation continuation = ( IContinuation ) entry;
-            if ( continuation.getState() == State.UNRESOLVED )
+            if ( entry instanceof IContinuation )
             {
-                continuation.resolve();
+                IContinuation continuation = ( IContinuation ) entry;
+                if ( continuation.getState() == State.UNRESOLVED )
+                {
+                    continuation.resolve();
+                }
+            }
+            else
+            {
+                try
+                {
+                    // Making sure attributes are initialized
+                    StudioBrowserJob job = EntryEditorUtils.ensureAttributesInitialized(
entry );
+                    if ( job != null )
+                    {
+                        // Waiting for the entry's attributes to be initialized
+                        job.join();
+                    }
+                }
+                catch ( InterruptedException e )
+                {
+                    // Nothing to do
+                }
             }
         }
 
@@ -807,6 +828,24 @@
             entry = bookmarks[0].getEntry();
         }
 
+        if ( entry != null )
+        {
+            try
+            {
+                // Making sure attributes are initialized
+                StudioBrowserJob job = EntryEditorUtils.ensureAttributesInitialized( entry
);
+                if ( job != null )
+                {
+                    // Waiting for the entry's attributes to be initialized
+                    job.join();
+                }
+            }
+            catch ( InterruptedException e )
+            {
+                // Nothing to do
+            }
+        }
+
         // Looking for the correct entry editor
         for ( EntryEditorExtension entryEditor : getSortedEntryEditorExtensions() )
         {

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java?rev=898857&r1=898856&r2=898857&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java
Wed Jan 13 17:47:30 2010
@@ -34,18 +34,24 @@
 
     /**
      * Checks if the attributes of the given entry are initialized and 
-     * initializes them in necessary.
+     * initializes them if necessary.
      * 
      * @param entry the entry
+     * @return
+     *      the job associated with the attributes initialization, 
+     *      or <code>null</code> if the attributes were already initialized
      */
-    public static void ensureAttributesInitialized( IEntry entry )
+    public static StudioBrowserJob ensureAttributesInitialized( IEntry entry )
     {
         if ( !entry.isAttributesInitialized() )
         {
             InitializeAttributesRunnable runnable = new InitializeAttributesRunnable( entry
);
             StudioBrowserJob job = new StudioBrowserJob( runnable );
             job.execute();
+            return job;
         }
+        
+        return null;
     }
 
 



Mime
View raw message