From e24ce3215402299c89ca9860cde3b00c90198d1d Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 7 Jun 2018 10:53:42 -0400 Subject: [PATCH 1/8] 3865: Replace Tags - Initial Commit --- .../ReplaceBlackboardArtifactTagAction.java | 202 ++++++++++++++++++ .../actions/ReplaceContentTagAction.java | 202 ++++++++++++++++++ .../datamodel/BlackboardArtifactTagNode.java | 2 + .../autopsy/datamodel/ContentTagNode.java | 2 + 4 files changed, 408 insertions(+) create mode 100644 Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java create mode 100644 Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java new file mode 100644 index 0000000000..ce76a70b26 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java @@ -0,0 +1,202 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.actions; + +import java.awt.event.ActionEvent; +import java.util.Collection; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import javafx.application.Platform; +import javafx.scene.control.Alert; +import javax.swing.AbstractAction; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.SwingWorker; +import org.openide.util.NbBundle; +import org.openide.util.Utilities; +import org.openide.util.actions.Presenter; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.casemodule.services.TagsManager; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.BlackboardArtifactTag; +import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.TskData; + +/** + * Instances of this Action allow users to replace a tag applied to blackboard + * artifacts, with another tag + */ +@NbBundle.Messages({ + "ReplaceBlackboardArtifactTagAction.replaceTag=Replace Result Tag" +}) +public final class ReplaceBlackboardArtifactTagAction extends AbstractAction implements Presenter.Popup { + + private static final Logger logger = Logger.getLogger(ReplaceBlackboardArtifactTagAction.class.getName()); + + private static final long serialVersionUID = 1L; + private static final String MENU_TEXT = NbBundle.getMessage(ReplaceBlackboardArtifactTagAction.class, + "ReplaceBlackboardArtifactTagAction.replaceTag"); + + // This class is a singleton to support multi-selection of nodes, since + // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every + // node in the array returns a reference to the same action object from Node.getActions(boolean). + private static ReplaceBlackboardArtifactTagAction instance; + + public static synchronized ReplaceBlackboardArtifactTagAction getInstance() { + if (null == instance) { + instance = new ReplaceBlackboardArtifactTagAction(); + } + return instance; + } + + private ReplaceBlackboardArtifactTagAction() { + super(MENU_TEXT); + } + + @Override + public void actionPerformed(ActionEvent event) { + } + + protected String getActionDisplayName() { + return MENU_TEXT; + } + + @NbBundle.Messages({ + "# {0} - old tag name", + "# {1} - artifactID", + "ReplaceBlackboardArtifactTagAction.replaceTag.alert=Unable to replace tag {0} for artifact {1}."}) + protected void replaceTag(TagName oldTagName, TagName newTagName, BlackboardArtifactTag oldArtifactTag) { + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + TagsManager tagsManager; + try { + tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Error replacing artifact tag. No open case found.", ex); //NON-NLS + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() + ); + return null; + } + + try { + logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTagName.getDisplayName(), newTagName.getDisplayName(), oldArtifactTag.getContent().getName()}); //NON-NLS + + System.out.println("RAMAN: Replacing tag " + oldTagName.getDisplayName() + " with tag " + newTagName.getDisplayName() ); + tagsManager.deleteBlackboardArtifactTag(oldArtifactTag); + tagsManager.addBlackboardArtifactTag(oldArtifactTag.getArtifact(), newTagName); + + + } catch (TskCoreException tskCoreException) { + logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() + ); + } + return null; + } + + @Override + protected void done() { + super.done(); + try { + get(); + } catch (InterruptedException | ExecutionException ex) { + logger.log(Level.SEVERE, "Unexpected exception while replacing artifact tag", ex); //NON-NLS + } + } + }.execute(); + } + + @Override + public JMenuItem getPopupPresenter() { + return new ReplaceArtifactTagMenu(); + } + + /** + * Instances of this class implement a context menu user interface for + * selecting a tag name to replace the tag with + */ + private final class ReplaceArtifactTagMenu extends JMenu { + + private static final long serialVersionUID = 1L; + + ReplaceArtifactTagMenu() { + super(getActionDisplayName()); + + final Collection selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class); + + // Get the current set of tag names. + Map tagNamesMap = null; + try { + TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); + tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); + } catch (TskCoreException | NoCurrentCaseException ex) { + Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS + } + + + if (null != tagNamesMap && !tagNamesMap.isEmpty()) { + for (Map.Entry entry : tagNamesMap.entrySet()) { + String tagDisplayName = entry.getKey(); + String notableString = entry.getValue().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); + // for the bookmark tag name only, added shortcut label + if (tagDisplayName.equals(NbBundle.getMessage(AddTagAction.class, "AddBookmarkTagAction.bookmark.text"))) { + tagNameItem.setAccelerator(AddBookmarkTagAction.BOOKMARK_SHORTCUT); + } + + // Add action to replace the tag + tagNameItem.addActionListener((ActionEvent e) -> { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag.getName(), entry.getValue(), oldtag); + }); + }); + + add(tagNameItem); + } + } else { + JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); + empty.setEnabled(false); + add(empty); + } + + addSeparator(); + + JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); + newTagMenuItem.addActionListener((ActionEvent e) -> { + TagName newTagName = GetTagNameDialog.doDialog(); + if (null != newTagName) { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag.getName(), newTagName, oldtag); + }); + } + }); + add(newTagMenuItem); + + } + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java new file mode 100644 index 0000000000..020767238a --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java @@ -0,0 +1,202 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.actions; + +import java.awt.event.ActionEvent; +import java.util.Collection; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import javafx.application.Platform; +import javafx.scene.control.Alert; +import javax.swing.AbstractAction; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.SwingWorker; +import org.openide.util.NbBundle; +import org.openide.util.Utilities; +import org.openide.util.actions.Presenter; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.casemodule.services.TagsManager; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.ContentTag; +import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.TskData; + +/** + * Instances of this Action allow users to replace a tag applied to a file + * with another tag + */ +@NbBundle.Messages({ + "ReplaceContentArtifactTagAction.replaceTag=Replace File Tag" +}) +public final class ReplaceContentTagAction extends AbstractAction implements Presenter.Popup { + + private static final Logger logger = Logger.getLogger(ReplaceContentTagAction.class.getName()); + + private static final long serialVersionUID = 1L; + private static final String MENU_TEXT = NbBundle.getMessage(ReplaceContentTagAction.class, + "ReplaceContentArtifactTagAction.replaceTag"); + + // This class is a singleton to support multi-selection of nodes, since + // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every + // node in the array returns a reference to the same action object from Node.getActions(boolean). + private static ReplaceContentTagAction instance; + + public static synchronized ReplaceContentTagAction getInstance() { + if (null == instance) { + instance = new ReplaceContentTagAction(); + } + return instance; + } + + private ReplaceContentTagAction() { + super(MENU_TEXT); + } + + @Override + public void actionPerformed(ActionEvent event) { + } + + protected String getActionDisplayName() { + return MENU_TEXT; + } + + @NbBundle.Messages({ + "# {0} - old tag name", + "# {1} - content obj id", + "ReplaceContentTagAction.replaceTag.alert=Unable to replace tag {0} for {1}."}) + protected void replaceTag(TagName oldTagName, TagName newTagName, ContentTag oldTag) { + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + TagsManager tagsManager; + try { + tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.SEVERE, "Error replacing artifact tag. No open case found.", ex); //NON-NLS + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldTag.getContent().getName())).show() + ); + return null; + } + + try { + logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTagName.getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()}); //NON-NLS + + System.out.println("RAMAN: Replacing tag " + oldTagName.getDisplayName() + " with tag " + newTagName.getDisplayName() ); + + tagsManager.deleteContentTag(oldTag); + tagsManager.addContentTag(oldTag.getContent(), newTagName); + + } catch (TskCoreException tskCoreException) { + logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldTag.getContent().getName())).show() + ); + } + return null; + } + + @Override + protected void done() { + super.done(); + try { + get(); + } catch (InterruptedException | ExecutionException ex) { + logger.log(Level.SEVERE, "Unexpected exception while replacing content tag", ex); //NON-NLS + } + } + }.execute(); + } + + @Override + public JMenuItem getPopupPresenter() { + return new ReplaceContentTagMenu(); + } + + /** + * Instances of this class implement a context menu user interface for + * selecting a tag name to replace the tag with + */ + private final class ReplaceContentTagMenu extends JMenu { + + private static final long serialVersionUID = 1L; + + ReplaceContentTagMenu() { + super(getActionDisplayName()); + + final Collection selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class); + + // Get the current set of tag names. + Map tagNamesMap = null; + try { + TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); + tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); + } catch (TskCoreException | NoCurrentCaseException ex) { + Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS + } + + + if (null != tagNamesMap && !tagNamesMap.isEmpty()) { + for (Map.Entry entry : tagNamesMap.entrySet()) { + String tagDisplayName = entry.getKey(); + String notableString = entry.getValue().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); + // for the bookmark tag name only, added shortcut label + if (tagDisplayName.equals(NbBundle.getMessage(AddTagAction.class, "AddBookmarkTagAction.bookmark.text"))) { + tagNameItem.setAccelerator(AddBookmarkTagAction.BOOKMARK_SHORTCUT); + } + + // Add action to replace the tag + tagNameItem.addActionListener((ActionEvent e) -> { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag.getName(), entry.getValue(), oldtag); + }); + }); + + add(tagNameItem); + } + } else { + JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); + empty.setEnabled(false); + add(empty); + } + + addSeparator(); + + JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); + newTagMenuItem.addActionListener((ActionEvent e) -> { + TagName newTagName = GetTagNameDialog.doDialog(); + if (null != newTagName) { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag.getName(), newTagName, oldtag); + }); + } + }); + add(newTagMenuItem); + + } + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java index 6e7a8205c7..e9cbe09ea0 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java @@ -29,6 +29,7 @@ import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.actions.DeleteBlackboardArtifactTagAction; +import org.sleuthkit.autopsy.actions.ReplaceBlackboardArtifactTagAction; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.timeline.actions.ViewArtifactInTimelineAction; @@ -134,6 +135,7 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode { actions.add(new ViewTaggedArtifactAction(BlackboardArtifactTagNode_viewSourceArtifact_text(), artifact)); actions.addAll(DataModelActionsFactory.getActions(tag.getContent(), true)); actions.add(DeleteBlackboardArtifactTagAction.getInstance()); + actions.add(ReplaceBlackboardArtifactTagAction.getInstance()); return actions.toArray(new Action[0]); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java index 59d7d21015..7fcf7d0e1c 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java @@ -30,6 +30,7 @@ import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.actions.DeleteContentTagAction; +import org.sleuthkit.autopsy.actions.ReplaceContentTagAction; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction; import org.sleuthkit.datamodel.AbstractFile; @@ -130,6 +131,7 @@ class ContentTagNode extends DisplayableItemNode { } actions.addAll(DataModelActionsFactory.getActions(tag.getContent(), false)); actions.add(DeleteContentTagAction.getInstance()); + actions.add(ReplaceContentTagAction.getInstance()); return actions.toArray(new Action[actions.size()]); } From 1d3fffadf9c9099a6eaebf7caaab2765b5333d96 Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 7 Jun 2018 13:48:38 -0400 Subject: [PATCH 2/8] Refactored to remove code duplication --- .../ReplaceBlackboardArtifactTagAction.java | 127 ++++------------ .../actions/ReplaceContentTagAction.java | 115 +++----------- .../autopsy/actions/ReplaceTagAction.java | 140 ++++++++++++++++++ 3 files changed, 184 insertions(+), 198 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java index ce76a70b26..48d771ac71 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java @@ -18,21 +18,14 @@ */ package org.sleuthkit.autopsy.actions; -import java.awt.event.ActionEvent; import java.util.Collection; -import java.util.Map; -import java.util.TreeMap; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import javafx.application.Platform; import javafx.scene.control.Alert; -import javax.swing.AbstractAction; -import javax.swing.JMenu; -import javax.swing.JMenuItem; import javax.swing.SwingWorker; import org.openide.util.NbBundle; import org.openide.util.Utilities; -import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; @@ -40,22 +33,15 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifactTag; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; -import org.sleuthkit.datamodel.TskData; /** * Instances of this Action allow users to replace a tag applied to blackboard * artifacts, with another tag */ -@NbBundle.Messages({ - "ReplaceBlackboardArtifactTagAction.replaceTag=Replace Result Tag" -}) -public final class ReplaceBlackboardArtifactTagAction extends AbstractAction implements Presenter.Popup { +public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction { private static final Logger logger = Logger.getLogger(ReplaceBlackboardArtifactTagAction.class.getName()); - private static final long serialVersionUID = 1L; - private static final String MENU_TEXT = NbBundle.getMessage(ReplaceBlackboardArtifactTagAction.class, - "ReplaceBlackboardArtifactTagAction.replaceTag"); // This class is a singleton to support multi-selection of nodes, since // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every @@ -73,21 +59,21 @@ public final class ReplaceBlackboardArtifactTagAction extends AbstractAction imp super(MENU_TEXT); } - @Override - public void actionPerformed(ActionEvent event) { - } - - protected String getActionDisplayName() { - return MENU_TEXT; - } - + /** + * Replaces the specified tag on the given artifact with the new one + * + * @param oldArtifactTag tag to be replaced + * @param newTagName name of the tag to replace with + */ @NbBundle.Messages({ "# {0} - old tag name", "# {1} - artifactID", "ReplaceBlackboardArtifactTagAction.replaceTag.alert=Unable to replace tag {0} for artifact {1}."}) - protected void replaceTag(TagName oldTagName, TagName newTagName, BlackboardArtifactTag oldArtifactTag) { + @Override + protected void replaceTag( BlackboardArtifactTag oldArtifactTag, TagName newTagName) { new SwingWorker() { + @Override protected Void doInBackground() throws Exception { TagsManager tagsManager; @@ -96,23 +82,21 @@ public final class ReplaceBlackboardArtifactTagAction extends AbstractAction imp } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error replacing artifact tag. No open case found.", ex); //NON-NLS Platform.runLater(() - -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldArtifactTag.getName().getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() ); - return null; + return null; } try { - logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTagName.getDisplayName(), newTagName.getDisplayName(), oldArtifactTag.getContent().getName()}); //NON-NLS - - System.out.println("RAMAN: Replacing tag " + oldTagName.getDisplayName() + " with tag " + newTagName.getDisplayName() ); - tagsManager.deleteBlackboardArtifactTag(oldArtifactTag); - tagsManager.addBlackboardArtifactTag(oldArtifactTag.getArtifact(), newTagName); - - + logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldArtifactTag.getName().getDisplayName(), newTagName.getDisplayName(), oldArtifactTag.getContent().getName()}); //NON-NLS + + tagsManager.deleteBlackboardArtifactTag(oldArtifactTag); + tagsManager.addBlackboardArtifactTag(oldArtifactTag.getArtifact(), newTagName); + } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS Platform.runLater(() - -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceBlackboardArtifactTagAction_replaceTag_alert(oldArtifactTag.getName().getDisplayName(), oldArtifactTag.getArtifact().getArtifactID())).show() ); } return null; @@ -130,73 +114,14 @@ public final class ReplaceBlackboardArtifactTagAction extends AbstractAction imp }.execute(); } - @Override - public JMenuItem getPopupPresenter() { - return new ReplaceArtifactTagMenu(); - } - - /** - * Instances of this class implement a context menu user interface for - * selecting a tag name to replace the tag with + /** + * Returns list of tags selected by user to replace + * + * @return list of tags */ - private final class ReplaceArtifactTagMenu extends JMenu { - - private static final long serialVersionUID = 1L; - - ReplaceArtifactTagMenu() { - super(getActionDisplayName()); - - final Collection selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class); - - // Get the current set of tag names. - Map tagNamesMap = null; - try { - TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); - tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException | NoCurrentCaseException ex) { - Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS - } - - - if (null != tagNamesMap && !tagNamesMap.isEmpty()) { - for (Map.Entry entry : tagNamesMap.entrySet()) { - String tagDisplayName = entry.getKey(); - String notableString = entry.getValue().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; - JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); - // for the bookmark tag name only, added shortcut label - if (tagDisplayName.equals(NbBundle.getMessage(AddTagAction.class, "AddBookmarkTagAction.bookmark.text"))) { - tagNameItem.setAccelerator(AddBookmarkTagAction.BOOKMARK_SHORTCUT); - } - - // Add action to replace the tag - tagNameItem.addActionListener((ActionEvent e) -> { - selectedTags.forEach((oldtag) -> { - replaceTag(oldtag.getName(), entry.getValue(), oldtag); - }); - }); - - add(tagNameItem); - } - } else { - JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); - empty.setEnabled(false); - add(empty); - } - - addSeparator(); - - JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); - newTagMenuItem.addActionListener((ActionEvent e) -> { - TagName newTagName = GetTagNameDialog.doDialog(); - if (null != newTagName) { - selectedTags.forEach((oldtag) -> { - replaceTag(oldtag.getName(), newTagName, oldtag); - }); - } - }); - add(newTagMenuItem); - - } + @Override + Collection getSelectedTags() { + return Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class); } - + } diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java index 020767238a..dfeee5519d 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java @@ -18,21 +18,14 @@ */ package org.sleuthkit.autopsy.actions; -import java.awt.event.ActionEvent; import java.util.Collection; -import java.util.Map; -import java.util.TreeMap; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import javafx.application.Platform; import javafx.scene.control.Alert; -import javax.swing.AbstractAction; -import javax.swing.JMenu; -import javax.swing.JMenuItem; import javax.swing.SwingWorker; import org.openide.util.NbBundle; import org.openide.util.Utilities; -import org.openide.util.actions.Presenter; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; @@ -40,22 +33,18 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; -import org.sleuthkit.datamodel.TskData; /** - * Instances of this Action allow users to replace a tag applied to a file - * with another tag + * This Action allow users to replace a content tag with another tag */ @NbBundle.Messages({ "ReplaceContentArtifactTagAction.replaceTag=Replace File Tag" }) -public final class ReplaceContentTagAction extends AbstractAction implements Presenter.Popup { +public final class ReplaceContentTagAction extends ReplaceTagAction { private static final Logger logger = Logger.getLogger(ReplaceContentTagAction.class.getName()); private static final long serialVersionUID = 1L; - private static final String MENU_TEXT = NbBundle.getMessage(ReplaceContentTagAction.class, - "ReplaceContentArtifactTagAction.replaceTag"); // This class is a singleton to support multi-selection of nodes, since // org.openide.nodes.NodeOp.findActions(Node[] nodes) will only pick up an Action if every @@ -73,19 +62,12 @@ public final class ReplaceContentTagAction extends AbstractAction implements Pre super(MENU_TEXT); } - @Override - public void actionPerformed(ActionEvent event) { - } - - protected String getActionDisplayName() { - return MENU_TEXT; - } - @NbBundle.Messages({ "# {0} - old tag name", "# {1} - content obj id", "ReplaceContentTagAction.replaceTag.alert=Unable to replace tag {0} for {1}."}) - protected void replaceTag(TagName oldTagName, TagName newTagName, ContentTag oldTag) { + @Override + protected void replaceTag(ContentTag oldTag, TagName newTagName) { new SwingWorker() { @Override @@ -96,23 +78,21 @@ public final class ReplaceContentTagAction extends AbstractAction implements Pre } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error replacing artifact tag. No open case found.", ex); //NON-NLS Platform.runLater(() - -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldTag.getContent().getName())).show() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTag.getName().getDisplayName(), oldTag.getContent().getName())).show() ); - return null; + return null; } try { - logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTagName.getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()}); //NON-NLS - - System.out.println("RAMAN: Replacing tag " + oldTagName.getDisplayName() + " with tag " + newTagName.getDisplayName() ); - - tagsManager.deleteContentTag(oldTag); - tagsManager.addContentTag(oldTag.getContent(), newTagName); + logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTag.getName().getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()}); //NON-NLS + + tagsManager.deleteContentTag(oldTag); + tagsManager.addContentTag(oldTag.getContent(), newTagName); } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS Platform.runLater(() - -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTagName.getDisplayName(), oldTag.getContent().getName())).show() + -> new Alert(Alert.AlertType.ERROR, Bundle.ReplaceContentTagAction_replaceTag_alert(oldTag.getName().getDisplayName(), oldTag.getContent().getName())).show() ); } return null; @@ -130,73 +110,14 @@ public final class ReplaceContentTagAction extends AbstractAction implements Pre }.execute(); } - @Override - public JMenuItem getPopupPresenter() { - return new ReplaceContentTagMenu(); - } - /** - * Instances of this class implement a context menu user interface for - * selecting a tag name to replace the tag with + * Returns list of tags selected by user to replace + * + * @return list of tags */ - private final class ReplaceContentTagMenu extends JMenu { - - private static final long serialVersionUID = 1L; - - ReplaceContentTagMenu() { - super(getActionDisplayName()); - - final Collection selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class); - - // Get the current set of tag names. - Map tagNamesMap = null; - try { - TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); - tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); - } catch (TskCoreException | NoCurrentCaseException ex) { - Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS - } - - - if (null != tagNamesMap && !tagNamesMap.isEmpty()) { - for (Map.Entry entry : tagNamesMap.entrySet()) { - String tagDisplayName = entry.getKey(); - String notableString = entry.getValue().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; - JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); - // for the bookmark tag name only, added shortcut label - if (tagDisplayName.equals(NbBundle.getMessage(AddTagAction.class, "AddBookmarkTagAction.bookmark.text"))) { - tagNameItem.setAccelerator(AddBookmarkTagAction.BOOKMARK_SHORTCUT); - } - - // Add action to replace the tag - tagNameItem.addActionListener((ActionEvent e) -> { - selectedTags.forEach((oldtag) -> { - replaceTag(oldtag.getName(), entry.getValue(), oldtag); - }); - }); - - add(tagNameItem); - } - } else { - JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); - empty.setEnabled(false); - add(empty); - } - - addSeparator(); - - JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); - newTagMenuItem.addActionListener((ActionEvent e) -> { - TagName newTagName = GetTagNameDialog.doDialog(); - if (null != newTagName) { - selectedTags.forEach((oldtag) -> { - replaceTag(oldtag.getName(), newTagName, oldtag); - }); - } - }); - add(newTagMenuItem); - - } + @Override + Collection getSelectedTags() { + return Utilities.actionsGlobalContext().lookupAll(ContentTag.class); } - + } diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java new file mode 100644 index 0000000000..e14cc9e214 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -0,0 +1,140 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.actions; + +import java.awt.event.ActionEvent; +import java.util.Collection; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Level; +import javax.swing.AbstractAction; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import org.openide.util.NbBundle; +import org.openide.util.actions.Presenter; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.casemodule.services.TagsManager; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.Tag; +import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.TskData; + + +/** + * Abstract class to define context action to replace a tag with another + * + * @param tag type + */ +@NbBundle.Messages({ + "ReplaceTagAction.replaceTag=Replace Tag" +}) +abstract class ReplaceTagAction extends AbstractAction implements Presenter.Popup { + + private static final long serialVersionUID = 1L; + protected static final String MENU_TEXT = NbBundle.getMessage(ReplaceTagAction.class, + "ReplaceTagAction.replaceTag"); + + ReplaceTagAction(String menuText) { + super(menuText); + } + + @Override + public void actionPerformed(ActionEvent event) { + } + + protected String getActionDisplayName() { + return MENU_TEXT; + } + + + /** + * Method to actually replace the selected tag with the given new tag + * + * @param oldTag + * @param newTagName + */ + abstract protected void replaceTag(T oldTag, TagName newTagName ); + + /** + * Returns elected tags which are to be replaced + * + * @return + */ + abstract Collection getSelectedTags(); + + @Override + public JMenuItem getPopupPresenter() { + return new ReplaceTagMenu(); + } + + /** + * Instances of this class implement a context menu user interface for + * selecting a tag name to replace the tag with + */ + private final class ReplaceTagMenu extends JMenu { + + private static final long serialVersionUID = 1L; + + ReplaceTagMenu() { + super(getActionDisplayName()); + + // final CollectionselectedTags = Utilities.actionsGlobalContext().lookupAll(T.class); + final CollectionselectedTags = getSelectedTags(); + + // Get the current set of tag names. + Map tagNamesMap = null; + try { + TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); + tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); + } catch (TskCoreException | NoCurrentCaseException ex) { + Logger.getLogger(ReplaceTagMenu.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS + } + + + if (null != tagNamesMap && !tagNamesMap.isEmpty()) { + for (Map.Entry entry : tagNamesMap.entrySet()) { + String tagDisplayName = entry.getKey(); + String notableString = entry.getValue().getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; + JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); + // for the bookmark tag name only, added shortcut label + if (tagDisplayName.equals(NbBundle.getMessage(AddTagAction.class, "AddBookmarkTagAction.bookmark.text"))) { + tagNameItem.setAccelerator(AddBookmarkTagAction.BOOKMARK_SHORTCUT); + } + + // Add action to replace the tag + tagNameItem.addActionListener((ActionEvent e) -> { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag, entry.getValue() ); + }); + }); + + add(tagNameItem); + } + } else { + JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); + empty.setEnabled(false); + add(empty); + } + + addSeparator(); + + JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); + newTagMenuItem.addActionListener((ActionEvent e) -> { + TagName newTagName = GetTagNameDialog.doDialog(); + if (null != newTagName) { + selectedTags.forEach((oldtag) -> { + replaceTag(oldtag, newTagName); + }); + } + }); + add(newTagMenuItem); + + } + } + +} From d8412271f7d133b0004b21aa15ea88200a3d1d4a Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 7 Jun 2018 16:13:38 -0400 Subject: [PATCH 3/8] Minor cleaanup --- .../ReplaceBlackboardArtifactTagAction.java | 7 ++-- .../actions/ReplaceContentTagAction.java | 6 +-- .../autopsy/actions/ReplaceTagAction.java | 42 ++++++++----------- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java index 48d771ac71..a014257daf 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceBlackboardArtifactTagAction.java @@ -35,7 +35,7 @@ import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; /** - * Instances of this Action allow users to replace a tag applied to blackboard + * This Action allows users to replace a tag applied to blackboard * artifacts, with another tag */ public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction { @@ -72,7 +72,6 @@ public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction() { - @Override protected Void doInBackground() throws Exception { @@ -117,10 +116,10 @@ public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction getSelectedTags() { + Collection getTagsToReplace() { return Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class); } diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java index dfeee5519d..287ae95415 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java @@ -111,12 +111,12 @@ public final class ReplaceContentTagAction extends ReplaceTagAction } /** - * Returns list of tags selected by user to replace + * Returns list of content tags selected by user to replace * - * @return list of tags + * @return a list of tags */ @Override - Collection getSelectedTags() { + Collection getTagsToReplace() { return Utilities.actionsGlobalContext().lookupAll(ContentTag.class); } diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java index e14cc9e214..2c27d185d7 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -24,10 +24,9 @@ import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; - /** * Abstract class to define context action to replace a tag with another - * + * * @param tag type */ @NbBundle.Messages({ @@ -51,30 +50,29 @@ abstract class ReplaceTagAction extends AbstractAction implements return MENU_TEXT; } - /** - * Method to actually replace the selected tag with the given new tag + * Method to actually replace the selected tag with the given new tag * - * @param oldTag + * @param oldTag * @param newTagName */ - abstract protected void replaceTag(T oldTag, TagName newTagName ); - + abstract protected void replaceTag(T oldTag, TagName newTagName); + /** * Returns elected tags which are to be replaced - * - * @return + * + * @return */ - abstract Collection getSelectedTags(); - + abstract Collection getTagsToReplace(); + @Override public JMenuItem getPopupPresenter() { - return new ReplaceTagMenu(); + return new ReplaceTagMenu(); } - - /** + + /** * Instances of this class implement a context menu user interface for - * selecting a tag name to replace the tag with + * selecting a tag name to replace the tag with */ private final class ReplaceTagMenu extends JMenu { @@ -82,9 +80,8 @@ abstract class ReplaceTagAction extends AbstractAction implements ReplaceTagMenu() { super(getActionDisplayName()); - - // final CollectionselectedTags = Utilities.actionsGlobalContext().lookupAll(T.class); - final CollectionselectedTags = getSelectedTags(); + + final Collection selectedTags = getTagsToReplace(); // Get the current set of tag names. Map tagNamesMap = null; @@ -95,7 +92,6 @@ abstract class ReplaceTagAction extends AbstractAction implements Logger.getLogger(ReplaceTagMenu.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } - if (null != tagNamesMap && !tagNamesMap.isEmpty()) { for (Map.Entry entry : tagNamesMap.entrySet()) { String tagDisplayName = entry.getKey(); @@ -109,10 +105,10 @@ abstract class ReplaceTagAction extends AbstractAction implements // Add action to replace the tag tagNameItem.addActionListener((ActionEvent e) -> { selectedTags.forEach((oldtag) -> { - replaceTag(oldtag, entry.getValue() ); + replaceTag(oldtag, entry.getValue()); }); }); - + add(tagNameItem); } } else { @@ -122,7 +118,6 @@ abstract class ReplaceTagAction extends AbstractAction implements } addSeparator(); - JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); newTagMenuItem.addActionListener((ActionEvent e) -> { TagName newTagName = GetTagNameDialog.doDialog(); @@ -133,8 +128,7 @@ abstract class ReplaceTagAction extends AbstractAction implements } }); add(newTagMenuItem); - + } } - } From 3a86bfc5ec85ccbc087b85c25e3a4d1525a67956 Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 7 Jun 2018 16:30:08 -0400 Subject: [PATCH 4/8] Codacy-inspired minor cleanup --- .../sleuthkit/autopsy/actions/ReplaceTagAction.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java index 2c27d185d7..992066923e 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -42,7 +42,14 @@ abstract class ReplaceTagAction extends AbstractAction implements super(menuText); } + /** + * Subclasses of replaceTagAction should not override actionPerformed, + * but instead override replaceTag. + * + * @param event + */ @Override + @SuppressWarnings("NoopMethodInAbstractClass") public void actionPerformed(ActionEvent event) { } @@ -103,7 +110,7 @@ abstract class ReplaceTagAction extends AbstractAction implements } // Add action to replace the tag - tagNameItem.addActionListener((ActionEvent e) -> { + tagNameItem.addActionListener((ActionEvent event) -> { selectedTags.forEach((oldtag) -> { replaceTag(oldtag, entry.getValue()); }); @@ -119,7 +126,7 @@ abstract class ReplaceTagAction extends AbstractAction implements addSeparator(); JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); - newTagMenuItem.addActionListener((ActionEvent e) -> { + newTagMenuItem.addActionListener((ActionEvent event) -> { TagName newTagName = GetTagNameDialog.doDialog(); if (null != newTagName) { selectedTags.forEach((oldtag) -> { From 43847af69c4bf344ce62765686e5e63c4d40fbc2 Mon Sep 17 00:00:00 2001 From: Raman Date: Fri, 8 Jun 2018 14:03:44 -0400 Subject: [PATCH 5/8] 3866: User defined tags appear first in tags menu --- .../autopsy/actions/AddTagAction.java | 23 ++++++++++++++++--- .../autopsy/actions/ReplaceTagAction.java | 19 ++++++++++++++- .../casemodule/services/TagsManager.java | 9 ++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java index 7d0212b51c..5df684a207 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java @@ -19,6 +19,8 @@ package org.sleuthkit.autopsy.actions; import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.logging.Level; @@ -83,7 +85,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { */ // @@@ This user interface has some significant usability issues and needs // to be reworked. - private class TagMenu extends JMenu { + private final class TagMenu extends JMenu { private static final long serialVersionUID = 1L; @@ -92,6 +94,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { // Get the current set of tag names. Map tagNamesMap = null; + List standardTagNames = TagsManager.getStandardTagNames(); try { TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); @@ -106,6 +109,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { // Each tag name in the current set of tags gets its own menu item in // the "Quick Tags" sub-menu. Selecting one of these menu items adds // a tag with the associated tag name. + List standardTagMenuitems = new ArrayList<>(); if (null != tagNamesMap && !tagNamesMap.isEmpty()) { for (Map.Entry entry : tagNamesMap.entrySet()) { String tagDisplayName = entry.getKey(); @@ -119,7 +123,13 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { tagNameItem.addActionListener((ActionEvent e) -> { getAndAddTag(entry.getKey(), entry.getValue(), NO_COMMENT); }); - quickTagMenu.add(tagNameItem); + + // Show custom tags before predefined tags in the menu + if (standardTagNames.contains(tagDisplayName)) { + standardTagMenuitems.add(tagNameItem); + } else { + quickTagMenu.add(tagNameItem); + } } } else { JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); @@ -127,8 +137,15 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { quickTagMenu.add(empty); } + if (quickTagMenu.getItemCount() > 0) { + quickTagMenu.addSeparator(); + } + standardTagMenuitems.forEach((menuItem) -> { + quickTagMenu.add(menuItem); + }); + quickTagMenu.addSeparator(); - + // The "Quick Tag" menu also gets an "Choose Tag..." menu item. // Selecting this item initiates a dialog that can be used to create // or select a tag name and adds a tag with the resulting name. diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java index 992066923e..9c82934e27 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -6,7 +6,9 @@ package org.sleuthkit.autopsy.actions; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.logging.Level; @@ -92,6 +94,7 @@ abstract class ReplaceTagAction extends AbstractAction implements // Get the current set of tag names. Map tagNamesMap = null; + List standardTagNames = TagsManager.getStandardTagNames(); try { TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); tagNamesMap = new TreeMap<>(tagsManager.getDisplayNamesToTagNamesMap()); @@ -99,6 +102,7 @@ abstract class ReplaceTagAction extends AbstractAction implements Logger.getLogger(ReplaceTagMenu.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } + List standardTagMenuitems = new ArrayList<>(); if (null != tagNamesMap && !tagNamesMap.isEmpty()) { for (Map.Entry entry : tagNamesMap.entrySet()) { String tagDisplayName = entry.getKey(); @@ -116,7 +120,12 @@ abstract class ReplaceTagAction extends AbstractAction implements }); }); - add(tagNameItem); + // Show custom tags before predefined tags in the menu + if (standardTagNames.contains(tagDisplayName)) { + standardTagMenuitems.add(tagNameItem); + } else { + add(tagNameItem); + } } } else { JMenuItem empty = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.noTags")); @@ -124,6 +133,14 @@ abstract class ReplaceTagAction extends AbstractAction implements add(empty); } + // + if (this.getItemCount() > 0) { + addSeparator(); + } + standardTagMenuitems.forEach((menuItem) -> { + add(menuItem); + }); + addSeparator(); JMenuItem newTagMenuItem = new JMenuItem(NbBundle.getMessage(this.getClass(), "AddTagAction.newTag")); newTagMenuItem.addActionListener((ActionEvent event) -> { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index f113a622fe..522c439d26 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -121,6 +121,15 @@ public class TagsManager implements Closeable { return tagDisplayNames; } + /** + * Returns a list of names of standard/predefined tags + * + * @return list of predefined tag names + */ + public static List getStandardTagNames() { + return TagNameDefinition.getStandardTagNames(); + } + /** * Constructs a per case Autopsy service that manages the addition of * content and artifact tags to the case database. From 169897916bdcabd0a15dc3aaaad169627b37781b Mon Sep 17 00:00:00 2001 From: Raman Date: Wed, 13 Jun 2018 09:53:10 -0400 Subject: [PATCH 6/8] 3865: Examiner can replace a tag with another tag - Reworded context menu items - Show all Tag related menu items together --- .../AddBlackboardArtifactTagAction.java | 4 +- .../autopsy/actions/AddContentTagAction.java | 4 +- .../DeleteBlackboardArtifactTagAction.java | 2 +- .../actions/DeleteContentTagAction.java | 2 +- .../actions/ReplaceContentTagAction.java | 3 - .../autopsy/actions/ReplaceTagAction.java | 39 +++++++-- .../datamodel/BlackboardArtifactTagNode.java | 9 +-- .../autopsy/datamodel/ContentTagNode.java | 6 +- .../datamodel/DataModelActionsFactory.java | 80 +++++++++++++++++++ 9 files changed, 126 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java index 7ad185ac8e..9015d9a6ad 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java @@ -37,8 +37,8 @@ import org.sleuthkit.datamodel.TskCoreException; * Instances of this Action allow users to apply tags to blackboard artifacts. */ @NbBundle.Messages({ - "AddBlackboardArtifactTagAction.singularTagResult=Tag Result", - "AddBlackboardArtifactTagAction.pluralTagResult=Tag Results", + "AddBlackboardArtifactTagAction.singularTagResult=Add Result Tag", + "AddBlackboardArtifactTagAction.pluralTagResult=Add Result Tags", "# {0} - artifactName", "AddBlackboardArtifactTagAction.unableToTag.msg=Unable to tag {0}.", "AddBlackboardArtifactTagAction.taggingErr=Tagging Error" diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java index 602789735d..34e7b2a110 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java @@ -38,8 +38,8 @@ import org.sleuthkit.datamodel.TskCoreException; * Instances of this Action allow users to apply tags to content. */ @NbBundle.Messages({ - "AddContentTagAction.singularTagFile=Tag File", - "AddContentTagAction.pluralTagFile=Tag Files", + "AddContentTagAction.singularTagFile=Add File Tag", + "AddContentTagAction.pluralTagFile=Add File Tags", "# {0} - fileName", "AddContentTagAction.unableToTag.msg=Unable to tag {0}, not a regular file.", "AddContentTagAction.cannotApplyTagErr=Cannot Apply Tag", diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java index 18ae9ac7e5..c3878e6b59 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteBlackboardArtifactTagAction.java @@ -38,7 +38,7 @@ import org.sleuthkit.datamodel.TskCoreException; * artifacts. */ @NbBundle.Messages({ - "DeleteBlackboardArtifactTagAction.deleteTag=Delete Tag", + "DeleteBlackboardArtifactTagAction.deleteTag=Remove Selected Tag(s)", "# {0} - tagName", "DeleteBlackboardArtifactTagAction.unableToDelTag.msg=Unable to delete tag {0}.", "DeleteBlackboardArtifactTagAction.tagDelErr=Tag Deletion Error" diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java index 07cce02bfc..b7ff3a73a0 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteContentTagAction.java @@ -37,7 +37,7 @@ import org.sleuthkit.datamodel.TskCoreException; * Instances of this Action allow users to delete tags applied to content. */ @NbBundle.Messages({ - "DeleteContentTagAction.deleteTag=Delete Tag", + "DeleteContentTagAction.deleteTag=Remove Selected Tag(s)", "# {0} - tagName", "DeleteContentTagAction.unableToDelTag.msg=Unable to delete tag {0}.", "DeleteContentTagAction.tagDelErr=Tag Deletion Error" diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java index 287ae95415..484a30178c 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceContentTagAction.java @@ -37,9 +37,6 @@ import org.sleuthkit.datamodel.TskCoreException; /** * This Action allow users to replace a content tag with another tag */ -@NbBundle.Messages({ - "ReplaceContentArtifactTagAction.replaceTag=Replace File Tag" -}) public final class ReplaceContentTagAction extends ReplaceTagAction { private static final Logger logger = Logger.getLogger(ReplaceContentTagAction.class.getName()); diff --git a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java index 992066923e..0107803856 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/ReplaceTagAction.java @@ -1,13 +1,28 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2018 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.actions; import java.awt.event.ActionEvent; import java.util.Collection; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import java.util.logging.Level; import javax.swing.AbstractAction; @@ -30,7 +45,7 @@ import org.sleuthkit.datamodel.TskData; * @param tag type */ @NbBundle.Messages({ - "ReplaceTagAction.replaceTag=Replace Tag" + "ReplaceTagAction.replaceTag=Replace Selected Tag(s) With" }) abstract class ReplaceTagAction extends AbstractAction implements Presenter.Popup { @@ -72,6 +87,7 @@ abstract class ReplaceTagAction extends AbstractAction implements */ abstract Collection getTagsToReplace(); + @Override public JMenuItem getPopupPresenter() { return new ReplaceTagMenu(); @@ -89,7 +105,7 @@ abstract class ReplaceTagAction extends AbstractAction implements super(getActionDisplayName()); final Collection selectedTags = getTagsToReplace(); - + // Get the current set of tag names. Map tagNamesMap = null; try { @@ -99,6 +115,14 @@ abstract class ReplaceTagAction extends AbstractAction implements Logger.getLogger(ReplaceTagMenu.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS } + // Ideally we should'nt allow user to pick a replacement tag that's already been applied to an item + // In the very least we don't allow them to pick the same tag as the one they are trying to replace + Set existingTagNames = new HashSet<>(); + if (!selectedTags.isEmpty()) { + T firstTag = selectedTags.iterator().next(); + existingTagNames.add(firstTag.getName().getDisplayName()); + } + if (null != tagNamesMap && !tagNamesMap.isEmpty()) { for (Map.Entry entry : tagNamesMap.entrySet()) { String tagDisplayName = entry.getKey(); @@ -116,6 +140,11 @@ abstract class ReplaceTagAction extends AbstractAction implements }); }); + // Don't allow replacing a tag with same tag. + if (existingTagNames.contains(tagDisplayName)) { + tagNameItem.setEnabled(false); + } + add(tagNameItem); } } else { diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java index e9cbe09ea0..ea944b6b43 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactTagNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2016 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,8 +28,6 @@ import org.openide.nodes.Children; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.actions.DeleteBlackboardArtifactTagAction; -import org.sleuthkit.autopsy.actions.ReplaceBlackboardArtifactTagAction; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.timeline.actions.ViewArtifactInTimelineAction; @@ -133,9 +131,8 @@ public class BlackboardArtifactTagNode extends DisplayableItemNode { actions.add(ViewFileInTimelineAction.createViewSourceFileAction(file)); } actions.add(new ViewTaggedArtifactAction(BlackboardArtifactTagNode_viewSourceArtifact_text(), artifact)); - actions.addAll(DataModelActionsFactory.getActions(tag.getContent(), true)); - actions.add(DeleteBlackboardArtifactTagAction.getInstance()); - actions.add(ReplaceBlackboardArtifactTagAction.getInstance()); + actions.addAll(DataModelActionsFactory.getActions(tag, true)); + return actions.toArray(new Action[0]); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java index 7fcf7d0e1c..2d8e544375 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java @@ -129,9 +129,9 @@ class ContentTagNode extends DisplayableItemNode { if (file != null) { actions.add(ViewFileInTimelineAction.createViewFileAction(file)); } - actions.addAll(DataModelActionsFactory.getActions(tag.getContent(), false)); - actions.add(DeleteContentTagAction.getInstance()); - actions.add(ReplaceContentTagAction.getInstance()); + + actions.addAll(DataModelActionsFactory.getActions(tag, false)); + return actions.toArray(new Action[actions.size()]); } diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DataModelActionsFactory.java b/Core/src/org/sleuthkit/autopsy/datamodel/DataModelActionsFactory.java index b4b88463c4..6b4b1c8faf 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DataModelActionsFactory.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DataModelActionsFactory.java @@ -28,8 +28,12 @@ import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.sleuthkit.autopsy.actions.AddBlackboardArtifactTagAction; import org.sleuthkit.autopsy.actions.AddContentTagAction; +import org.sleuthkit.autopsy.actions.DeleteBlackboardArtifactTagAction; +import org.sleuthkit.autopsy.actions.DeleteContentTagAction; import org.sleuthkit.autopsy.actions.DeleteFileBlackboardArtifactTagAction; import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction; +import org.sleuthkit.autopsy.actions.ReplaceBlackboardArtifactTagAction; +import org.sleuthkit.autopsy.actions.ReplaceContentTagAction; import org.sleuthkit.autopsy.coreutils.ContextMenuExtensionPoint; import org.sleuthkit.autopsy.datamodel.Reports.ReportNode; import org.sleuthkit.autopsy.directorytree.ExternalViewerAction; @@ -39,7 +43,9 @@ import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.autopsy.directorytree.ViewContextAction; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardArtifactTag; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.DerivedFile; import org.sleuthkit.datamodel.Directory; import org.sleuthkit.datamodel.File; @@ -351,6 +357,80 @@ public class DataModelActionsFactory { return actionsList; } + public static List getActions(ContentTag contentTag, boolean isArtifactSource) { + + List actionsList = new ArrayList<>(); + actionsList.add(new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), contentTag.getContent())); + final ContentTagNode tagNode = new ContentTagNode(contentTag); + actionsList.add(null); // creates a menu separator + actionsList.add(new NewWindowViewAction(VIEW_IN_NEW_WINDOW, tagNode)); + actionsList.add(new ExternalViewerAction(OPEN_IN_EXTERNAL_VIEWER, tagNode)); + actionsList.add(null); // creates a menu separator + actionsList.add(ExtractAction.getInstance()); + actionsList.add(new HashSearchAction(SEARCH_FOR_FILES_SAME_MD5, tagNode)); + actionsList.add(null); // creates a menu separator + actionsList.add(AddContentTagAction.getInstance()); + if (isArtifactSource) { + actionsList.add(AddBlackboardArtifactTagAction.getInstance()); + } + + final Collection selectedFilesList = + new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); + if(selectedFilesList.size() == 1) { + actionsList.add(DeleteFileContentTagAction.getInstance()); + } + if(isArtifactSource) { + final Collection selectedArtifactsList = + new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class)); + if(selectedArtifactsList.size() == 1) { + actionsList.add(DeleteFileBlackboardArtifactTagAction.getInstance()); + } + } + + actionsList.add(DeleteContentTagAction.getInstance()); + actionsList.add(ReplaceContentTagAction.getInstance()); + + actionsList.addAll(ContextMenuExtensionPoint.getActions()); + return actionsList; + } + + + public static List getActions(BlackboardArtifactTag artifactTag, boolean isArtifactSource) { + List actionsList = new ArrayList<>(); + actionsList.add(new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), artifactTag.getContent())); + final BlackboardArtifactTagNode tagNode = new BlackboardArtifactTagNode(artifactTag); + actionsList.add(null); // creates a menu separator + actionsList.add(new NewWindowViewAction(VIEW_IN_NEW_WINDOW, tagNode)); + actionsList.add(new ExternalViewerAction(OPEN_IN_EXTERNAL_VIEWER, tagNode)); + actionsList.add(null); // creates a menu separator + actionsList.add(ExtractAction.getInstance()); + actionsList.add(new HashSearchAction(SEARCH_FOR_FILES_SAME_MD5, tagNode)); + actionsList.add(null); // creates a menu separator + actionsList.add(AddContentTagAction.getInstance()); + if (isArtifactSource) { + actionsList.add(AddBlackboardArtifactTagAction.getInstance()); + } + + final Collection selectedFilesList = + new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); + if(selectedFilesList.size() == 1) { + actionsList.add(DeleteFileContentTagAction.getInstance()); + } + if(isArtifactSource) { + final Collection selectedArtifactsList = + new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class)); + if(selectedArtifactsList.size() == 1) { + actionsList.add(DeleteFileBlackboardArtifactTagAction.getInstance()); + } + } + + actionsList.add(DeleteBlackboardArtifactTagAction.getInstance()); + actionsList.add(ReplaceBlackboardArtifactTagAction.getInstance()); + + actionsList.addAll(ContextMenuExtensionPoint.getActions()); + return actionsList; + } + public static List getActions(Content content, boolean isArtifactSource) { if (content instanceof File) { return getActions((File) content, isArtifactSource); From c02f503388e4728050eca83f8ab08a8f4b0d4108 Mon Sep 17 00:00:00 2001 From: Raman Date: Wed, 13 Jun 2018 10:27:47 -0400 Subject: [PATCH 7/8] Remove unused imports. --- Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java index 2d8e544375..547303878b 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ContentTagNode.java @@ -29,8 +29,6 @@ import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.actions.DeleteContentTagAction; -import org.sleuthkit.autopsy.actions.ReplaceContentTagAction; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction; import org.sleuthkit.datamodel.AbstractFile; From ebf2cb09d7fd9f60529f6e930e16782b7e87f604 Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 14 Jun 2018 14:43:09 -0400 Subject: [PATCH 8/8] Undoing the accidental commit of branding files. --- .../core.jar/org/netbeans/core/startup/Bundle.properties | 4 ++-- .../org/netbeans/core/windows/view/ui/Bundle.properties | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties index 9a9a904cc5..b1adb5d40b 100644 --- a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties +++ b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties @@ -1,5 +1,5 @@ #Updated by build script -#Tue, 08 May 2018 10:29:55 -0600 +#Mon, 19 Mar 2018 11:17:11 -0700 LBL_splash_window_title=Starting Autopsy SPLASH_HEIGHT=314 SPLASH_WIDTH=538 @@ -8,4 +8,4 @@ SplashRunningTextBounds=0,289,538,18 SplashRunningTextColor=0x0 SplashRunningTextFontSize=19 -currentVersion=Autopsy 4.7.0 +currentVersion=Autopsy 4.6.0 diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties index db3cd01af5..6cb9d4bdea 100644 --- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties +++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties @@ -1,4 +1,4 @@ #Updated by build script -#Tue, 08 May 2018 10:29:55 -0600 -CTL_MainWindow_Title=Autopsy 4.7.0 -CTL_MainWindow_Title_No_Project=Autopsy 4.7.0 +#Fri, 09 Mar 2018 13:03:41 -0700 +CTL_MainWindow_Title=Autopsy 4.6.0 +CTL_MainWindow_Title_No_Project=Autopsy 4.6.0