Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ExternalViewerShortcutAction.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2019 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.directorytree;
20
21import java.awt.event.ActionEvent;
22import java.awt.event.InputEvent;
23import java.awt.event.KeyEvent;
24import java.util.Collection;
25import java.util.HashSet;
26import javax.swing.AbstractAction;
27import javax.swing.KeyStroke;
28import org.openide.util.NbBundle.Messages;
29import org.openide.util.Utilities;
30import org.sleuthkit.datamodel.AbstractFile;
31
37@Messages({"ExternalViewerShortcutAction.title.text=Open in External Viewer Ctrl+E"})
38public class ExternalViewerShortcutAction extends AbstractAction {
39
40 public static final KeyStroke EXTERNAL_VIEWER_SHORTCUT = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK);
41
43 super(Bundle.ExternalViewerShortcutAction_title_text());
44 }
45
46 // This class is a singleton to support multi-selection of nodes, since
47 // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every
48 // node in the array returns a reference to the same action object from Node.getActions(boolean).
50
51 public static synchronized ExternalViewerShortcutAction getInstance() {
52 if (null == instance) {
54 }
55 return instance;
56 }
57
58 @Override
59 public void actionPerformed(ActionEvent e) {
60 final Collection<AbstractFile> selectedFiles = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
61 if (!selectedFiles.isEmpty()) {
62 for (AbstractFile file : selectedFiles) {
63 ExternalViewerAction action = new ExternalViewerAction(Bundle.ExternalViewerShortcutAction_title_text(), file, false);
64 action.actionPerformed(e);
65 }
66 }
67 }
68}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.