Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DeleteBlackboardArtifactTagAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-2017 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  */
19 package org.sleuthkit.autopsy.actions;
20 
21 import java.awt.event.ActionEvent;
22 import java.util.Collection;
23 import java.util.HashSet;
24 import java.util.concurrent.ExecutionException;
25 import java.util.logging.Level;
26 import javafx.application.Platform;
27 import javafx.scene.control.Alert;
28 import javax.swing.AbstractAction;
29 import javax.swing.JOptionPane;
30 import javax.swing.SwingUtilities;
31 import javax.swing.SwingWorker;
32 import org.openide.util.NbBundle;
33 import org.openide.util.Utilities;
37 import org.sleuthkit.datamodel.AbstractFile;
38 import org.sleuthkit.datamodel.BlackboardArtifactTag;
39 import org.sleuthkit.datamodel.TagName;
40 import org.sleuthkit.datamodel.TskCoreException;
41 
46 @NbBundle.Messages({
47  "DeleteBlackboardArtifactTagAction.deleteTag=Delete Tag",
48  "# {0} - tagName",
49  "DeleteBlackboardArtifactTagAction.unableToDelTag.msg=Unable to delete tag {0}.",
50  "DeleteBlackboardArtifactTagAction.tagDelErr=Tag Deletion Error"
51 })
52 public class DeleteBlackboardArtifactTagAction extends AbstractAction {
53 
54  private static final Logger LOGGER = Logger.getLogger(DeleteBlackboardArtifactTagAction.class.getName());
55 
56  private static final long serialVersionUID = 1L;
57  private static final String MENU_TEXT = NbBundle.getMessage(DeleteBlackboardArtifactTagAction.class,
58  "DeleteBlackboardArtifactTagAction.deleteTag");
59 
60  // This class is a singleton to support multi-selection of nodes, since
61  // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every
62  // node in the array returns a reference to the same action object from Node.getActions(boolean).
64 
65  public static synchronized DeleteBlackboardArtifactTagAction getInstance() {
66  if (null == instance) {
67  instance = new DeleteBlackboardArtifactTagAction();
68  }
69  return instance;
70  }
71 
73  super(MENU_TEXT);
74  }
75 
76  @Override
77  public void actionPerformed(ActionEvent event) {
78  final Collection<? extends BlackboardArtifactTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class);
79  new Thread(() -> {
80  for (BlackboardArtifactTag tag : selectedTags) {
81  try {
83  } catch (TskCoreException ex) {
84  Logger.getLogger(DeleteBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
85  SwingUtilities.invokeLater(() -> {
86  JOptionPane.showMessageDialog(null,
87  NbBundle.getMessage(this.getClass(),
88  "DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
89  tag.getName()),
90  NbBundle.getMessage(this.getClass(),
91  "DeleteBlackboardArtifactTagAction.tagDelErr"),
92  JOptionPane.ERROR_MESSAGE);
93  });
94  break;
95  }
96  }
97  }).start();
98  }
99 
100 }
static synchronized DeleteBlackboardArtifactTagAction getInstance()
void deleteBlackboardArtifactTag(BlackboardArtifactTag tag)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.