Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
DeleteContentTagAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013 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;
25 import javax.swing.JOptionPane;
26 
27 import org.openide.util.NbBundle;
28 import org.openide.util.Utilities;
32 
36 public class DeleteContentTagAction extends TagAction {
37  private static final String MENU_TEXT = NbBundle.getMessage(DeleteContentTagAction.class,
38  "DeleteContentTagAction.deleteTags");
39 
40  // This class is a singleton to support multi-selection of nodes, since
41  // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every
42  // node in the array returns a reference to the same action object from Node.getActions(boolean).
44 
45  public static synchronized DeleteContentTagAction getInstance() {
46  if (null == instance) {
47  instance = new DeleteContentTagAction();
48  }
49  return instance;
50  }
51 
53  super(MENU_TEXT);
54  }
55 
56  @Override
57  protected void doAction(ActionEvent e) {
58  Collection<? extends ContentTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class);
59  for (ContentTag tag : selectedTags) {
60  try {
62  }
63  catch (TskCoreException ex) {
64  Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
65  JOptionPane.showMessageDialog(null,
66  NbBundle.getMessage(this.getClass(),
67  "DeleteContentTagAction.unableToDelTag.msg",
68  tag.getName()),
69  NbBundle.getMessage(this.getClass(), "DeleteContentTagAction.tagDelErr"),
70  JOptionPane.ERROR_MESSAGE);
71  }
72  }
73  }
74 }
static synchronized DeleteContentTagAction getInstance()
synchronized void deleteContentTag(ContentTag tag)
static Logger getLogger(String name)
Definition: Logger.java:131

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.