19 package org.sleuthkit.autopsy.directorytree;
21 import java.awt.Cursor;
22 import java.awt.EventQueue;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
25 import java.beans.PropertyVetoException;
26 import java.io.IOException;
27 import java.util.ArrayList;
28 import java.util.Arrays;
29 import java.util.EnumSet;
30 import java.util.LinkedList;
31 import java.util.List;
33 import java.util.Objects;
34 import java.util.concurrent.ExecutionException;
35 import java.util.logging.Level;
36 import java.util.prefs.PreferenceChangeEvent;
37 import java.util.prefs.PreferenceChangeListener;
38 import javax.swing.Action;
39 import javax.swing.SwingUtilities;
40 import javax.swing.SwingWorker;
41 import javax.swing.event.PopupMenuEvent;
42 import javax.swing.event.PopupMenuListener;
43 import javax.swing.event.TreeExpansionEvent;
44 import javax.swing.event.TreeExpansionListener;
45 import javax.swing.tree.TreeSelectionModel;
46 import org.apache.commons.lang3.StringUtils;
47 import org.openide.explorer.ExplorerManager;
48 import org.openide.explorer.ExplorerUtils;
49 import org.openide.explorer.view.BeanTreeView;
50 import org.openide.explorer.view.Visualizer;
51 import org.openide.nodes.AbstractNode;
52 import org.openide.nodes.Children;
53 import org.openide.nodes.Node;
54 import org.openide.nodes.NodeNotFoundException;
55 import org.openide.nodes.NodeOp;
56 import org.openide.util.NbBundle;
57 import org.openide.util.NbBundle.Messages;
58 import org.openide.windows.TopComponent;
59 import org.openide.windows.WindowManager;
99 "DirectoryTreeTopComponent.resultsView.title=Listing"
101 @SuppressWarnings(
"PMD.SingularField")
104 private final transient ExplorerManager em =
new ExplorerManager();
110 private static final String PREFERRED_ID =
"DirectoryTreeTopComponent";
116 private static final long DEFAULT_DATASOURCE_GROUPING_THRESHOLD = 5;
117 private static final String GROUPING_THRESHOLD_NAME =
"GroupDataSourceThreshold";
118 private static final String SETTINGS_FILE =
"CasePreferences.properties";
127 getTree().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
130 ((ExpansionBeanTreeView) getTree()).addTreeExpansionListener(
new TreeExpansionListener() {
132 public void treeExpanded(TreeExpansionEvent event) {
139 Node expandedNode = Visualizer.findNode(event.getPath().getLastPathComponent());
140 for (Node child : em.getRootContext().getChildren().getNodes()) {
141 if (child.equals(expandedNode)) {
142 preExpandNodes(child.getChildren());
148 public void treeCollapsed(TreeExpansionEvent event) {
154 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
158 subscribeToChangeEvents();
159 associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
162 this.backList =
new LinkedList<>();
163 this.forwardList =
new LinkedList<>();
164 backButton.setEnabled(
false);
165 forwardButton.setEnabled(
false);
167 viewPreferencesPopupMenu.add(viewPreferencesPanel);
168 viewPreferencesPopupMenu.setSize(viewPreferencesPanel.getPreferredSize().width + 6, viewPreferencesPanel.getPreferredSize().height + 6);
169 viewPreferencesPopupMenu.addPopupMenuListener(
new PopupMenuListener() {
171 public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
172 openViewPreferencesButton.setSelected(
true);
176 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
177 openViewPreferencesButton.setSelected(
false);
181 public void popupMenuCanceled(PopupMenuEvent e) {
182 openViewPreferencesButton.setSelected(
false);
194 BeanTreeView tree = getTree();
197 if (!Objects.isNull(results)) {
198 tree.expandNode(results);
199 Children resultsChildren = results.getChildren();
200 Arrays.stream(resultsChildren.getNodes()).forEach(tree::expandNode);
204 if (!Objects.isNull(views)) {
205 tree.expandNode(views);
215 public void preferenceChange(PreferenceChangeEvent evt) {
216 switch (evt.getKey()) {
224 refreshContentTreeSafe();
232 refreshContentTreeSafe();
239 this.em.addPropertyChangeListener(
this);
243 this.dataResult.requestActive();
247 this.dataResult.
open();
251 return this.dataResult;
260 return showRejectedResults;
270 this.showRejectedResults = showRejectedResults;
271 if (accounts != null) {
284 viewPreferencesPopupMenu =
new javax.swing.JPopupMenu();
285 treeView =
new ExpansionBeanTreeView();
286 backButton =
new javax.swing.JButton();
287 forwardButton =
new javax.swing.JButton();
288 openViewPreferencesButton =
new javax.swing.JButton();
290 treeView.setBorder(null);
292 backButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back.png")));
293 org.openide.awt.Mnemonics.setLocalizedText(backButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.backButton.text"));
294 backButton.setBorderPainted(
false);
295 backButton.setContentAreaFilled(
false);
296 backButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_disabled.png")));
297 backButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
298 backButton.setMaximumSize(
new java.awt.Dimension(55, 100));
299 backButton.setMinimumSize(
new java.awt.Dimension(5, 5));
300 backButton.setPreferredSize(
new java.awt.Dimension(24, 24));
301 backButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_hover.png")));
302 backButton.addActionListener(
new java.awt.event.ActionListener() {
303 public void actionPerformed(java.awt.event.ActionEvent evt) {
304 backButtonActionPerformed(evt);
308 forwardButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward.png")));
309 org.openide.awt.Mnemonics.setLocalizedText(forwardButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.forwardButton.text"));
310 forwardButton.setBorderPainted(
false);
311 forwardButton.setContentAreaFilled(
false);
312 forwardButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_disabled.png")));
313 forwardButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
314 forwardButton.setMaximumSize(
new java.awt.Dimension(55, 100));
315 forwardButton.setMinimumSize(
new java.awt.Dimension(5, 5));
316 forwardButton.setPreferredSize(
new java.awt.Dimension(24, 24));
317 forwardButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_hover.png")));
318 forwardButton.addActionListener(
new java.awt.event.ActionListener() {
319 public void actionPerformed(java.awt.event.ActionEvent evt) {
320 forwardButtonActionPerformed(evt);
324 openViewPreferencesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/view-preferences-23.png")));
325 org.openide.awt.Mnemonics.setLocalizedText(openViewPreferencesButton,
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class,
"DirectoryTreeTopComponent.openViewPreferencesButton.text"));
326 openViewPreferencesButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
327 openViewPreferencesButton.setBorderPainted(
false);
328 openViewPreferencesButton.setContentAreaFilled(
false);
329 openViewPreferencesButton.setMaximumSize(
new java.awt.Dimension(24, 24));
330 openViewPreferencesButton.setMinimumSize(
new java.awt.Dimension(24, 24));
331 openViewPreferencesButton.setPreferredSize(
new java.awt.Dimension(24, 24));
332 openViewPreferencesButton.addActionListener(
new java.awt.event.ActionListener() {
333 public void actionPerformed(java.awt.event.ActionEvent evt) {
334 openViewPreferencesButtonActionPerformed(evt);
338 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
339 this.setLayout(layout);
340 layout.setHorizontalGroup(
341 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
342 .addComponent(treeView)
343 .addGroup(layout.createSequentialGroup()
345 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
346 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
347 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
348 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
349 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
352 layout.setVerticalGroup(
353 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
354 .addGroup(layout.createSequentialGroup()
356 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
357 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
358 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
359 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
360 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
361 .addComponent(treeView, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
367 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
370 String[] currentNodePath = backList.pollLast();
371 forwardList.addLast(currentNodePath);
372 forwardButton.setEnabled(
true);
379 String[] newCurrentNodePath = backList.peekLast();
382 if (backList.size() > 1) {
383 backButton.setEnabled(
true);
385 backButton.setEnabled(
false);
389 setSelectedNode(newCurrentNodePath, null);
391 this.setCursor(null);
396 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
398 String[] newCurrentNodePath = forwardList.pollLast();
399 if (!forwardList.isEmpty()) {
400 forwardButton.setEnabled(
true);
402 forwardButton.setEnabled(
false);
405 backList.addLast(newCurrentNodePath);
406 backButton.setEnabled(
true);
409 setSelectedNode(newCurrentNodePath, null);
411 this.setCursor(null);
415 viewPreferencesPanel.
load();
416 viewPreferencesPopupMenu.show(openViewPreferencesButton, 0, openViewPreferencesButton.getHeight() - 1);
436 if (instance == null) {
449 WindowManager winManager = WindowManager.
getDefault();
450 TopComponent win = winManager.findTopComponent(PREFERRED_ID);
453 "Cannot find " + PREFERRED_ID +
" component. It will not be located properly in the window system.");
457 return (DirectoryTreeTopComponent) win;
460 "There seem to be multiple components with the '" + PREFERRED_ID
461 +
"' ID. That is a potential source of errors and unexpected behavior.");
473 return TopComponent.PERSISTENCE_NEVER;
484 GroupDataSourcesDialog dialog =
new GroupDataSourcesDialog(dataSourceCount);
486 if (dialog.groupByDataSourceSelected()) {
488 refreshContentTreeSafe();
502 @NbBundle.Messages({
"# {0} - dataSourceCount",
503 "DirectoryTreeTopComponent.componentOpened.groupDataSources.text=This case contains {0} data sources. Would you like to group by data source for faster loading?",
504 "DirectoryTreeTopComponent.componentOpened.groupDataSources.title=Group by data source?"})
508 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
509 Case currentCase = null;
517 if (null == currentCase || currentCase.hasData() ==
false) {
518 getTree().setRootVisible(
false);
523 long threshold = DEFAULT_DATASOURCE_GROUPING_THRESHOLD;
527 }
catch (NumberFormatException ex) {
528 LOGGER.log(Level.SEVERE,
"Group data sources threshold is not a number", ex);
535 int dataSourceCount = currentCase.getDataSources().size();
537 && dataSourceCount > threshold) {
538 promptForDataSourceGrouping(dataSourceCount);
540 }
catch (TskCoreException ex) {
541 LOGGER.log(Level.SEVERE,
"Error loading data sources", ex);
547 autopsyTreeChildren = Children.create(autopsyTreeChildFactory,
true);
548 Node root =
new AbstractNode(autopsyTreeChildren) {
555 public Action[] getActions(
boolean popup) {
556 return new Action[]{};
562 public Node.Handle getHandle() {
563 return new Node.Handle() {
565 public Node getNode()
throws IOException {
566 return em.getRootContext();
572 root =
new DirectoryTreeFilterNode(root,
true);
574 em.setRootContext(root);
575 em.getRootContext().setName(currentCase.getName());
576 em.getRootContext().setDisplayName(currentCase.getName());
577 getTree().setRootVisible(
false);
581 new SwingWorker<Node[], Void>() {
583 protected Node[] doInBackground()
throws Exception {
584 Children rootChildren = em.getRootContext().getChildren();
585 preExpandNodes(rootChildren);
595 if (rootChildren.getNodesCount() > 0) {
596 return new Node[]{rootChildren.getNodeAt(0)};
602 protected void done() {
606 if (!dataResult.isOpened()) {
617 Node[] selections =
get();
618 if (selections != null && selections.length > 0) {
619 em.setSelectedNodes(selections);
621 }
catch (PropertyVetoException ex) {
622 LOGGER.log(Level.SEVERE,
"Error setting default selected node.", ex);
623 }
catch (InterruptedException | ExecutionException ex) {
624 LOGGER.log(Level.SEVERE,
"Error expanding tree to initial state.", ex);
642 autopsyTreeChildren = null;
645 void writeProperties(java.util.Properties p) {
648 p.setProperty(
"version",
"1.0");
652 Object readProperties(java.util.Properties p) {
653 if (instance == null) {
661 String version = p.getProperty(
"version");
684 return openCase.
hasData() ==
false;
707 return new Action[]{};
718 Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
719 if (selectedNodes.length > 0) {
720 result = selectedNodes[0];
734 String changed =
event.getPropertyName();
744 if (event.getOldValue() != null &&
event.getNewValue() == null) {
746 SwingUtilities.invokeLater(() -> {
747 Node emptyNode =
new AbstractNode(Children.LEAF);
748 em.setRootContext(emptyNode);
750 }
else if (event.getNewValue() != null) {
752 Case newCase = (
Case) event.getNewValue();
753 final String newCaseName = newCase.
getName();
754 SwingUtilities.invokeLater(() -> {
755 em.getRootContext().setName(newCaseName);
756 em.getRootContext().setDisplayName(newCaseName);
786 SwingUtilities.invokeLater(() -> {
797 else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
798 respondSelection((Node[]) event.getOldValue(), (Node[]) event.getNewValue());
811 @NbBundle.Messages(
"DirectoryTreeTopComponent.emptyMimeNode.text=Data not available. Run file type identification module.")
812 void respondSelection(
final Node[] oldNodes,
final Node[] newNodes) {
822 EventQueue.invokeLater(() -> {
824 DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
826 Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode();
827 if (treeNode != null) {
828 Node originNode = ((DirectoryTreeFilterNode) treeNode).getOriginal();
830 Node drfn =
new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
832 if (FileTypesByMimeType.isEmptyMimeTypeNode(originNode)) {
835 EmptyNode emptyNode =
new EmptyNode(Bundle.DirectoryTreeTopComponent_emptyMimeNode_text());
836 dataResult.
setNode(
new TableFilterNode(emptyNode,
true,
"This Node Is Empty"));
837 }
else if (originNode instanceof DisplayableItemNode) {
838 dataResult.
setNode(
new TableFilterNode(drfn,
true, ((DisplayableItemNode) originNode).getItemType()));
840 dataResult.
setNode(
new TableFilterNode(drfn,
true));
842 String displayName =
"";
843 Content content = originNode.getLookup().lookup(Content.class);
844 if (content != null) {
846 displayName = content.getUniquePath();
847 }
catch (TskCoreException ex) {
848 LOGGER.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() for node: {0}", originNode);
850 }
else if (originNode.getLookup().lookup(String.class) != null) {
851 displayName = originNode.getLookup().lookup(String.class);
853 dataResult.
setPath(displayName);
856 if (oldNodes != null && newNodes != null
857 && (oldNodes.length == newNodes.length)) {
858 boolean sameNodes =
true;
859 for (
int i = 0; i < oldNodes.length; i++) {
860 sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
863 dataResult.requestActive();
872 updateHistory(em.getSelectedNodes());
876 if (selectedNodes.length == 0) {
880 Node selectedNode = selectedNodes[0];
881 String selectedNodeName = selectedNode.getName();
889 String[] currentLast = backList.peekLast();
890 String lastNodeName = null;
891 if (currentLast != null && currentLast.length > 0) {
892 lastNodeName = currentLast[currentLast.length - 1];
895 if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
897 final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
898 backList.addLast(selectedPath);
899 if (backList.size() > 1) {
900 backButton.setEnabled(
true);
902 backButton.setEnabled(
false);
906 forwardButton.setEnabled(
false);
918 backButton.setEnabled(
false);
919 forwardButton.setEnabled(
false);
927 BeanTreeView getTree() {
928 return (BeanTreeView) this.treeView;
935 SwingUtilities.invokeLater(this::rebuildTree);
942 SwingUtilities.invokeLater(() -> {
944 if (autopsyTreeChildren == null) {
949 for (Node dataSource : autopsyTreeChildren.getNodes()) {
951 if (tagsNode != null) {
958 if (tagsNode != null) {
979 if (null == currentCase || currentCase.
hasData() ==
false) {
989 new SwingWorker<Void, Void>() {
992 protected Void doInBackground()
throws Exception {
997 protected void done() {
1002 preExpandNodes(em.getRootContext().getChildren());
1003 }
catch (InterruptedException | ExecutionException ex) {
1004 LOGGER.log(Level.SEVERE,
"Error selecting tree node.", ex);
1017 private void setSelectedNode(
final String[] previouslySelectedNodePath,
final String rootNodeName) {
1018 if (previouslySelectedNodePath == null) {
1021 SwingUtilities.invokeLater(
new Runnable() {
1024 if (previouslySelectedNodePath.length > 0 && (rootNodeName == null || previouslySelectedNodePath[0].equals(rootNodeName))) {
1025 Node selectedNode = null;
1026 ArrayList<String> selectedNodePath =
new ArrayList<>(Arrays.asList(previouslySelectedNodePath));
1027 while (null == selectedNode && !selectedNodePath.isEmpty()) {
1029 selectedNode = NodeOp.findPath(em.getRootContext(), selectedNodePath.toArray(
new String[selectedNodePath.size()]));
1030 }
catch (NodeNotFoundException ex) {
1032 if (selectedNodePath.size() > 1) {
1033 selectedNodePath.remove(selectedNodePath.size() - 1);
1035 StringBuilder nodePath =
new StringBuilder();
1036 for (
int i = 0; i < previouslySelectedNodePath.length; ++i) {
1037 nodePath.append(previouslySelectedNodePath[i]).append(
"/");
1039 LOGGER.log(Level.WARNING,
"Failed to find any nodes to select on path " + nodePath.toString(), ex);
1045 if (null != selectedNode) {
1046 if (rootNodeName != null) {
1049 backList.pollLast();
1052 em.setExploredContextAndSelection(selectedNode,
new Node[]{selectedNode});
1053 }
catch (PropertyVetoException ex) {
1054 LOGGER.log(Level.WARNING,
"Property veto from ExplorerManager setting selection to " + selectedNode.getName(), ex);
1073 int typeID = art.getArtifactTypeID();
1074 String typeName = art.getArtifactTypeName();
1075 Children rootChilds = em.getRootContext().getChildren();
1076 Node treeNode = null;
1078 Children resultsChilds = resultsNode.getChildren();
1079 if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
1080 Node hashsetRootNode = resultsChilds.findChild(typeName);
1081 Children hashsetRootChilds = hashsetRootNode.getChildren();
1083 String setName = null;
1084 List<BlackboardAttribute> attributes = art.getAttributes();
1085 for (BlackboardAttribute att : attributes) {
1086 int typeId = att.getAttributeType().getTypeID();
1087 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1088 setName = att.getValueString();
1091 treeNode = hashsetRootChilds.findChild(setName);
1092 }
catch (TskCoreException ex) {
1093 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1095 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
1096 Node keywordRootNode = resultsChilds.findChild(typeName);
1097 Children keywordRootChilds = keywordRootNode.getChildren();
1099 String listName = null;
1100 String keywordName = null;
1101 String regex = null;
1102 List<BlackboardAttribute> attributes = art.getAttributes();
1103 for (BlackboardAttribute att : attributes) {
1104 int typeId = att.getAttributeType().getTypeID();
1105 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1106 listName = att.getValueString();
1107 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
1108 keywordName = att.getValueString();
1109 }
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
1110 regex = att.getValueString();
1113 if (listName == null) {
1114 if (regex == null) {
1115 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.simpleLiteralSearch.text");
1117 listName = NbBundle.getMessage(
KeywordHits.class,
"KeywordHits.singleRegexSearch.text");
1120 Node listNode = keywordRootChilds.findChild(listName);
1121 if (listNode == null) {
1124 Children listChildren = listNode.getChildren();
1125 if (listChildren == null) {
1128 if (regex != null) {
1129 Node regexNode = listChildren.findChild(regex);
1130 if (regexNode == null) {
1133 listChildren = regexNode.getChildren();
1134 if (listChildren == null) {
1139 treeNode = listChildren.findChild(keywordName);
1141 }
catch (TskCoreException ex) {
1142 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1144 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
1145 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
1146 Node interestingItemsRootNode = resultsChilds.findChild(NbBundle
1147 .getMessage(
InterestingHits.class,
"InterestingHits.interestingItems.text"));
1148 Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
1150 String setName = null;
1151 List<BlackboardAttribute> attributes = art.getAttributes();
1152 for (BlackboardAttribute att : attributes) {
1153 int typeId = att.getAttributeType().getTypeID();
1154 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
1155 setName = att.getValueString();
1158 Node setNode = interestingItemsRootChildren.findChild(setName);
1159 if (setNode == null) {
1162 Children interestingChildren = setNode.getChildren();
1163 if (interestingChildren == null) {
1166 treeNode = interestingChildren.findChild(art.getDisplayName());
1167 }
catch (TskCoreException ex) {
1168 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1170 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
1171 Node emailMsgRootNode = resultsChilds.findChild(typeName);
1172 Children emailMsgRootChilds = emailMsgRootNode.getChildren();
1173 Map<String, String> parsedPath = null;
1175 List<BlackboardAttribute> attributes = art.getAttributes();
1176 for (BlackboardAttribute att : attributes) {
1177 int typeId = att.getAttributeType().getTypeID();
1178 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) {
1183 if (parsedPath == null) {
1186 Node defaultNode = emailMsgRootChilds.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultAcct.text")));
1187 Children defaultChildren = defaultNode.getChildren();
1188 treeNode = defaultChildren.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class,
"EmailExtracted.defaultFolder.text")));
1189 }
catch (TskCoreException ex) {
1190 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1193 }
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
1194 Node accountRootNode = resultsChilds.findChild(art.getDisplayName());
1195 Children accountRootChilds = accountRootNode.getChildren();
1196 List<BlackboardAttribute> attributes;
1197 String accountType = null;
1198 String ccNumberName = null;
1200 attributes = art.getAttributes();
1201 for (BlackboardAttribute att : attributes) {
1202 int typeId = att.getAttributeType().getTypeID();
1203 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID()) {
1204 accountType = att.getValueString();
1206 if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID()) {
1207 ccNumberName = att.getValueString();
1210 if (accountType == null) {
1214 if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) {
1215 Node accountNode = accountRootChilds.findChild(Account.Type.CREDIT_CARD.getDisplayName());
1216 if (accountNode == null) {
1219 Children accountChildren = accountNode.getChildren();
1220 if (accountChildren == null) {
1223 Node binNode = accountChildren.findChild(NbBundle.getMessage(
Accounts.class,
"Accounts.ByBINNode.name"));
1224 if (binNode == null) {
1227 Children binChildren = binNode.getChildren();
1228 if (ccNumberName == null) {
1233 String binName = StringUtils.rightPad(ccNumberName, 8,
"0");
1234 binName = binName.substring(0, 8);
1237 bin = Integer.parseInt(binName);
1238 }
catch (NumberFormatException ex) {
1239 LOGGER.log(Level.WARNING,
"Unable to parseInt a BIN for node selection from string binName=" + binName, ex);
1243 if (binInfo != null) {
1244 int startBin = ((
BINRange) binInfo).getBINstart();
1245 int endBin = ((
BINRange) binInfo).getBINend();
1246 if (startBin != endBin) {
1247 binName = Integer.toString(startBin) +
"-" + Integer.toString(endBin).substring(5);
1250 if (binName == null) {
1253 treeNode = binChildren.findChild(binName);
1255 treeNode = accountRootChilds.findChild(accountType);
1257 }
catch (TskCoreException ex) {
1258 LOGGER.log(Level.WARNING,
"Error retrieving attributes", ex);
1262 Children extractedChilds = extractedContent.getChildren();
1263 if (extractedChilds == null) {
1266 treeNode = extractedChilds.findChild(typeName);
1269 if (treeNode == null) {
1273 DisplayableItemNode undecoratedParentNode = (DisplayableItemNode) ((DirectoryTreeFilterNode) treeNode).getOriginal();
1275 getTree().expandNode(treeNode);
1276 if (this.getSelectedNode().equals(treeNode)) {
1277 this.setDirectoryListingActive();
1278 this.respondSelection(em.getSelectedNodes(),
new Node[]{treeNode});
1281 em.setExploredContextAndSelection(treeNode,
new Node[]{treeNode});
1282 }
catch (PropertyVetoException ex) {
1283 LOGGER.log(Level.WARNING,
"Property Veto: ", ex);
1291 NbBundle.getMessage(
this.getClass(),
"DirectoryTreeTopComponent.action.viewArtContent.text"),
TopComponent getTopComponent()
Children autopsyTreeChildren
void viewArtifact(final BlackboardArtifact art)
static final String HIDE_SLACK_FILES_IN_VIEWS_TREE
javax.swing.JScrollPane treeView
static final String HIDE_KNOWN_FILES_IN_VIEWS_TREE
DataResultTopComponent getDirectoryListing()
final LinkedList< String[]> forwardList
void setDirectoryListingActive()
static boolean runningWithGUI
void setShowRejected(boolean showRejected)
static final String HIDE_SCO_COLUMNS
void setSelectedNode(final String[] previouslySelectedNodePath, final String rootNodeName)
javax.swing.JButton openViewPreferencesButton
boolean hasMenuOpenAction()
static void openCoreWindows()
void updateHistory(Node[] selectedNodes)
final LinkedList< String[]> backList
static synchronized BankIdentificationNumber getBINInfo(int bin)
void openDirectoryListing()
void refreshContentTreeSafe()
void readPropertiesImpl(java.util.Properties p)
void backButtonActionPerformed(java.awt.event.ActionEvent evt)
void setShowRejectedResults(boolean showRejectedResults)
static final String SHOW_ONLY_CURRENT_USER_TAGS
void propertyChange(PropertyChangeEvent event)
static final String HIDE_KNOWN_FILES_IN_DATA_SRCS_TREE
AutopsyTreeChildFactory autopsyTreeChildFactory
DirectoryTreeTopComponent()
static synchronized DirectoryTreeTopComponent getDefault()
static final String DISPLAY_TIMES_IN_LOCAL_TIME
javax.swing.JButton forwardButton
static void setGroupItemsInTreeByDataSource(boolean value)
static final String KEEP_PREFERRED_VIEWER
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
boolean showRejectedResults
void viewArtifactContent(BlackboardArtifact art)
static final String DISPLAY_TRANSLATED_NAMES
void promptForDataSourceGrouping(int dataSourceCount)
ExplorerManager getExplorerManager()
javax.swing.JButton backButton
static final String HIDE_SLACK_FILES_IN_DATA_SRCS_TREE
void preExpandNodes(Children rootChildren)
static Boolean getGroupItemsInTreeByDataSource()
static String getConfigSetting(String moduleName, String settingName)
static DirectoryTreeTopComponent instance
void addOnFinishedListener(PropertyChangeListener l)
static final String MAIN_SETTINGS
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
boolean getShowRejectedResults()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void addChangeListener(PreferenceChangeListener listener)
javax.swing.JPopupMenu viewPreferencesPopupMenu
void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo)
void forwardButtonActionPerformed(java.awt.event.ActionEvent evt)
void subscribeToChangeEvents()
static synchronized DirectoryTreeTopComponent findInstance()
void setPath(String pathText)
static final String TIME_ZONE_FOR_DISPLAYS
static boolean settingExists(String moduleName, String settingName)
static boolean isCaseOpen()
void openViewPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt)
void setNode(Node selectedNode)