From 4d018f45d5f1cf350eba01f3f45d0ac43e88d093 Mon Sep 17 00:00:00 2001 From: jmillman Date: Fri, 20 May 2016 16:16:39 -0400 Subject: [PATCH] fix actions which were broken by flawed refactoring --- .../autopsy/timeline/TimeLineTopComponent.java | 14 +++++++++++++- .../autopsy/timeline/ui/listvew/ListTimeline.java | 6 ++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java index 1b0032d290..4d1802bcd5 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/TimeLineTopComponent.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.timeline; +import java.beans.PropertyVetoException; import java.util.Collections; import java.util.List; import java.util.logging.Level; @@ -104,7 +105,18 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer //if there is only one event selected, make a explorer node for it and push it to the content viewer. try { EventNode eventNode = EventNode.createEventNode(selectedEventIDs.get(0), controller.getEventsModel()); - SwingUtilities.invokeLater(() -> contentViewerPanel.setNode(eventNode)); + SwingUtilities.invokeLater(() -> { + //set node as selected for actions + em.setRootContext(eventNode); + try { + em.setSelectedNodes(new Node[]{eventNode}); + } catch (PropertyVetoException ex) { + //I don't know why this would ever happen. + LOGGER.log(Level.SEVERE, "Selecting the event node was vetoed.", ex); // NON-NLS + } + //push into content viewer. + contentViewerPanel.setNode(eventNode); + }); } catch (IllegalStateException ex) { //Since the case is closed, the user probably doesn't care about this, just log it as a precaution. LOGGER.log(Level.SEVERE, "There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex); // NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java index 6cd573d478..77fc831b29 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/ListTimeline.java @@ -44,7 +44,7 @@ import javafx.util.Callback; import javax.swing.Action; import javax.swing.JMenuItem; import org.controlsfx.control.Notifications; -import org.controlsfx.control.action.ActionUtils; +import org.openide.awt.Actions; import org.openide.util.NbBundle; import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.coreutils.Logger; @@ -344,9 +344,7 @@ class ListTimeline extends BorderPane { JMenuItem submenu = ((Presenter.Popup) action).getPopupPresenter(); menuItems.add(SwingFXMenuUtils.createFXMenu(submenu)); } else { - //make a JavaFX menu item that invokes the action (wrapped in a ControlsFX Action - menuItems.add(ActionUtils.createMenuItem( - new org.controlsfx.control.action.Action(actionName, actionEvent -> action.actionPerformed(null)))); + menuItems.add(SwingFXMenuUtils.createFXMenu(new Actions.MenuItem(action, false))); } } }