@SuppressWarnings("deprecation") protected void initialize() { followUpToggle.setOnAction( (ActionEvent t) -> { if (followUpToggle.isSelected() == true) { globalSelectionModel.clearAndSelect(fileID); try { AddDrawableTagAction.getInstance().addTag(TagUtils.getFollowUpTagName(), ""); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to add follow up tag. Could not load TagName.", ex); } } else { // TODO: convert this to an action! final ImageGalleryController controller = ImageGalleryController.getDefault(); try { // remove file from old category group controller .getGroupManager() .removeFromGroup( new GroupKey<TagName>(DrawableAttribute.TAGS, TagUtils.getFollowUpTagName()), fileID); List<ContentTag> contentTagsByContent = Case.getCurrentCase() .getServices() .getTagsManager() .getContentTagsByContent(file); for (ContentTag ct : contentTagsByContent) { if (ct.getName() .getDisplayName() .equals(TagUtils.getFollowUpTagName().getDisplayName())) { Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(ct); } } IngestServices.getInstance() .fireModuleDataEvent( new ModuleDataEvent( "TagAction", BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)); // NON-NLS controller .getGroupManager() .handleFileUpdate( FileUpdateEvent.newUpdateEvent( Collections.singleton(fileID), DrawableAttribute.TAGS)); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to delete follow up tag.", ex); } } }); }
protected boolean hasFollowUp() throws TskCoreException { String followUpTagName = TagUtils.getFollowUpTagName().getDisplayName(); Collection<TagName> tagNames = DrawableAttribute.TAGS.getValue(getFile()); return tagNames.stream().anyMatch((tn) -> tn.getDisplayName().equals(followUpTagName)); }