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.Collections;
 
   30 import java.util.EnumSet;
 
   31 import java.util.LinkedList;
 
   32 import java.util.List;
 
   34 import java.util.Objects;
 
   35 import java.util.concurrent.ExecutionException;
 
   36 import java.util.logging.Level;
 
   37 import java.util.prefs.PreferenceChangeEvent;
 
   38 import java.util.prefs.PreferenceChangeListener;
 
   39 import javax.swing.Action;
 
   40 import javax.swing.SwingUtilities;
 
   41 import javax.swing.SwingWorker;
 
   42 import javax.swing.event.PopupMenuEvent;
 
   43 import javax.swing.event.PopupMenuListener;
 
   44 import javax.swing.event.TreeExpansionEvent;
 
   45 import javax.swing.event.TreeExpansionListener;
 
   46 import javax.swing.tree.TreeSelectionModel;
 
   47 import org.apache.commons.lang3.StringUtils;
 
   48 import org.openide.explorer.ExplorerManager;
 
   49 import org.openide.explorer.ExplorerUtils;
 
   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;
 
  100     "DirectoryTreeTopComponent.resultsView.title=Listing" 
  102 @SuppressWarnings(
"PMD.SingularField") 
 
  105     private final transient ExplorerManager em = 
new ExplorerManager();
 
  111     private static final String PREFERRED_ID = 
"DirectoryTreeTopComponent"; 
 
  117     private static final long DEFAULT_DATASOURCE_GROUPING_THRESHOLD = 5; 
 
  118     private static final String GROUPING_THRESHOLD_NAME = 
"GroupDataSourceThreshold";
 
  119     private static final String SETTINGS_FILE = 
