Autopsy  4.1
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-2016 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.logging.Level;
24 import javax.swing.AbstractAction;
25 import javax.swing.JOptionPane;
26 import javax.swing.SwingUtilities;
27 import org.openide.util.NbBundle;
28 import org.openide.util.Utilities;
31 import org.sleuthkit.datamodel.BlackboardArtifactTag;
32 import org.sleuthkit.datamodel.TskCoreException;
33 
38 public class DeleteBlackboardArtifactTagAction extends AbstractAction {
39 
40  private static final long serialVersionUID = 1L;
41  private static final String MENU_TEXT = NbBundle.getMessage(DeleteBlackboardArtifactTagAction.class,
42  "DeleteBlackboardArtifactTagAction.deleteTags");
43 
44  // This class is a singleton to support multi-selection of nodes, since
45  // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every
46  // node in the array returns a reference to the same action object from Node.getActions(boolean).
48 
49  public static synchronized DeleteBlackboardArtifactTagAction getInstance() {
50  if (null == instance) {
51  instance = new DeleteBlackboardArtifactTagAction();
52  }
53  return instance;
54  }
55 
57  super(MENU_TEXT);
58  }
59 
60  @Override
61  public void actionPerformed(ActionEvent event) {
62  final Collection<? extends BlackboardArtifactTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class);
63  new Thread(() -> {
64  for (BlackboardArtifactTag tag : selectedTags) {
65  try {
67  } catch (TskCoreException ex) {
68  Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
69  SwingUtilities.invokeLater(() -> {
70  JOptionPane.showMessageDialog(null,
71  NbBundle.getMessage(this.getClass(),
72  "DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
73  tag.getName()),
74  NbBundle.getMessage(this.getClass(),
75  "DeleteBlackboardArtifactTagAction.tagDelErr"),
76  JOptionPane.ERROR_MESSAGE);
77  });
78  break;
79  }
80  }
81  }).start();
82  }
83 
91  @Deprecated
92  protected void doAction(ActionEvent event) {
93  actionPerformed(event);
94  }
95 
104  @Deprecated
105  protected void refreshDirectoryTree() {
106  }
107 
108 }
static synchronized DeleteBlackboardArtifactTagAction getInstance()
synchronized void deleteBlackboardArtifactTag(BlackboardArtifactTag tag)
synchronized static Logger getLogger(String name)
Definition: Logger.java:161

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jan 2 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.