From a29db0a501e3e20d56e1dfcaa66efebc25335716 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 29 Apr 2015 14:18:21 -0400 Subject: [PATCH] Make sure property change handlers dispatch to EDT --- .../DirectoryTreeTopComponent.java | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java index d66cc06823..e63cfc76a2 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.java @@ -544,29 +544,49 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat // data model objects when a case is closed. if (oldValue != null && newValue == null) { // The current case has been closed. Reset the ExplorerManager. - Node emptyNode = new AbstractNode(Children.LEAF); - em.setRootContext(emptyNode); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Node emptyNode = new AbstractNode(Children.LEAF); + em.setRootContext(emptyNode); + } + }); } else if (newValue != null) { // A new case has been opened. Reset the ExplorerManager. Case newCase = (Case) newValue; - String newCaseName = newCase.getName(); - em.getRootContext().setName(newCaseName); - em.getRootContext().setDisplayName(newCaseName); + final String newCaseName = newCase.getName(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + em.getRootContext().setName(newCaseName); + em.getRootContext().setDisplayName(newCaseName); - // Reset the forward and back - // buttons. Note that a call to CoreComponentControl.openCoreWindows() - // by the new Case object will lead to a componentOpened() call - // that will repopulate the tree. - // @@@ The repopulation of the tree in this fashion also merits - // reconsideration. - resetHistory(); + // Reset the forward and back + // buttons. Note that a call to CoreComponentControl.openCoreWindows() + // by the new Case object will lead to a componentOpened() call + // that will repopulate the tree. + // @@@ The repopulation of the tree in this fashion also merits + // reconsideration. + resetHistory(); + } + }); } } // if the image is added to the case else if (changed.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { - componentOpened(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + componentOpened(); + } + }); } // change in node selection else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) { - respondSelection((Node[]) oldValue, (Node[]) newValue); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + respondSelection((Node[]) oldValue, (Node[]) newValue); + } + }); } else if (changed.equals(IngestManager.IngestModuleEvent.DATA_ADDED.toString())) { // nothing to do here. // all nodes should be listening for these events and update accordingly.