@Override public synchronized void setFile(final Long fileID) { if (Objects.equals(fileID, this.fileID) == false) { this.fileID = fileID; disposeContent(); if (this.fileID == null || Case.isCaseOpen() == false) { if (registered == true) { ImageGalleryController.getDefault().getCategoryManager().unregisterListener(this); TagUtils.unregisterListener(this); registered = false; } file = null; Platform.runLater( () -> { clearContent(); }); } else { if (registered == false) { ImageGalleryController.getDefault().getCategoryManager().registerListener(this); TagUtils.registerListener(this); registered = true; } file = null; getFile(); updateSelectionState(); updateCategoryBorder(); updateFollowUpIcon(); updateUI(); Platform.runLater(getContentUpdateRunnable()); } } }
@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); } } }); }
@Override public DrawableFile<?> getFile() { if (fileID != null) { if (file == null || file.getId() != fileID) { try { file = ImageGalleryController.getDefault().getFileFromId(fileID); } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "failed to get DrawableFile for obj_id" + fileID, ex); file = null; } } return file; } else { return null; } }