fix actions which were broken by flawed refactoring

This commit is contained in:
jmillman 2016-05-20 16:16:39 -04:00
parent 981be75731
commit 4d018f45d5
2 changed files with 15 additions and 5 deletions

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.timeline; package org.sleuthkit.autopsy.timeline;
import java.beans.PropertyVetoException;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level; 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. //if there is only one event selected, make a explorer node for it and push it to the content viewer.
try { try {
EventNode eventNode = EventNode.createEventNode(selectedEventIDs.get(0), controller.getEventsModel()); 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) { } catch (IllegalStateException ex) {
//Since the case is closed, the user probably doesn't care about this, just log it as a precaution. //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 LOGGER.log(Level.SEVERE, "There was no case open to lookup the Sleuthkit object backing a SingleEvent.", ex); // NON-NLS

View File

@ -44,7 +44,7 @@ import javafx.util.Callback;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import org.controlsfx.control.Notifications; 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.NbBundle;
import org.openide.util.actions.Presenter; import org.openide.util.actions.Presenter;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -344,9 +344,7 @@ class ListTimeline extends BorderPane {
JMenuItem submenu = ((Presenter.Popup) action).getPopupPresenter(); JMenuItem submenu = ((Presenter.Popup) action).getPopupPresenter();
menuItems.add(SwingFXMenuUtils.createFXMenu(submenu)); menuItems.add(SwingFXMenuUtils.createFXMenu(submenu));
} else { } else {
//make a JavaFX menu item that invokes the action (wrapped in a ControlsFX Action menuItems.add(SwingFXMenuUtils.createFXMenu(new Actions.MenuItem(action, false)));
menuItems.add(ActionUtils.createMenuItem(
new org.controlsfx.control.action.Action(actionName, actionEvent -> action.actionPerformed(null))));
} }
} }
} }