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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.List;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Utilities;
|
||||
import org.openide.util.NbBundle;
|
||||
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.TskCoreException;
|
||||
|
||||
public class BookmarkFileAction extends AbstractAction {
|
||||
class BookmarkFileAction extends AbstractAction {
|
||||
|
||||
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
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
TagName tagName = null;
|
||||
try {
|
||||
tagName = Case.getCurrentCase().getServices().getTagsManager().addTagName(BOOKMARK);
|
||||
} catch (TagsManager.TagNameAlreadyExistsException ex) {
|
||||
try {
|
||||
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 {
|
||||
List<TagName> tagNames = Case.getCurrentCase().getServices().getTagsManager().getPredefinedTagNames();
|
||||
for (TagName tagName : tagNames) {
|
||||
if (tagName.getDisplayName().equals(BOOKMARK)) {
|
||||
AddContentTagAction.getInstance().addTag(tagName, NO_COMMENT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ AddTagAction.quickTag=Quick Tag
|
||||
AddTagAction.noTags=No tags
|
||||
AddTagAction.newTag=New Tag...
|
||||
AddTagAction.tagAndComment=Tag and Comment...
|
||||
BookmarkFileAction.bookmark.text=Bookmark
|
||||
DeleteBlackboardArtifactTagAction.deleteTags=Delete Tag(s)
|
||||
DeleteBlackboardArtifactTagAction.unableToDelTag.msg=Unable to delete tag {0}.
|
||||
DeleteBlackboardArtifactTagAction.tagDelErr=Tag Deletion Error
|
||||
|
@ -94,16 +94,6 @@ public class TagsManager implements Closeable {
|
||||
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.
|
||||
*
|
||||
@ -683,11 +673,4 @@ public class TagsManager implements Closeable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
public static class TagNameDoesNotExistException extends Exception {
|
||||
|
||||
public TagNameDoesNotExistException() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user