mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-18 02:27:42 +00:00
Updated BookmarkFileAction to work with new version of TagsManager
This commit is contained in:
parent
83afd06486
commit
e8c8d6c8d3
@ -20,25 +20,35 @@ package org.sleuthkit.autopsy.actions;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
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.TagName;
|
import org.sleuthkit.datamodel.TagName;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
class BookmarkFileAction extends AbstractAction {
|
public class BookmarkFileAction extends AbstractAction {
|
||||||
|
|
||||||
private static final String NO_COMMENT = "";
|
private static final String NO_COMMENT = "";
|
||||||
private static final String BOOKMARK = NbBundle.getMessage(BookmarkFileAction.class, "BookmarkFileAction.bookmark.text");
|
private static final String BOOKMARK = NbBundle.getMessage(BookmarkFileAction.class, "BookmarkFileAction.bookmark.text");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Map<String, TagName> tagNamesMap = Case.getCurrentCase().getServices().getTagsManager().getPredefinedTagNamesMap();
|
Map<String, TagName> tagNamesMap = null;
|
||||||
for (Map.Entry<String, TagName> entry : tagNamesMap.entrySet()) {
|
try {
|
||||||
if (entry.getKey().equals(BOOKMARK)) {
|
tagNamesMap = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap();
|
||||||
AddContentTagAction.getInstance().addTag(entry.getValue(), NO_COMMENT);
|
TagName bookmarkTagName = tagNamesMap.get(BOOKMARK);
|
||||||
return;
|
if (bookmarkTagName == null) {
|
||||||
}
|
bookmarkTagName = Case.getCurrentCase().getServices().getTagsManager().addTagName(BOOKMARK);
|
||||||
}
|
}
|
||||||
|
AddContentTagAction.getInstance().addTag(bookmarkTagName, NO_COMMENT);
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
Logger.getLogger(BookmarkFileAction.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||||
|
} catch (TagsManager.TagNameAlreadyExistsException ex) {
|
||||||
|
Logger.getLogger(BookmarkFileAction.class.getName()).log(Level.SEVERE, BOOKMARK + " already exists in database.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user