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;
82 super(node,
new DataResultFilterChildren(node, em));
99 List<Action> actions =
new ArrayList<>();
102 List<Action> accept = originalNode.
accept(getActionsDIV);
103 if (accept != null) {
104 actions.addAll(accept);
108 return actions.toArray(
new Action[actions.size()]);
119 final Node original = this.getOriginal();
125 final DisplayableItemNode originalNode = (DisplayableItemNode) this.getOriginal();
126 return originalNode.
accept(getPreferredActionsDIV);
131 Node.PropertySet[] propertySets = super.getPropertySets();
133 for (
int i = 0; i < propertySets.length; i++) {
134 Node.PropertySet ps = propertySets[i];
136 if (ps.getName().equals(Sheet.PROPERTIES)) {
137 Sheet.Set newPs =
new Sheet.Set();
138 newPs.setName(ps.getName());
139 newPs.setDisplayName(ps.getDisplayName());
140 newPs.setShortDescription(ps.getShortDescription());
142 newPs.put(ps.getProperties());
146 propertySets[i] = newPs;
166 List<Action> actions =
new ArrayList<>();
172 BlackboardArtifact ba = ban.getLookup().lookup(BlackboardArtifact.class);
173 final int artifactTypeID = ba.getArtifactTypeID();
175 if (artifactTypeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()
176 || artifactTypeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
178 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), ban));
185 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), c));
189 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewSrcFileInDir.text"), ban));
191 Content c = ban.getLookup().lookup(File.class);
193 boolean md5Action =
false;
197 }
else if ((c = ban.getLookup().lookup(Directory.class)) != null) {
199 }
else if ((c = ban.getLookup().lookup(VirtualDirectory.class)) != null) {
201 }
else if ((c = ban.getLookup().lookup(LayoutFile.class)) != null) {
203 }
else if ((c = ban.getLookup().lookup(LocalFile.class)) != null
204 || (c = ban.getLookup().lookup(DerivedFile.class)) != null) {
206 }
else if ((c = ban.getLookup().lookup(SlackFile.class)) != null) {
212 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInNewWin.text"), n));
214 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.openInExtViewer.text"), n));
219 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.searchFilesSameMd5.text"), n));
249 List<Action> actions =
new ArrayList<>();
251 for (Action action : ditem.getActions(
true)) {
259 BlackboardArtifact art = ba.getLookup().lookup(BlackboardArtifact.class);
262 for (BlackboardAttribute attr : art.getAttributes()) {
263 if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) {
264 switch (attr.getAttributeType().getValueType()) {
266 int i = attr.getValueInt();
268 c = art.getSleuthkitCase().getContentById(i);
272 long l = attr.getValueLong();
274 c = art.getSleuthkitCase().getContentById(l);
280 }
catch (TskException ex) {
281 Logger.
getLogger(this.getClass().getName()).log(Level.WARNING,
"Error getting linked file", ex);
296 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInDir.text"), ban);
312 if (fn.hasContentChildren()) {
321 if (dfn.hasContentChildren()) {
330 return reportNode.getPreferredAction();
353 private AbstractAction
openChild(
final AbstractNode dataModelNode) {
359 final Node currentSelectionInDirectoryTree = sourceEm.getSelectedNodes()[0];
361 return new AbstractAction() {
363 public void actionPerformed(ActionEvent e) {
364 if (currentSelectionInDirectoryTree != null) {
366 final org.openide.nodes.Children children = currentSelectionInDirectoryTree.getChildren();
368 Node newSelection = children.findChild(dataModelNode.getName());
377 if (newSelection != null) {
379 sourceEm.setExploredContextAndSelection(newSelection,
new Node[]{newSelection});
380 }
catch (PropertyVetoException ex) {
382 logger.log(Level.WARNING,
"Error: can't open the selected directory.", ex);
400 Node[] selectedFilterNodes = sourceEm.getSelectedNodes();
401 Node selectedFilterNode = selectedFilterNodes[0];
402 final Node parentNode = selectedFilterNode.getParentNode();
404 return new AbstractAction() {
406 public void actionPerformed(ActionEvent e) {
408 sourceEm.setSelectedNodes(
new Node[]{parentNode});
409 }
catch (PropertyVetoException ex) {
411 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(FileTypesNode fileTypes)
AbstractAction visit(FileNode fn)
synchronized static Logger getLogger(String name)
AbstractAction visit(DirectoryNode dn)
static synchronized AddContentTagAction getInstance()