"CasePreferences.properties"; 
 
  128         getTree().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 
  131         getTree().addTreeExpansionListener(
new TreeExpansionListener() {
 
  133             public void treeExpanded(TreeExpansionEvent event) {
 
  140                 Node expandedNode = Visualizer.findNode(event.getPath().getLastPathComponent());
 
  141                 for (Node child : em.getRootContext().getChildren().getNodes()) {
 
  142                     if (child.equals(expandedNode)) {
 
  143                         preExpandNodes(child.getChildren());
 
  149             public void treeCollapsed(TreeExpansionEvent event) {
 
  155         putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
 
  159         subscribeToChangeEvents();
 
  160         associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
 
  163         this.backList = 
new LinkedList<>();
 
  164         this.forwardList = 
new LinkedList<>();
 
  165         backButton.setEnabled(
false);
 
  166         forwardButton.setEnabled(
false);
 
  168         viewPreferencesPopupMenu.add(viewPreferencesPanel);
 
  169         viewPreferencesPopupMenu.setSize(viewPreferencesPanel.getPreferredSize().width + 6, viewPreferencesPanel.getPreferredSize().height + 6);
 
  170         viewPreferencesPopupMenu.addPopupMenuListener(
new PopupMenuListener() {
 
  172             public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
 
  173                 openViewPreferencesButton.setSelected(
true);
 
  177             public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
 
  178                 openViewPreferencesButton.setSelected(
false);
 
  182             public void popupMenuCanceled(PopupMenuEvent e) {
 
  183                 openViewPreferencesButton.setSelected(
false);
 
  195         ExpansionBeanTreeView tree = getTree();
 
  198         if (!Objects.isNull(results)) {
 
  199             tree.expandNode(results);
 
  200             Children resultsChildren = results.getChildren();
 
  201             Arrays.stream(resultsChildren.getNodes()).forEach(tree::expandNode);
 
  205         if (!Objects.isNull(views)) {
 
  206             tree.expandNode(views);
 
  216             public void preferenceChange(PreferenceChangeEvent evt) {
 
  217                 switch (evt.getKey()) {
 
  225                         refreshContentTreeSafe();
 
  233                         refreshContentTreeSafe();
 
  240         this.em.addPropertyChangeListener(
this);
 
  246         this.dataResult.requestActive();
 
  250         this.dataResult.
open();
 
  254         return this.dataResult;
 
  263         return showRejectedResults;
 
  273         this.showRejectedResults = showRejectedResults;
 
  274         if (accounts != null) {
 
  287         viewPreferencesPopupMenu = 
new javax.swing.JPopupMenu();
 
  288         treeView = 
new ExpansionBeanTreeView();
 
  289         backButton = 
new javax.swing.JButton();
 
  290         forwardButton = 
new javax.swing.JButton();
 
  291         openViewPreferencesButton = 
new javax.swing.JButton();
 
  293         treeView.setBorder(null);
 
  295         backButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back.png"))); 
 
  296         org.openide.awt.Mnemonics.setLocalizedText(backButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.backButton.text")); 
 
  297         backButton.setBorderPainted(
false);
 
  298         backButton.setContentAreaFilled(
false);
 
  299         backButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_disabled.png"))); 
 
  300         backButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
 
  301         backButton.setMaximumSize(
new java.awt.Dimension(55, 100));
 
  302         backButton.setMinimumSize(
new java.awt.Dimension(5, 5));
 
  303         backButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  304         backButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_hover.png"))); 
 
  305         backButton.addActionListener(
new java.awt.event.ActionListener() {
 
  306             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  307                 backButtonActionPerformed(evt);
 
  311         forwardButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward.png"))); 
 
  312         org.openide.awt.Mnemonics.setLocalizedText(forwardButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.forwardButton.text")); 
 
  313         forwardButton.setBorderPainted(
false);
 
  314         forwardButton.setContentAreaFilled(
false);
 
  315         forwardButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_disabled.png"))); 
 
  316         forwardButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
 
  317         forwardButton.setMaximumSize(
new java.awt.Dimension(55, 100));
 
  318         forwardButton.setMinimumSize(
new java.awt.Dimension(5, 5));
 
  319         forwardButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  320         forwardButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_hover.png"))); 
 
  321         forwardButton.addActionListener(
new java.awt.event.ActionListener() {
 
  322             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  323                 forwardButtonActionPerformed(evt);
 
  327         openViewPreferencesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/view-preferences-23.png"))); 
 
  328         org.openide.awt.Mnemonics.setLocalizedText(openViewPreferencesButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.openViewPreferencesButton.text")); 
 
  329         openViewPreferencesButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
 
  330         openViewPreferencesButton.setBorderPainted(
false);
 
  331         openViewPreferencesButton.setContentAreaFilled(
false);
 
  332         openViewPreferencesButton.setMaximumSize(
new java.awt.Dimension(24, 24));
 
  333         openViewPreferencesButton.setMinimumSize(
new java.awt.Dimension(24, 24));
 
  334         openViewPreferencesButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  335         openViewPreferencesButton.addActionListener(
new java.awt.event.ActionListener() {
 
  336             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  337                 openViewPreferencesButtonActionPerformed(evt);
 
  341         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(
this);
 
  342         this.setLayout(layout);
 
  343         layout.setHorizontalGroup(
 
  344             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  345             .addComponent(treeView)
 
  346             .addGroup(layout.createSequentialGroup()
 
  348                 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  349                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  350                 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  351                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
 
  352                 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  355         layout.setVerticalGroup(
 
  356             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  357             .addGroup(layout.createSequentialGroup()
 
  359                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  360                     .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  361                     .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  362                     .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  363                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  364                 .addComponent(treeView, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
 
  370         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  373         String[] currentNodePath = backList.pollLast();
 
  374         forwardList.addLast(currentNodePath);
 
  375         forwardButton.setEnabled(
true);
 
  382         String[] newCurrentNodePath = backList.peekLast();
 
  385         if (backList.size() > 1) {
 
  386             backButton.setEnabled(
true);
 
  388             backButton.setEnabled(
false);
 
  392         setSelectedNode(newCurrentNodePath, null);
 
  394         this.setCursor(null);
 
  399         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  401         String[] newCurrentNodePath = forwardList.pollLast();
 
  402         if (!forwardList.isEmpty()) {
 
  403             forwardButton.setEnabled(
true);
 
  405             forwardButton.setEnabled(
false);
 
  408         backList.addLast(newCurrentNodePath);
 
  409         backButton.setEnabled(
true);
 
  412         setSelectedNode(newCurrentNodePath, null);
 
  414         this.setCursor(null);
 
  418         viewPreferencesPanel.
load();
 
  419         viewPreferencesPopupMenu.show(openViewPreferencesButton, 0, openViewPreferencesButton.getHeight() - 1);
 
  439         if (instance == null) {
 
  452         WindowManager winManager = WindowManager.
getDefault();
 
  453         TopComponent win = winManager.findTopComponent(PREFERRED_ID);
 
  456                     "Cannot find " + PREFERRED_ID + 
" component. It will not be located properly in the window system."); 
 
  460             return (DirectoryTreeTopComponent) win;
 
  463                 "There seem to be multiple components with the '" + PREFERRED_ID 
 
  464                 + 
"' ID. That is a potential source of errors and unexpected behavior."); 
 
  476         return TopComponent.PERSISTENCE_NEVER;
 
  487             GroupDataSourcesDialog dialog = 
new GroupDataSourcesDialog(dataSourceCount);
 
  489             if (dialog.groupByDataSourceSelected()) {
 
  491                 refreshContentTreeSafe();
 
  505     @NbBundle.Messages({
"# {0} - dataSourceCount",
 
  506         "DirectoryTreeTopComponent.componentOpened.groupDataSources.text=This case contains {0} data sources. Would you like to group by data source for faster loading?",
 
  507         "DirectoryTreeTopComponent.componentOpened.groupDataSources.title=Group by data source?"})
 
  511         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  512         Case currentCase = null;
 
  520         if (null == currentCase || currentCase.hasData() == 
false) {
 
  521             getTree().setRootVisible(
false); 
 
  526                 long threshold = DEFAULT_DATASOURCE_GROUPING_THRESHOLD;
 
  530                     } 
catch (NumberFormatException ex) {
 
  531                         LOGGER.log(Level.SEVERE, 
"Group data sources threshold is not a number", ex);
 
  538                     int dataSourceCount = currentCase.getDataSources().size();
 
  540                             && dataSourceCount > threshold) {
 
  541                         promptForDataSourceGrouping(dataSourceCount);
 
  543                 } 
catch (TskCoreException ex) {
 
  544                     LOGGER.log(Level.SEVERE, 
"Error loading data sources", ex);
 
  550             autopsyTreeChildren = Children.create(autopsyTreeChildFactory, 
true);
 
  551             Node root = 
new AbstractNode(autopsyTreeChildren) {
 
  558                 public Action[] getActions(
boolean popup) {
 
  559                     return new Action[]{};
 
  565                 public Node.Handle getHandle() {
 
  566                     return new Node.Handle() {
 
  568                         public Node getNode() 
throws IOException {
 
  569                             return em.getRootContext();
 
  575             root = 
new DirectoryTreeFilterNode(root, 
true);
 
  577             em.setRootContext(root);
 
  578             em.getRootContext().setName(currentCase.getName());
 
  579             em.getRootContext().setDisplayName(currentCase.getName());
 
  580             getTree().setRootVisible(
false); 
 
  584             new SwingWorker<Node[], Void>() {
 
  586                 protected Node[] doInBackground() 
throws Exception {
 
  587                     Children rootChildren = em.getRootContext().getChildren();
 
  588                     preExpandNodes(rootChildren);
 
  598                     if (rootChildren.getNodesCount() > 0) {
 
  599                         return new Node[]{rootChildren.getNodeAt(0)};
 
  605                 protected void done() {
 
  609                     if (!dataResult.isOpened()) {
 
  620                         Node[] selections = 
get();
 
  621                         if (selections != null && selections.length > 0) {
 
  622                             em.setSelectedNodes(selections);
 
  624                     } 
catch (PropertyVetoException ex) {
 
  625                         LOGGER.log(Level.SEVERE, 
"Error setting default selected node.", ex); 
 
  626                     } 
catch (InterruptedException | ExecutionException ex) {
 
  627                         LOGGER.log(Level.SEVERE, 
"Error expanding tree to initial state.", ex); 
 
  645         autopsyTreeChildren = null;
 
  648     void writeProperties(java.util.Properties p) {
 
  651         p.setProperty(
"version", 
"1.0");
 
  655     Object readProperties(java.util.Properties p) {
 
  656         if (instance == null) {
 
  664         String version = p.getProperty(
"version");
 
  687             return openCase.
hasData() == 
false;
 
  710         return new Action[]{};
 
  721         Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
 
  722         if (selectedNodes.length > 0) {
 
  723             result = selectedNodes[0];
 
  737             String changed = 
event.getPropertyName();
 
  747                 if (event.getOldValue() != null && 
event.getNewValue() == null) {
 
  749                     SwingUtilities.invokeLater(() -> {
 
  750                         Node emptyNode = 
new AbstractNode(Children.LEAF);
 
  751                         em.setRootContext(emptyNode);
 
  753                 } 
else if (event.getNewValue() != null) {
 
  755                     Case newCase = (
Case) event.getNewValue();
 
  756                     final String newCaseName = newCase.
getName();
 
  757                     SwingUtilities.invokeLater(() -> {
 
  758                         em.getRootContext().setName(newCaseName);
 
  759                         em.getRootContext().setDisplayName(newCaseName);
 
  789                     SwingUtilities.invokeLater(() -> {
 
  800             else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
 
  801                 respondSelection((Node[]) event.getOldValue(), (Node[]) event.getNewValue());
 
  817     @NbBundle.Messages(
"DirectoryTreeTopComponent.emptyMimeNode.text=Data not available. Run file type identification module.")
 
  818     void respondSelection(
final Node[] oldNodes, 
final Node[] newNodes) {
 
  828         EventQueue.invokeLater(() -> {
 
  830             DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  832                 Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode();
 
  833                 if (treeNode != null) {
 
  834                     Node originNode = ((DirectoryTreeFilterNode) treeNode).getOriginal();
 
  836                     Node drfn = 
new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
 
  838                     if (FileTypesByMimeType.isEmptyMimeTypeNode(originNode)) {
 
  841                         EmptyNode emptyNode = 
new EmptyNode(Bundle.DirectoryTreeTopComponent_emptyMimeNode_text());
 
  842                         dataResult.
setNode(
new TableFilterNode(emptyNode, 
true, 
"This Node Is Empty")); 
 
  843                     } 
else if (originNode instanceof DisplayableItemNode) {
 
  844                         dataResult.
setNode(
new TableFilterNode(drfn, 
true, ((DisplayableItemNode) originNode).getItemType()));
 
  846                         dataResult.
setNode(
new TableFilterNode(drfn, 
true));
 
  848                     String displayName = 
"";
 
  849                     Content content = originNode.getLookup().lookup(Content.class);
 
  850                     if (content != null) {
 
  852                             displayName = content.getUniquePath();
 
  853                         } 
catch (TskCoreException ex) {
 
  854                             LOGGER.log(Level.SEVERE, 
"Exception while calling Content.getUniquePath() for node: {0}", originNode); 
 
  856                     } 
else if (originNode.getLookup().lookup(String.class) != null) {
 
  857                         displayName = originNode.getLookup().lookup(String.class);
 
  859                     dataResult.
setPath(displayName);
 
  862                 if (oldNodes != null && newNodes != null
 
  863                         && (oldNodes.length == newNodes.length)) {
 
  864                     boolean sameNodes = 
true;
 
  865                     for (
int i = 0; i < oldNodes.length; i++) {
 
  866                         sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
 
  869                         dataResult.requestActive();
 
  878         updateHistory(em.getSelectedNodes());
 
  882         if (selectedNodes.length == 0) {
 
  886         Node selectedNode = selectedNodes[0];
 
  887         String selectedNodeName = selectedNode.getName();
 
  895         String[] currentLast = backList.peekLast();
 
  896         String lastNodeName = null;
 
  897         if (currentLast != null && currentLast.length > 0) {
 
  898             lastNodeName = currentLast[currentLast.length - 1];
 
  901         if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
 
  903             final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
 
  904             backList.addLast(selectedPath); 
 
  905             if (backList.size() > 1) {
 
  906                 backButton.setEnabled(
true);
 
  908                 backButton.setEnabled(
false);
 
  912             forwardButton.setEnabled(
false); 
 
  924         backButton.setEnabled(
false);
 
  925         forwardButton.setEnabled(
false);
 
  934         return (ExpansionBeanTreeView) this.treeView;
 
  941         SwingUtilities.invokeLater(this::rebuildTree);
 
  948         SwingUtilities.invokeLater(() -> {
 
  950             if (autopsyTreeChildren == null) {
 
  955                 for (Node dataSource : autopsyTreeChildren.getNodes()) {
 
  957                     if (tagsNode != null) {
 
  964                 if (tagsNode != null) {
 
  985         if (null == currentCase || currentCase.
hasData() == 
false) {
 
  995         new SwingWorker<Void, Void>() {
 
  998             protected Void doInBackground() 
throws Exception {
 
 1003             protected void done() {
 
 1008                     preExpandNodes(em.getRootContext().getChildren());
 
 1009                 } 
catch (InterruptedException | ExecutionException ex) {
 
 1010                     LOGGER.log(Level.SEVERE, 
"Error selecting tree node.", ex); 
 
 1023     private void setSelectedNode(
final String[] previouslySelectedNodePath, 
final String rootNodeName) {
 
 1024         if (previouslySelectedNodePath == null) {
 
 1027         SwingUtilities.invokeLater(
new Runnable() {
 
 1030                 if (previouslySelectedNodePath.length > 0 && (rootNodeName == null || previouslySelectedNodePath[0].equals(rootNodeName))) {
 
 1031                     Node selectedNode = null;
 
 1032                     ArrayList<String> selectedNodePath = 
new ArrayList<>(Arrays.asList(previouslySelectedNodePath));
 
 1033                     while (null == selectedNode && !selectedNodePath.isEmpty()) {
 
 1035                             selectedNode = NodeOp.findPath(em.getRootContext(), selectedNodePath.toArray(
new String[selectedNodePath.size()]));
 
 1036                         } 
catch (NodeNotFoundException ex) {
 
 1038                             if (selectedNodePath.size() > 1) {
 
 1039                                 selectedNodePath.remove(selectedNodePath.size() - 1);
 
 1041                                 StringBuilder nodePath = 
new StringBuilder();
 
 1042                                 for (
int i = 0; i < previouslySelectedNodePath.length; ++i) {
 
 1043                                     nodePath.append(previouslySelectedNodePath[i]).append(
"/");
 
 1045                                 LOGGER.log(Level.WARNING, 
"Failed to find any nodes to select on path " + nodePath.toString(), ex); 
 
 1051                     if (null != selectedNode) {
 
 1052                         if (rootNodeName != null) {
 
 1055                             backList.pollLast();
 
 1058                             em.setExploredContextAndSelection(selectedNode, 
new Node[]{selectedNode});
 
 1059                         } 
catch (PropertyVetoException ex) {
 
 1060                             LOGGER.log(Level.WARNING, 
"Property veto from ExplorerManager setting selection to " + selectedNode.getName(), ex); 
 
 1079         int typeID = art.getArtifactTypeID();
 
 1080         String typeName = art.getArtifactTypeName();
 
 1081         Children rootChilds = em.getRootContext().getChildren();
 
 1082         Node treeNode = null;
 
 1084         Children resultsChilds = resultsNode.getChildren();
 
 1085         if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
 
 1086             Node hashsetRootNode = resultsChilds.findChild(typeName);
 
 1087             Children hashsetRootChilds = hashsetRootNode.getChildren();
 
 1089                 String setName = null;
 
 1090                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1091                 for (BlackboardAttribute att : attributes) {
 
 1092                     int typeId = att.getAttributeType().getTypeID();
 
 1093                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1094                         setName = att.getValueString();
 
 1097                 treeNode = hashsetRootChilds.findChild(setName);
 
 1098             } 
catch (TskCoreException ex) {
 
 1099                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1101         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
 
 1102             Node keywordRootNode = resultsChilds.findChild(typeName);
 
 1103             Children keywordRootChilds = keywordRootNode.getChildren();
 
 1105                 String listName = null;
 
 1106                 String keywordName = null;
 
 1107                 String regex = null;
 
 1108                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1109                 for (BlackboardAttribute att : attributes) {
 
 1110                     int typeId = att.getAttributeType().getTypeID();
 
 1111                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1112                         listName = att.getValueString();
 
 1113                     } 
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
 
 1114                         keywordName = att.getValueString();
 
 1115                     } 
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
 
 1116                         regex = att.getValueString();
 
 1119                 if (listName == null) {
 
 1120                     if (regex == null) {  
 
 1121                         listName = NbBundle.getMessage(
KeywordHits.class, 
"KeywordHits.simpleLiteralSearch.text");
 
 1123                         listName = NbBundle.getMessage(
KeywordHits.class, 
"KeywordHits.singleRegexSearch.text");
 
 1126                 Node listNode = keywordRootChilds.findChild(listName);
 
 1127                 if (listNode == null) {
 
 1130                 Children listChildren = listNode.getChildren();
 
 1131                 if (listChildren == null) {
 
 1134                 if (regex != null) {  
 
 1135                     Node regexNode = listChildren.findChild(regex);
 
 1136                     if (regexNode == null) {
 
 1139                     listChildren = regexNode.getChildren();
 
 1140                     if (listChildren == null) {
 
 1145                 treeNode = listChildren.findChild(keywordName);
 
 1147             } 
catch (TskCoreException ex) {
 
 1148                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1150         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
 
 1151                 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
 
 1152             Node interestingItemsRootNode = resultsChilds.findChild(NbBundle
 
 1153                     .getMessage(
InterestingHits.class, 
"InterestingHits.interestingItems.text"));
 
 1154             Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
 
 1156                 String setName = null;
 
 1157                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1158                 for (BlackboardAttribute att : attributes) {
 
 1159                     int typeId = att.getAttributeType().getTypeID();
 
 1160                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1161                         setName = att.getValueString();
 
 1164                 Node setNode = interestingItemsRootChildren.findChild(setName);
 
 1165                 if (setNode == null) {
 
 1168                 Children interestingChildren = setNode.getChildren();
 
 1169                 if (interestingChildren == null) {
 
 1172                 treeNode = interestingChildren.findChild(art.getDisplayName());
 
 1173             } 
catch (TskCoreException ex) {
 
 1174                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1176         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
 
 1177             Node emailMsgRootNode = resultsChilds.findChild(typeName);
 
 1178             Children emailMsgRootChilds = emailMsgRootNode.getChildren();
 
 1179             Map<String, String> parsedPath = null;
 
 1181                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1182                 for (BlackboardAttribute att : attributes) {
 
 1183                     int typeId = att.getAttributeType().getTypeID();
 
 1184                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) {
 
 1189                 if (parsedPath == null) {
 
 1192                 Node defaultNode = emailMsgRootChilds.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class, 
"EmailExtracted.defaultAcct.text")));
 
 1193                 Children defaultChildren = defaultNode.getChildren();
 
 1194                 treeNode = defaultChildren.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class, 
"EmailExtracted.defaultFolder.text")));
 
 1195             } 
catch (TskCoreException ex) {
 
 1196                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1199         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
 
 1200             Node accountRootNode = resultsChilds.findChild(art.getDisplayName());
 
 1201             Children accountRootChilds = accountRootNode.getChildren();
 
 1202             List<BlackboardAttribute> attributes;
 
 1203             String accountType = null;
 
 1204             String ccNumberName = null;
 
 1206                 attributes = art.getAttributes();
 
 1207                 for (BlackboardAttribute att : attributes) {
 
 1208                     int typeId = att.getAttributeType().getTypeID();
 
 1209                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID()) {
 
 1210                         accountType = att.getValueString();
 
 1212                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID()) {
 
 1213                         ccNumberName = att.getValueString();
 
 1216                 if (accountType == null) {
 
 1220                 if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) {
 
 1221                     Node accountNode = accountRootChilds.findChild(Account.Type.CREDIT_CARD.getDisplayName());
 
 1222                     if (accountNode == null) {
 
 1225                     Children accountChildren = accountNode.getChildren();
 
 1226                     if (accountChildren == null) {
 
 1229                     Node binNode = accountChildren.findChild(NbBundle.getMessage(
Accounts.class, 
"Accounts.ByBINNode.name"));
 
 1230                     if (binNode == null) {
 
 1233                     Children binChildren = binNode.getChildren();
 
 1234                     if (ccNumberName == null) {
 
 1239                     String binName = StringUtils.rightPad(ccNumberName, 8, 
"0");
 
 1240                     binName = binName.substring(0, 8);
 
 1243                         bin = Integer.parseInt(binName);
 
 1244                     } 
catch (NumberFormatException ex) {
 
 1245                         LOGGER.log(Level.WARNING, 
"Unable to parseInt a BIN for node selection from string binName=" + binName, ex); 
 
 1249                     if (binInfo != null) {
 
 1250                         int startBin = ((
BINRange) binInfo).getBINstart();
 
 1251                         int endBin = ((
BINRange) binInfo).getBINend();
 
 1252                         if (startBin != endBin) {
 
 1253                             binName = Integer.toString(startBin) + 
"-" + Integer.toString(endBin).substring(5); 
 
 1256                     if (binName == null) {
 
 1259                     treeNode = binChildren.findChild(binName);
 
 1261                     treeNode = accountRootChilds.findChild(accountType);
 
 1263             } 
catch (TskCoreException ex) {
 
 1264                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1268             Children extractedChilds = extractedContent.getChildren();
 
 1269             if (extractedChilds == null) {
 
 1272             treeNode = extractedChilds.findChild(typeName);
 
 1275         if (treeNode == null) {
 
 1279         DisplayableItemNode undecoratedParentNode = (DisplayableItemNode) ((DirectoryTreeFilterNode) treeNode).getOriginal();
 
 1281         getTree().expandNode(treeNode);
 
 1282         if (this.getSelectedNode().equals(treeNode)) {
 
 1283             this.setDirectoryListingActive();
 
 1284             this.respondSelection(em.getSelectedNodes(), 
new Node[]{treeNode});
 
 1287                 em.setExploredContextAndSelection(treeNode, 
new Node[]{treeNode});
 
 1288             } 
catch (PropertyVetoException ex) {
 
 1289                 LOGGER.log(Level.WARNING, 
"Property Veto: ", ex); 
 
 1297                 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
static synchronized IngestManager getInstance()
DataResultTopComponent getDirectoryListing()
final LinkedList< String[]> forwardList
void setDirectoryListingActive()
ExpansionBeanTreeView getTree()
static boolean runningWithGUI
void setShowRejected(boolean showRejected)
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)
void addIngestJobEventListener(final PropertyChangeListener listener)
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)
void addIngestModuleEventListener(final PropertyChangeListener listener)
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 final String HIDE_CENTRAL_REPO_COMMENTS_AND_OCCURRENCES
static boolean isCaseOpen()
void openViewPreferencesButtonActionPerformed(java.awt.event.ActionEvent evt)
void setNode(Node selectedNode)