[hg] main-silver: Issue #233958 - AssertionError at org.netbeans...

  • From: Jan Peska < >
  • To:
  • Subject: [hg] main-silver: Issue #233958 - AssertionError at org.netbeans...
  • Date: Thu, 08 Aug 2013 12:53:39 -0700

changeset 30851fcdb314 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/30851fcdb314
description:
        Issue #233958 - AssertionError at 
org.netbeans.modules.bugtracking.cache.IssueCache.setSeen
        Don't call IssueImpl.setSeen in AWT, add a progress to the marking 
process

diffstat:

 bugtracking/src/org/netbeans/modules/bugtracking/tasks/DashboardUtils.java   
    |   7 +-
 bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Actions.java  
    |  37 ++++++++-
 
bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Bundle.properties
 |   5 +
 3 files changed, 39 insertions(+), 10 deletions(-)

diffs (124 lines):

diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/DashboardUtils.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/DashboardUtils.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/DashboardUtils.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/DashboardUtils.java
@@ -53,6 +53,7 @@
 import java.util.Map.Entry;
 import javax.swing.JButton;
 import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import org.netbeans.modules.bugtracking.IssueImpl;
@@ -320,10 +321,4 @@
         }
         return null;
     }
-
-    public static void setAsSeen(boolean seen, List<IssueImpl> tasks) {
-        for (IssueImpl task : tasks) {
-            task.setSeen(seen);
         }
-    }
-}
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Actions.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Actions.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Actions.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Actions.java
@@ -46,7 +46,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.MissingResourceException;
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.KeyStroke;
@@ -81,6 +80,8 @@
     public static final KeyStroke REFRESH_KEY = 
KeyStroke.getKeyStroke("F5"); //NOI18N
     public static final KeyStroke DELETE_KEY = 
KeyStroke.getKeyStroke("DELETE"); //NOI18N
 
+    private static final RequestProcessor RP = new 
RequestProcessor(Actions.class.getName(), 10);
+
     public static List<Action> getDefaultActions(TreeListNode... nodes) {
         List<Action> actions = new ArrayList<Action>();
 
@@ -131,6 +132,7 @@
 
         private final boolean setAsSeen;
         private final List<IssueImpl> tasks;
+        private boolean canceled = false;
 
         private MarkSeenAction(boolean setAsSeen, List<IssueImpl> tasks) {
             super(setAsSeen ? NbBundle.getMessage(Actions.class, 
"CTL_MarkSeen") : NbBundle.getMessage(Actions.class, "CTL_MarkUnseen"));
@@ -140,7 +142,24 @@
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            DashboardUtils.setAsSeen(setAsSeen, tasks);
+            RP.post(new Runnable() {
+                @Override
+                public void run() {
+                    ProgressHandle markProgress = getProgress();
+                    markProgress.start(tasks.size());
+                    int workunits = 0;
+                    for (IssueImpl task : tasks) {
+                        if (canceled) {
+                            break;
+                        }
+                        
markProgress.progress(NbBundle.getMessage(Actions.class, 
"LBL_MarkTaskProgress", task.getDisplayName()));
+                        task.setSeen(setAsSeen);
+                        workunits++;
+                        markProgress.progress(workunits);
+                    }
+                    markProgress.finish();
+                }
+            });
         }
 
         static MarkSeenAction createAction(TreeListNode... nodes) {
@@ -160,6 +179,16 @@
             }
             return new MarkSeenAction(setAsSeen, tasks);
         }
+
+        private ProgressHandle getProgress() {
+            return 
ProgressHandleFactory.createHandle(NbBundle.getMessage(Actions.class, 
setAsSeen ? "LBL_MarkSeenAllProgress" : "LBL_MarkUnseenAllProgress"), new 
Cancellable() {
+                @Override
+                public boolean cancel() {
+                    canceled = true;
+                    return canceled;
+                }
+            });
+        }
     }
     //</editor-fold>
 
@@ -185,7 +214,7 @@
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            RequestProcessor.getDefault().post(new Runnable() {
+            RP.post(new Runnable() {
                 @Override
                 public void run() {
                     Map<String, IssueImpl> tasksMap = new HashMap<String, 
IssueImpl>();
@@ -661,7 +690,7 @@
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            RequestProcessor.getDefault().post(new Runnable() {
+            RP.post(new Runnable() {
                 @Override
                 public void run() {
                     
DashboardViewer.getInstance().deleteQuery(getQueryNodes());
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Bundle.properties
 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Bundle.properties
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Bundle.properties
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/tasks/actions/Bundle.properties
@@ -65,4 +65,9 @@
 #Placeholder is to be replaced by task title - name of the task
 LBL_SubmitTaskProgress=Submitting {0}
 
+LBL_MarkSeenAllProgress=Mark tasks as seen
+LBL_MarkUnseenAllProgress=Mark tasks as unseen
+#Placeholder is to be replaced by task title - name of the task
+LBL_MarkTaskProgress=Marking {0}
+
 LBL_DummyAction=Sorry, not implemented yet.

[hg] main-silver: Issue #233958 - AssertionError at org.netbeans...

Jan Peska 08/08/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