mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Got rid of unnecessary methods and code
This commit is contained in:
parent
708e2f641c
commit
1009514a05
@ -6,39 +6,25 @@
|
|||||||
package org.sleuthkit.autopsy.actions;
|
package org.sleuthkit.autopsy.actions;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.util.Collection;
|
import java.util.List;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.Utilities;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
|
||||||
import org.sleuthkit.datamodel.TagName;
|
import org.sleuthkit.datamodel.TagName;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
|
||||||
|
|
||||||
public class BookmarkFileAction extends AbstractAction {
|
class BookmarkFileAction extends AbstractAction {
|
||||||
|
|
||||||
private static final String NO_COMMENT = "";
|
private static final String NO_COMMENT = "";
|
||||||
private static final String BOOKMARK = "Bookmark";
|
private static final String BOOKMARK = NbBundle.getMessage(BookmarkFileAction.class, "BookmarkFileAction.bookmark.text");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
TagName tagName = null;
|
List<TagName> tagNames = Case.getCurrentCase().getServices().getTagsManager().getPredefinedTagNames();
|
||||||
try {
|
for (TagName tagName : tagNames) {
|
||||||
tagName = Case.getCurrentCase().getServices().getTagsManager().addTagName(BOOKMARK);
|
if (tagName.getDisplayName().equals(BOOKMARK)) {
|
||||||
} catch (TagsManager.TagNameAlreadyExistsException ex) {
|
AddContentTagAction.getInstance().addTag(tagName, NO_COMMENT);
|
||||||
try {
|
return;
|
||||||
tagName = Case.getCurrentCase().getServices().getTagsManager().getTagName(BOOKMARK);
|
|
||||||
} catch (TagsManager.TagNameDoesNotExistException ex1) {
|
|
||||||
// already confirmed that tag name does exist
|
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
Logger.getLogger(BookmarkFileAction.class.getName()).log(Level.SEVERE, "Error tagging file", ex); //NON-NLS
|
|
||||||
} finally {
|
|
||||||
AddContentTagAction.getInstance().addTag(tagName, NO_COMMENT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ AddTagAction.quickTag=Quick Tag
|
|||||||
AddTagAction.noTags=No tags
|
AddTagAction.noTags=No tags
|
||||||
AddTagAction.newTag=New Tag...
|
AddTagAction.newTag=New Tag...
|
||||||
AddTagAction.tagAndComment=Tag and Comment...
|
AddTagAction.tagAndComment=Tag and Comment...
|
||||||
|
BookmarkFileAction.bookmark.text=Bookmark
|
||||||
DeleteBlackboardArtifactTagAction.deleteTags=Delete Tag(s)
|
DeleteBlackboardArtifactTagAction.deleteTags=Delete Tag(s)
|
||||||
DeleteBlackboardArtifactTagAction.unableToDelTag.msg=Unable to delete tag {0}.
|
DeleteBlackboardArtifactTagAction.unableToDelTag.msg=Unable to delete tag {0}.
|
||||||
DeleteBlackboardArtifactTagAction.tagDelErr=Tag Deletion Error
|
DeleteBlackboardArtifactTagAction.tagDelErr=Tag Deletion Error
|
||||||
|
@ -94,16 +94,6 @@ public class TagsManager implements Closeable {
|
|||||||
return caseDb.getTagNamesInUse();
|
return caseDb.getTagNamesInUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized TagName getTagName(String tagDisplayName) throws TagNameDoesNotExistException {
|
|
||||||
lazyLoadExistingTagNames();
|
|
||||||
if (tagNameExists(tagDisplayName)) {
|
|
||||||
return uniqueTagNames.get(tagDisplayName);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new TagNameDoesNotExistException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a tag name with a given display name exists.
|
* Checks whether a tag name with a given display name exists.
|
||||||
*
|
*
|
||||||
@ -683,11 +673,4 @@ public class TagsManager implements Closeable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TagNameDoesNotExistException extends Exception {
|
|
||||||
|
|
||||||
public TagNameDoesNotExistException() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user