[hg] main-silver: Issue #244868 - EDT violation on creating new ...

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: Issue #244868 - EDT violation on creating new ...
  • Date: Mon, 09 Jun 2014 11:57:52 +0000

changeset 969e5f33e9aa in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/969e5f33e9aa
description:
        Issue #244868 - EDT violation on creating new Task

diffstat:

 
bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueTopComponent.java
 |  52 ++++++---
 1 files changed, 34 insertions(+), 18 deletions(-)

diffs (104 lines):

diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueTopComponent.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueTopComponent.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueTopComponent.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/ui/issue/IssueTopComponent.java
@@ -229,8 +229,8 @@
         assert (this.issue == null);
         this.issue = issue;
         instanceContent.add(issue.getIssue());
-        preparingLabel.setVisible(false);
-        issuePanel.add(issue.getController().getComponent(), 
BorderLayout.CENTER);
+        setVisible(preparingLabel, false);
+        issuePanelAdd(issue.getController().getComponent(), 
BorderLayout.CENTER);
         
         if(isOpened()) {
             // #opened() did not fire beacuse of null issue -> fire 
afterwards
@@ -238,7 +238,7 @@
         }
         ((DelegatingUndoRedoManager)getUndoRedo()).init();
         
-        repoPanel.setVisible(false);
+        setVisible(repoPanel, false);
         setNameAndTooltip();
         registerListeners();
         
@@ -385,14 +385,14 @@
             public void run() {
                 try {
                     handle.start();
-                    preparingLabel.setVisible(true);
+                    setVisible(preparingLabel, true);
                     RepositoryImpl repo = getRepository();
                     if (repo == null) {
                         return;
                     }
                     if(issue != null) {
                         if(controller != null) {
-                            issuePanel.remove(controller.getComponent());
+                            issuePanelRemove(controller.getComponent());
                             controller.closed();
                         }
                         unregisterListeners();
@@ -428,12 +428,7 @@
                         }
                     });
                 } finally {
-                    SwingUtilities.invokeLater(new Runnable() {
-                        @Override
-                        public void run() {
-                            preparingLabel.setVisible(false);
-                        }
-                    });
+                    setVisible(preparingLabel, false);
                     handle.finish();
                     prepareTask = null;
                 }
@@ -441,6 +436,33 @@
         });
     }
 
+    private void issuePanelRemove(final JComponent cmp) {
+        UIUtils.runInAWT(new Runnable() {
+            @Override
+            public void run() {
+                issuePanel.remove(cmp);
+            }
+        });
+    }
+    
+    private void issuePanelAdd(final JComponent cmp, final String layout) {
+        UIUtils.runInAWT(new Runnable() {
+            @Override
+            public void run() {
+                issuePanel.add(cmp, layout);
+            }
+        });
+    }
+
+    private void setVisible(final JComponent cmp, final boolean visible) {
+        UIUtils.runInAWT(new Runnable() {
+            @Override
+            public void run() {
+                cmp.setVisible(visible);
+            }
+        });
+    }
+    
     private void unregisterListeners() {
         issue.removePropertyChangeListener(this);
         getController().removePropertyChangeListener(this);
@@ -634,14 +656,8 @@
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
         if(evt.getPropertyName().equals(IssueImpl.EVENT_ISSUE_DATA_CHANGED)) 
{
-            UIUtils.runInAWT(new Runnable() {
-                @Override
-                public void run() {
-                    repoPanel.setVisible(false);
+            setVisible(repoPanel, false);
                     setNameAndTooltip();
-                }
-            });
-            
         } else 
if(evt.getPropertyName().equals(RepositoryRegistry.EVENT_REPOSITORIES_CHANGED))
 {
             if(!repositoryComboBox.isEnabled()) {
                 // well, looks like there shuold be only one repository 
available

[hg] main-silver: Issue #244868 - EDT violation on creating new ...

Tomas Stupka 06/09/2014

Project Features

About this Project

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