19 package org.sleuthkit.autopsy.actions;
21 import java.util.Collection;
22 import java.util.HashSet;
23 import java.util.logging.Level;
24 import javax.swing.JOptionPane;
25 import javax.swing.SwingUtilities;
26 import org.openide.util.NbBundle;
27 import org.openide.util.Utilities;
49 if (null == instance) {
61 String singularTagFile = NbBundle.getMessage(this.getClass(),
"AddContentTagAction.singularTagFile");
62 String pluralTagFile = NbBundle.getMessage(this.getClass(),
"AddContentTagAction.pluralTagFile");
63 return Utilities.actionsGlobalContext().lookupAll(
AbstractFile.class).size() > 1 ? pluralTagFile : singularTagFile;
76 final Collection<AbstractFile> selectedFiles =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(
AbstractFile.class));
82 if (file.getName().equals(
".")) {
85 file = (AbstractFile) parentFile;
87 SwingUtilities.invokeLater(() -> {
88 JOptionPane.showMessageDialog(null,
89 NbBundle.getMessage(
this.getClass(),
90 "AddContentTagAction.unableToTag.msg",
92 NbBundle.getMessage(
this.getClass(),
93 "AddContentTagAction.cannotApplyTagErr"),
94 JOptionPane.WARNING_MESSAGE);
98 }
else if (file.getName().equals(
"..")) {
101 parentFile = (AbstractFile) ((AbstractFile) parentFile).getParent();
102 if (parentFile instanceof AbstractFile) {
103 file = (AbstractFile) parentFile;
105 final Content parentFileCopy = parentFile;
106 SwingUtilities.invokeLater(() -> {
107 JOptionPane.showMessageDialog(null,
108 NbBundle.getMessage(
this.getClass(),
109 "AddContentTagAction.unableToTag.msg",
111 NbBundle.getMessage(
this.getClass(),
112 "AddContentTagAction.cannotApplyTagErr"),
113 JOptionPane.WARNING_MESSAGE);
118 final Content parentFileCopy = parentFile;
119 SwingUtilities.invokeLater(() -> {
120 JOptionPane.showMessageDialog(null,
121 NbBundle.getMessage(
this.getClass(),
122 "AddContentTagAction.unableToTag.msg",
124 NbBundle.getMessage(
this.getClass(),
125 "AddContentTagAction.cannotApplyTagErr"),
126 JOptionPane.WARNING_MESSAGE);
136 SwingUtilities.invokeLater(() -> {
137 JOptionPane.showMessageDialog(null,
138 NbBundle.getMessage(
this.getClass(),
139 "AddContentTagAction.unableToTag.msg2",
141 NbBundle.getMessage(
this.getClass(),
"AddContentTagAction.taggingErr"),
142 JOptionPane.ERROR_MESSAGE);
static AddContentTagAction instance
String getActionDisplayName()
TagsManager getTagsManager()
void addTag(TagName tagName, String comment)
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static synchronized AddContentTagAction getInstance()