diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java index aef2d79530..cff35af7c1 100755 --- a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java @@ -19,15 +19,19 @@ package org.sleuthkit.autopsy.actions; import java.util.Collection; +import java.util.List; import java.util.logging.Level; import javax.swing.JOptionPane; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; @@ -109,8 +113,22 @@ public class AddContentTagAction extends AddTagAction { continue; } } - - Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment); + // check if the same tag is being added for the same abstract file. + TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); + List contentTagList = tagsManager.getContentTagsByContent(file); + for (ContentTag contentTag : contentTagList) { + if (contentTag.getName().getDisplayName().equals(tagName.getDisplayName())) { + JOptionPane.showMessageDialog(null, + NbBundle.getMessage(this.getClass(), + "AddContentTagAction.tagExists", + file.getName(), tagName.getDisplayName()), + NbBundle.getMessage(this.getClass(), + "AddContentTagAction.cannotApplyTagErr"), + JOptionPane.WARNING_MESSAGE); + return; + } + } + tagsManager.addContentTag(file, tagName, comment); } catch (TskCoreException ex) { Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/actions/Bundle.properties b/Core/src/org/sleuthkit/autopsy/actions/Bundle.properties index 6c3e5ce690..ca5c8b3174 100755 --- a/Core/src/org/sleuthkit/autopsy/actions/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/actions/Bundle.properties @@ -24,6 +24,7 @@ AddContentTagAction.unableToTag.msg=Unable to tag {0}, not a regular file. AddContentTagAction.cannotApplyTagErr=Cannot Apply Tag AddContentTagAction.unableToTag.msg2=Unable to tag {0}. AddContentTagAction.taggingErr=Tagging Error +AddContentTagAction.tagExists={0} has been tagged as {1}. Cannot reapply the same tag. AddTagAction.quickTag=Quick Tag AddTagAction.noTags=No tags AddTagAction.newTag=New Tag...