[hg] main-silver: block tasks dashboard initialization/refresh u...

  • From: Tomas Stupka < >
  • To: ,
  • Subject: [hg] main-silver: block tasks dashboard initialization/refresh u...
  • Date: Fri, 03 May 2013 03:47:53 -0700

changeset 980700856e4f in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/980700856e4f
description:
        block tasks dashboard initialization/refresh until projects are being 
opened

diffstat:

 
bugtracking.bridge/src/org/netbeans/modules/bugtracking/bridge/ideservices/ProjectServicesImpl.java
 |   8 +++
 
bugtracking/src/org/netbeans/modules/bugtracking/ide/spi/ProjectServices.java 
                      |  12 +++++
 
bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/DashboardViewer.java
               |  21 +++++++++-
 3 files changed, 39 insertions(+), 2 deletions(-)

diffs (111 lines):

diff --git 
a/bugtracking.bridge/src/org/netbeans/modules/bugtracking/bridge/ideservices/ProjectServicesImpl.java
 
b/bugtracking.bridge/src/org/netbeans/modules/bugtracking/bridge/ideservices/ProjectServicesImpl.java
--- 
a/bugtracking.bridge/src/org/netbeans/modules/bugtracking/bridge/ideservices/ProjectServicesImpl.java
+++ 
b/bugtracking.bridge/src/org/netbeans/modules/bugtracking/bridge/ideservices/ProjectServicesImpl.java
@@ -45,6 +45,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.concurrent.Callable;
 import org.netbeans.api.project.FileOwnerQuery;
 import org.netbeans.api.project.Project;
 import org.netbeans.api.project.ui.OpenProjects;
@@ -100,4 +101,11 @@
         return ret.toArray(new FileObject[ret.size()]);
     }
     
+    @Override
+    public <T> T runWhenNotBlocked(Callable<T> operation) throws Exception {
+        // w8 with loading to preject ot be opened
+        OpenProjects.getDefault().getOpenProjects();
+        return operation.call();
 }
+    
+}
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/ide/spi/ProjectServices.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/ide/spi/ProjectServices.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/ide/spi/ProjectServices.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/ide/spi/ProjectServices.java
@@ -42,6 +42,7 @@
 
 package org.netbeans.modules.bugtracking.ide.spi;
 
+import java.util.concurrent.Callable;
 import org.openide.filesystems.FileObject;
 import org.openide.util.Lookup;
 
@@ -50,6 +51,17 @@
  * @author Tomas Stupka
  */
 public interface ProjectServices {
+    
+    /**
+     * 
+     * 
+     * @param <T>
+     * @param operation
+     * @return
+     * @throws Exception 
+     */
+    public <T> T runWhenNotBlocked(final Callable<T> operation) throws 
Exception;
+    
     /**
      * Return the currently open projects
      * @return the currently open projects
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/DashboardViewer.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/DashboardViewer.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/DashboardViewer.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/DashboardViewer.java
@@ -47,6 +47,7 @@
 import java.beans.PropertyChangeListener;
 import java.util.*;
 import java.util.Map.Entry;
+import java.util.concurrent.Callable;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.accessibility.AccessibleContext;
@@ -56,6 +57,7 @@
 import org.netbeans.modules.bugtracking.api.Issue;
 import org.netbeans.modules.bugtracking.api.Repository;
 import org.netbeans.modules.bugtracking.api.RepositoryManager;
+import org.netbeans.modules.bugtracking.ide.spi.ProjectServices;
 import org.netbeans.modules.team.ui.util.treelist.LinkButton;
 import org.netbeans.modules.bugtracking.tasks.actions.Actions;
 import 
org.netbeans.modules.bugtracking.tasks.actions.Actions.CreateCategoryAction;
@@ -77,6 +79,7 @@
 import org.netbeans.modules.team.ui.util.treelist.TreeListNode;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
+import org.openide.util.Exceptions;
 import org.openide.util.ImageUtilities;
 import org.openide.util.NbBundle;
 import org.openide.util.RequestProcessor;
@@ -789,8 +792,9 @@
             public void run() {
                 // w8 with loading to preject ot be opened
                 //TODO add w8 for open project method to the bugtracking 
manager a ProjectServices
-                
BugtrackingManager.getInstance().getProjectServices().getOpenProjectsDirectories();
-
+                Callable<Void> c = new Callable<Void>() {
+                    @Override
+                    public Void call() throws Exception {
                 titleRepositoryNode.setProgressVisible(true);
                 titleCategoryNode.setProgressVisible(true);
                 loadRepositories();
@@ -798,6 +802,19 @@
                 loadCategories();
                 titleCategoryNode.setProgressVisible(false);
                 DashboardRefresher.getInstance().setupDashboardRefresh();
+                        return null;
+                    }
+                };
+                ProjectServices projectServices = 
BugtrackingManager.getInstance().getProjectServices();
+                try {
+                    if(projectServices != null) {
+                        projectServices.runWhenNotBlocked(c);
+                    } else {
+                        c.call();
+                    }
+                } catch (Exception ex) {
+                    BugtrackingManager.LOG.log(Level.WARNING, null, ex);
+                }
             }
         });
     }

[hg] main-silver: block tasks dashboard initialization/refresh u...

Tomas Stupka 05/03/2013

Project Features

About this Project

ConnectedDeveloper was started in November 2009, is owned by tpavek, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close