Another attempt at fixing the thread issue

This commit is contained in:
Kelly Kelly 2019-05-23 12:23:59 -04:00
parent f6ebad6944
commit 5669681df7
3 changed files with 14 additions and 17 deletions

View File

@ -118,16 +118,12 @@ public final class ContactsViewer extends JPanel implements RelationshipsViewer{
outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(new NodeAdapter(){ outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(new NodeAdapter(){
@Override @Override
public void childrenAdded(NodeMemberEvent nme) { public void childrenAdded(NodeMemberEvent nme) {
SwingUtilities.invokeLater(() -> { updateOutlineViewPanel();
updateOutlineViewPanel();
});
} }
@Override @Override
public void childrenRemoved(NodeMemberEvent nme) { public void childrenRemoved(NodeMemberEvent nme) {
updateOutlineViewPanel(); SwingUtilities.invokeLater(() -> { updateOutlineViewPanel();
updateOutlineViewPanel();
});
} }
}); });
} }

View File

@ -130,16 +130,12 @@ public final class MessagesViewer extends JPanel implements RelationshipsViewer
outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(new NodeAdapter() { outlineViewPanel.getExplorerManager().getRootContext().addNodeListener(new NodeAdapter() {
@Override @Override
public void childrenAdded(NodeMemberEvent nme) { public void childrenAdded(NodeMemberEvent nme) {
SwingUtilities.invokeLater(() -> { updateOutlineViewPanel();
updateOutlineViewPanel();
});
} }
@Override @Override
public void childrenRemoved(NodeMemberEvent nme) { public void childrenRemoved(NodeMemberEvent nme) {
SwingUtilities.invokeLater(() -> { updateOutlineViewPanel();
updateOutlineViewPanel();
});
} }
}); });
} }

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.communications.relationships; package org.sleuthkit.autopsy.communications.relationships;
import java.awt.CardLayout; import java.awt.CardLayout;
import javax.swing.SwingUtilities;
import org.openide.explorer.ExplorerManager; import org.openide.explorer.ExplorerManager;
import static org.openide.explorer.ExplorerUtils.createLookup; import static org.openide.explorer.ExplorerUtils.createLookup;
import org.openide.explorer.view.OutlineView; import org.openide.explorer.view.OutlineView;
@ -62,17 +63,21 @@ public class OutlineViewPanel extends javax.swing.JPanel implements ExplorerMana
* @param message String message to show on the panel. * @param message String message to show on the panel.
*/ */
public void hideOutlineView(String message) { public void hideOutlineView(String message) {
CardLayout layout = (CardLayout)this.getLayout(); SwingUtilities.invokeLater(() -> {
layout.show(this, "messageCard"); //NON-NLS CardLayout layout = (CardLayout)this.getLayout();
messageLabel.setText(message); layout.show(this, "messageCard"); //NON-NLS
messageLabel.setText(message);
});
} }
/** /**
* Hides the message panel and shows the OutlineView. * Hides the message panel and shows the OutlineView.
*/ */
public void showOutlineView() { public void showOutlineView() {
CardLayout layout = (CardLayout)this.getLayout(); SwingUtilities.invokeLater(() -> {
layout.show(this, "outlineCard"); //NON-NLS CardLayout layout = (CardLayout)this.getLayout();
layout.show(this, "outlineCard"); //NON-NLS
});
} }
/** /**