mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #6809 from wschaeferB/7312-DisableContentViewers-2
7312 disable content viewers 2
This commit is contained in:
commit
21f64e18de
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -113,19 +114,31 @@ class ArtifactMenuMouseAdapter extends java.awt.event.MouseAdapter {
|
||||
*
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
@NbBundle.Messages({"ArtifactMenuMouseAdapter.noFile.text=File does not exist."})
|
||||
private JMenuItem[] getMenuItems(BlackboardArtifact artifact) throws TskCoreException {
|
||||
List<JMenuItem> menuItems = new ArrayList<>();
|
||||
BlackboardAttribute pathIdAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
|
||||
long contentId;
|
||||
Long contentId;
|
||||
if (pathIdAttr != null) {
|
||||
contentId = pathIdAttr.getValueLong();
|
||||
} else {
|
||||
} else if (artifact.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID() && artifact.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) {
|
||||
contentId = artifact.getObjectID();
|
||||
} else {
|
||||
contentId = null;
|
||||
JMenuItem noFile = new JMenuItem();
|
||||
noFile.setText(Bundle.ArtifactMenuMouseAdapter_noFile_text());
|
||||
noFile.setEnabled(false);
|
||||
noFile.setForeground(Color.RED);
|
||||
menuItems.add(noFile);
|
||||
}
|
||||
Content content = artifact.getSleuthkitCase().getContentById(contentId);
|
||||
menuItems.addAll(getTimelineMenuItems(artifact));
|
||||
menuItems.addAll(getDataModelActionFactoryMenuItems(artifact, content));
|
||||
menuItems.add(DeleteFileContentTagAction.getInstance().getMenuForFiles(Arrays.asList((AbstractFile) content)));
|
||||
if (contentId != null) {
|
||||
Content content = artifact.getSleuthkitCase().getContentById(contentId);
|
||||
menuItems.addAll(getDataModelActionFactoryMenuItems(artifact, content));
|
||||
menuItems.add(DeleteFileContentTagAction.getInstance().getMenuForFiles(Arrays.asList((AbstractFile) content)));
|
||||
} else {
|
||||
menuItems.add(AddBlackboardArtifactTagAction.getInstance().getMenuForContent(Arrays.asList(artifact)));
|
||||
}
|
||||
menuItems.add(DeleteFileBlackboardArtifactTagAction.getInstance().getMenuForArtifacts(Arrays.asList(artifact)));
|
||||
return menuItems.toArray(new JMenuItem[0]);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
ArtifactMenuMouseAdapter.noFile.text=File does not exist.
|
||||
ArtifactMenuMouseAdapter_ExternalViewer_label=Open in external viewer
|
||||
ArtifactMenuMouseAdapter_label=Extract Files
|
||||
ArtifactsListPanel.dateColumn.name=Date/Time
|
||||
|
@ -18,11 +18,15 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.discovery.ui;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataContentPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Details panel for displaying the collection of content viewers.
|
||||
@ -31,6 +35,7 @@ final class ContentViewerDetailsPanel extends AbstractArtifactDetailsPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final DataContentPanel contentViewer = DataContentPanel.createInstance();
|
||||
private final static Logger logger = Logger.getLogger(ContentViewerDetailsPanel.class.getName());
|
||||
|
||||
/**
|
||||
* Creates new form ContentViewerDetailsPanel
|
||||
@ -61,7 +66,17 @@ final class ContentViewerDetailsPanel extends AbstractArtifactDetailsPanel {
|
||||
if (artifact != null) {
|
||||
boolean useAssociatedFile = artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()
|
||||
|| artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID();
|
||||
node = new BlackboardArtifactNode(artifact, useAssociatedFile);
|
||||
BlackboardAttribute pathIdAttr = null;
|
||||
if (useAssociatedFile) {
|
||||
try {
|
||||
pathIdAttr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Error getting Path ID Attribute for artifact with ID: " + artifact.getArtifactID(), ex);
|
||||
}
|
||||
}
|
||||
if (!useAssociatedFile || pathIdAttr != null) {
|
||||
node = new BlackboardArtifactNode(artifact, useAssociatedFile);
|
||||
}
|
||||
}
|
||||
contentViewer.setNode(node);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user