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 java.util.prefs.PreferenceChangeEvent;
27 import java.util.prefs.PreferenceChangeListener;
28 import javax.swing.AbstractAction;
29 import javax.swing.Action;
30 import org.openide.explorer.ExplorerManager;
31 import org.openide.nodes.AbstractNode;
32 import org.openide.nodes.FilterNode;
33 import org.openide.nodes.Node;
34 import org.openide.nodes.Sheet;
35 import org.openide.util.NbBundle;
82 public void preferenceChange(PreferenceChangeEvent evt) {
83 switch (evt.getKey()) {
138 List<Action> actions =
new ArrayList<>();
141 List<Action> accept = originalNode.
accept(getActionsDIV);
142 if (accept != null) {
143 actions.addAll(accept);
147 return actions.toArray(
new Action[actions.size()]);
158 final Node original = this.getOriginal();
164 final DisplayableItemNode originalNode = (DisplayableItemNode) this.getOriginal();
165 return originalNode.
accept(getPreferredActionsDIV);
170 Node.PropertySet[] propertySets = super.getPropertySets();
172 for (
int i = 0; i < propertySets.length; i++) {
173 Node.PropertySet ps = propertySets[i];
175 if (ps.getName().equals(Sheet.PROPERTIES)) {
176 Sheet.Set newPs =
new Sheet.Set();
177 newPs.setName(ps.getName());
178 newPs.setDisplayName(ps.getDisplayName());
179 newPs.setShortDescription(ps.getShortDescription());
181 newPs.put(ps.getProperties());
185 propertySets[i] = newPs;
209 switch (SelectionContext.getSelectionContext(arg)) {
263 List<Action> actions =
new ArrayList<>();
275 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), ban));
282 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewFileInDir.text"), c));
286 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewSrcFileInDir.text"), ban));
290 boolean md5Action =
false;
294 }
else if ((c = ban.getLookup().lookup(
Directory.class)) != null) {
298 }
else if ((c = ban.getLookup().lookup(
LayoutFile.class)) != null) {
300 }
else if ((c = ban.getLookup().lookup(
LocalFile.class)) != null
301 || (c = ban.getLookup().lookup(
DerivedFile.class)) != null) {
303 }
else if ((c = ban.getLookup().lookup(
SlackFile.class)) != null) {
309 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInNewWin.text"), n));
311 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.openInExtViewer.text"), n));
316 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.searchFilesSameMd5.text"), n));
346 List<Action> actions =
new ArrayList<>();
348 for (Action action : ditem.getActions(
true)) {
361 switch (attr.getAttributeType().getValueType()) {
363 int i = attr.getValueInt();
369 long l = attr.getValueLong();
378 Logger.
getLogger(this.getClass().getName()).log(Level.WARNING,
"Error getting linked file", ex);
393 NbBundle.getMessage(
this.getClass(),
"DataResultFilterNode.action.viewInDir.text"), ban);
409 if (fn.hasContentChildren()) {
418 if (dfn.hasContentChildren()) {
427 return reportNode.getPreferredAction();
450 private AbstractAction
openChild(
final AbstractNode dataModelNode) {
456 final Node currentSelectionInDirectoryTree = sourceEm.getSelectedNodes()[0];
458 return new AbstractAction() {
460 public void actionPerformed(ActionEvent e) {
461 if (currentSelectionInDirectoryTree != null) {
463 final org.openide.nodes.Children children = currentSelectionInDirectoryTree.getChildren();
465 Node newSelection = children.findChild(dataModelNode.getName());
474 if (newSelection != null) {
476 sourceEm.setExploredContextAndSelection(newSelection,
new Node[]{newSelection});
477 }
catch (PropertyVetoException ex) {
479 logger.log(Level.WARNING,
"Error: can't open the selected directory.", ex);
497 Node[] selectedFilterNodes = sourceEm.getSelectedNodes();
498 Node selectedFilterNode = selectedFilterNodes[0];
499 final Node parentNode = selectedFilterNode.getParentNode();
501 return new AbstractAction() {
503 public void actionPerformed(ActionEvent e) {
505 sourceEm.setSelectedNodes(
new Node[]{parentNode});
506 }
catch (PropertyVetoException ex) {
508 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
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
static final String HIDE_KNOWN_FILES_IN_VIEWS_TREE
static boolean filterKnownFromDataSources
DataResultFilterNode(Node node, ExplorerManager em)
Node.PropertySet[] getPropertySets()
static boolean hideSlackFilesInDataSourcesTree()
static final String DOTDOTDIR
static final DisplayableItemNodeVisitor< List< Action > > getActionsDIV
static synchronized AddBlackboardArtifactTagAction getInstance()
TskData.TSK_DB_FILES_TYPE_ENUM getType()
DataResultFilterChildren(Node arg, ExplorerManager sourceEm)
DataResultFilterChildren(Node arg, ExplorerManager sourceEm, boolean filterKnown, boolean filterSlack)
Content getContentById(long id)
SleuthkitCase getSleuthkitCase()
abstract< T > T accept(DisplayableItemNodeVisitor< T > v)
AbstractAction visit(Reports.ReportNode reportNode)
static boolean filterKnownFromViews
static boolean hideKnownFilesInViewsTree()
static final String HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE
Action[] getActions(boolean context)
static boolean filterSlackFromViews
AbstractAction visit(LocalFileNode dfn)
TskData.FileKnown getKnown()
static final String HIDE_PARENT
Action getPreferredAction()
final ExplorerManager sourceEm
AbstractAction openParent(AbstractNode node)
final DisplayableItemNodeVisitor< AbstractAction > getPreferredActionsDIV
Action[] getActions(boolean popup)
static boolean hideSlackFilesInViewsTree()
static final String HIDE_SLACK_FILES_IN_DATA_SRCS_TREE
AbstractAction visit(FileTypesNode fileTypes)
List< BlackboardAttribute > getAttributes()
static boolean hideKnownFilesInDataSourcesTree()
AbstractAction visit(FileNode fn)
synchronized static Logger getLogger(String name)
static void addChangeListener(PreferenceChangeListener listener)
AbstractAction visit(DirectoryNode dn)
static boolean filterSlackFromDataSources
Node[] createNodes(Node key)
static synchronized AddContentTagAction getInstance()
final ExplorerManager sourceEm
DataResultFilterNode(Node node, ExplorerManager em, boolean filterKnown, boolean filterSlack)