19 package org.sleuthkit.autopsy.directorytree;
21 import java.awt.event.ActionEvent;
22 import java.beans.PropertyVetoException;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.logging.Level;
26 import javax.swing.AbstractAction;
27 import javax.swing.Action;
28 import org.openide.explorer.ExplorerManager;
29 import org.openide.nodes.AbstractNode;
30 import org.openide.nodes.FilterNode;
31 import org.openide.nodes.Node;
32 import org.openide.nodes.Sheet;
33 import org.openide.util.NbBundle;
79 super(node,
new DataResultFilterChildren(node, em));
96 List<Action> actions =
new ArrayList<>();
99 List<Action> accept = originalNode.
accept(getActionsDIV);
100 if (accept != null) {
101 actions.addAll(accept);
105 return actions.toArray(
new Action[actions.size()]);
116 final Node original = this.getOriginal();
122 final DisplayableItemNode originalNode = (DisplayableItemNode) this.getOriginal();
123 return originalNode.
accept(getPreferredActionsDIV);
128 Node.PropertySet[] propertySets = super.getPropertySets();
130 for (
int i = 0; i < propertySets.length; i++) {
131 Node.PropertySet ps = propertySets[i];
133 if (ps.getName().equals(Sheet.PROPERTIES)) {
134 Sheet.Set newPs =
new Sheet.Set();
135 newPs.setName(ps.getName());
136 newPs.setDisplayName(ps.getDisplayName());
137 newPs.setShortDescription(ps.getShortDescription());
139 newPs.put(ps.getProperties());
143 propertySets[i] = newPs;
163 List<Action> actions =
new ArrayList<>();
169 BlackboardArtifact ba = ban.getLookup().lookup(BlackboardArtifact.class);
170 final int artifactTypeID = ba.getArtifactTypeID();
172 if (artifactTypeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()
173 || artifactTypeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
175 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), ban));
182 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), c));
186 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewSrcFileInDir.text"), ban));
188 Content c = ban.getLookup().lookup(File.class);
190 boolean md5Action =
false;
194 }
else if ((c = ban.getLookup().lookup(Directory.class)) != null) {
196 }
else if ((c = ban.getLookup().lookup(VirtualDirectory.class)) != null) {
198 }
else if ((c = ban.getLookup().lookup(LayoutFile.class)) != null) {
200 }
else if ((c = ban.getLookup().lookup(LocalFile.class)) != null
201 || (c = ban.getLookup().lookup(DerivedFile.class)) != null) {
207 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInNewWin.text"), n));
209 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.openInExtViewer.text"), n));
214 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.searchFilesSameMd5.text"), n));
238 List<Action> actions =
new ArrayList<>();
240 for (Action action : ditem.getActions(
true)) {
248 BlackboardArtifact art = ba.getLookup().lookup(BlackboardArtifact.class);
251 for (BlackboardAttribute attr : art.getAttributes()) {
252 if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) {
253 switch (attr.getAttributeType().getValueType()) {
255 int i = attr.getValueInt();
257 c = art.getSleuthkitCase().getContentById(i);
261 long l = attr.getValueLong();
263 c = art.getSleuthkitCase().getContentById(l);
269 }
catch (TskException ex) {
270 Logger.
getLogger(this.getClass().getName()).log(Level.WARNING,
"Error getting linked file", ex);
284 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInDir.text"), ban);
300 if (fn.hasContentChildren()) {
309 if (dfn.hasContentChildren()) {
318 return reportNode.getPreferredAction();
334 private AbstractAction
openChild(
final AbstractNode dataModelNode) {
340 final Node currentSelectionInDirectoryTree = sourceEm.getSelectedNodes()[0];
342 return new AbstractAction() {
344 public void actionPerformed(ActionEvent e) {
345 if (currentSelectionInDirectoryTree != null) {
347 final org.openide.nodes.Children children = currentSelectionInDirectoryTree.getChildren();
349 Node newSelection = children.findChild(dataModelNode.getName());
358 if (newSelection != null) {
360 sourceEm.setExploredContextAndSelection(newSelection,
new Node[]{newSelection});
361 }
catch (PropertyVetoException ex) {
363 logger.log(Level.WARNING,
"Error: can't open the selected directory.", ex);
381 Node[] selectedFilterNodes = sourceEm.getSelectedNodes();
382 Node selectedFilterNode = selectedFilterNodes[0];
383 final Node parentNode = selectedFilterNode.getParentNode();
385 return new AbstractAction() {
387 public void actionPerformed(ActionEvent e) {
389 sourceEm.setSelectedNodes(
new Node[]{parentNode});
390 }
catch (PropertyVetoException ex) {
392 logger.log(Level.WARNING,
"Error: can't open the parent directory.", ex);
AbstractAction openChild(final AbstractNode dataModelNode)
AbstractAction defaultVisit(DisplayableItemNode c)
AbstractAction visit(BlackboardArtifactNode ban)
static final String DOTDIR
DataResultFilterNode(Node node, ExplorerManager em)
Node.PropertySet[] getPropertySets()
static final String DOTDOTDIR
final DisplayableItemNodeVisitor< List< Action > > getActionsDIV
static synchronized AddBlackboardArtifactTagAction getInstance()
abstract< T > T accept(DisplayableItemNodeVisitor< T > v)
AbstractAction visit(Reports.ReportNode reportNode)
Action[] getActions(boolean context)
AbstractAction visit(LocalFileNode dfn)
static final String HIDE_PARENT
Action getPreferredAction()
AbstractAction openParent(AbstractNode node)
final DisplayableItemNodeVisitor< AbstractAction > getPreferredActionsDIV
Action[] getActions(boolean popup)
AbstractAction visit(FileNode fn)
synchronized static Logger getLogger(String name)
AbstractAction visit(DirectoryNode dn)
static synchronized AddContentTagAction getInstance()