diff -r 48531098cf7a projectuiapi/apichanges.xml --- a/projectuiapi/apichanges.xml Wed Jan 30 13:48:23 2008 +0000 +++ b/projectuiapi/apichanges.xml Wed Jan 30 14:58:40 2008 +0100 @@ -40,8 +40,8 @@ Version 2 license, then the option appli Version 2 license, then the option applies only if the new code is made subject to such option by the copyright holder. --> - - + + + + + + Added ways to track projects opening and closing + + + + + + Added a method to track progress of projects opening and closing. As the + opening of a project may take long time, and as there can be multiple + projects open at once, it may be necessary to be notified that the process + of open project list modification started or that it has + finished. + + + + diff -r 48531098cf7a projectuiapi/nbproject/project.properties --- a/projectuiapi/nbproject/project.properties Wed Jan 30 13:48:23 2008 +0000 +++ b/projectuiapi/nbproject/project.properties Wed Jan 30 14:58:40 2008 +0100 @@ -39,7 +39,7 @@ javac.compilerargs=-Xlint -Xlint:-serial javac.source=1.5 -spec.version.base=1.26.0 +spec.version.base=1.27.0 is.autoload=true javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml diff -r 48531098cf7a projectuiapi/src/org/netbeans/api/project/ui/OpenProjects.java --- a/projectuiapi/src/org/netbeans/api/project/ui/OpenProjects.java Wed Jan 30 13:48:23 2008 +0000 +++ b/projectuiapi/src/org/netbeans/api/project/ui/OpenProjects.java Wed Jan 30 14:58:40 2008 +0100 @@ -42,6 +42,7 @@ package org.netbeans.api.project.ui; package org.netbeans.api.project.ui; import java.beans.PropertyChangeListener; +import java.util.concurrent.Future; import org.netbeans.api.project.Project; import org.netbeans.modules.project.uiapi.OpenProjectsTrampoline; import org.netbeans.modules.project.uiapi.Utilities; @@ -111,6 +112,36 @@ public final class OpenProjects { */ public Project[] getOpenProjects() { return trampoline.getOpenProjectsAPI(); + } + + /** + * Method to track progress of projects opening and closing. As the + * opening of a project may take long time, and as there can be multiple + * projects open at once, it may be necessary to be notified that the process + * of open project list modification started or that it has + * finished. This method provides a future that can do that. + * To find out that the list of open projects is currently modified use: + *
+     * assert openProjects().isDone() == false;
+     * 
+ * To wait for the opening/closing to be finished and then obtain the result + * use: + *
+     * Project[] current = openProjects().get();
+     * 
+ * This result is different that a plain call to {@link #getOpenProjects} as + * that methods returns the current state, whatever it is. While the call through + * the future awaits for current modifications to finish. As such wait + * can take a long time one can also wait for just a limited amount of time. + * However this waiting methods should very likely only be used from dedicated threads, + * where the wait does not block other essencial operations (read: do not + * use such methods from AWT or other known threads!). + * + * @return future to track computation of open projects + * @since 1.27 + */ + public Future openProjects() { + return trampoline.openProjectsAPI(); } /** diff -r 48531098cf7a projectuiapi/src/org/netbeans/modules/project/uiapi/OpenProjectsTrampoline.java --- a/projectuiapi/src/org/netbeans/modules/project/uiapi/OpenProjectsTrampoline.java Wed Jan 30 13:48:23 2008 +0000 +++ b/projectuiapi/src/org/netbeans/modules/project/uiapi/OpenProjectsTrampoline.java Wed Jan 30 14:58:40 2008 +0100 @@ -42,6 +42,7 @@ package org.netbeans.modules.project.uia package org.netbeans.modules.project.uiapi; import java.beans.PropertyChangeListener; +import java.util.concurrent.Future; import org.netbeans.api.project.Project; /** @@ -58,6 +59,8 @@ public interface OpenProjectsTrampoline public void addPropertyChangeListenerAPI( PropertyChangeListener listener, Object source ); + public Future openProjectsAPI(); + public void removePropertyChangeListenerAPI( PropertyChangeListener listener ); public Project getMainProject();