19 package org.sleuthkit.autopsy.actions;
21 import java.util.Collection;
22 import java.util.concurrent.ExecutionException;
23 import java.util.logging.Level;
24 import javafx.application.Platform;
25 import javafx.scene.control.Alert;
26 import javax.swing.SwingWorker;
27 import org.openide.util.NbBundle;
28 import org.openide.util.Utilities;
52 if (null == instance) {
63 "# {0} - old tag name",
64 "# {1} - content obj id",
65 "ReplaceContentTagAction.replaceTag.alert=Unable to replace tag {0} for {1}."})
67 protected void replaceTag(ContentTag oldTag, TagName newTagName) {
68 new SwingWorker<Void, Void>() {
71 protected Void doInBackground()
throws Exception {
76 logger.log(Level.SEVERE,
"Error replacing artifact tag. No open case found.", ex);
78 ->
new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTag.getName().getDisplayName(), oldTag.getContent().getName())).show()
84 logger.log(Level.INFO,
"Replacing tag {0} with tag {1} for artifact {2}",
new Object[]{oldTag.getName().getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()});
89 }
catch (TskCoreException tskCoreException) {
90 logger.log(Level.SEVERE,
"Error replacing artifact tag", tskCoreException);
92 ->
new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTag.getName().getDisplayName(), oldTag.getContent().getName())).show()
99 protected void done() {
103 }
catch (InterruptedException | ExecutionException ex) {
104 logger.log(Level.SEVERE,
"Unexpected exception while replacing content tag", ex);
116 Collection<? extends ContentTag> getTagsToReplace() {
117 return Utilities.actionsGlobalContext().lookupAll(ContentTag.class);
static final Logger logger
static ReplaceContentTagAction instance
ReplaceContentTagAction()
static final long serialVersionUID
static synchronized ReplaceContentTagAction getInstance()
TagsManager getTagsManager()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
void replaceTag(ContentTag oldTag, TagName newTagName)