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.tree.TreeSelectionModel;
 
   44 import org.apache.commons.lang3.StringUtils;
 
   45 import org.openide.explorer.ExplorerManager;
 
   46 import org.openide.explorer.ExplorerUtils;
 
   47 import org.openide.explorer.view.BeanTreeView;
 
   48 import org.openide.explorer.view.TreeView;
 
   49 import org.openide.nodes.AbstractNode;
 
   50 import org.openide.nodes.Children;
 
   51 import org.openide.nodes.Node;
 
   52 import org.openide.nodes.NodeNotFoundException;
 
   53 import org.openide.nodes.NodeOp;
 
   54 import org.openide.util.NbBundle;
 
   55 import org.openide.util.NbBundle.Messages;
 
   56 import org.openide.windows.TopComponent;
 
   57 import org.openide.windows.WindowManager;
 
   98     "DirectoryTreeTopComponent.resultsView.title=Listing" 
  100 @SuppressWarnings(
"PMD.SingularField") 
 
  103     private final transient ExplorerManager em = 
new ExplorerManager();
 
  109     private static final String PREFERRED_ID = 
"DirectoryTreeTopComponent"; 
 
  115     private static final long DEFAULT_DATASOURCE_GROUPING_THRESHOLD = 5; 
 
  116     private static final String GROUPING_THRESHOLD_NAME = 
"GroupDataSourceThreshold";
 
  117     private static final String SETTINGS_FILE = 
"CasePreferences.properties"; 
 
  126         getTree().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 
  128         putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
 
  132         subscribeToChangeEvents();
 
  133         associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
 
  136         this.backList = 
new LinkedList<>();
 
  137         this.forwardList = 
new LinkedList<>();
 
  138         backButton.setEnabled(
false);
 
  139         forwardButton.setEnabled(
false);
 
  141         viewPreferencesPopupMenu.add(viewPreferencesPanel);
 
  142         viewPreferencesPopupMenu.setSize(viewPreferencesPanel.getPreferredSize().width + 6, viewPreferencesPanel.getPreferredSize().height + 6);
 
  143         viewPreferencesPopupMenu.addPopupMenuListener(
new PopupMenuListener() {
 
  145             public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
 
  146                 openViewPreferencesButton.setSelected(
true);
 
  150             public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
 
  151                 openViewPreferencesButton.setSelected(
false);
 
  155             public void popupMenuCanceled(PopupMenuEvent e) {
 
  156                 openViewPreferencesButton.setSelected(
false);
 
  167             public void preferenceChange(PreferenceChangeEvent evt) {
 
  168                 switch (evt.getKey()) {
 
  174                         refreshContentTreeSafe();
 
  182                         refreshContentTreeSafe();
 
  189         this.em.addPropertyChangeListener(
this);
 
  195         this.dataResult.requestActive();
 
  199         this.dataResult.
open();
 
  203         return this.dataResult;
 
  212         return showRejectedResults;
 
  222         this.showRejectedResults = showRejectedResults;
 
  223         if (accounts != null) {
 
  236         viewPreferencesPopupMenu = 
new javax.swing.JPopupMenu();
 
  237         treeView = 
new BeanTreeView();
 
  238         backButton = 
new javax.swing.JButton();
 
  239         forwardButton = 
new javax.swing.JButton();
 
  240         openViewPreferencesButton = 
new javax.swing.JButton();
 
  242         treeView.setBorder(null);
 
  244         backButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back.png"))); 
 
  245         org.openide.awt.Mnemonics.setLocalizedText(backButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.backButton.text")); 
 
  246         backButton.setBorderPainted(
false);
 
  247         backButton.setContentAreaFilled(
false);
 
  248         backButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_disabled.png"))); 
 
  249         backButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
 
  250         backButton.setMaximumSize(
new java.awt.Dimension(55, 100));
 
  251         backButton.setMinimumSize(
new java.awt.Dimension(5, 5));
 
  252         backButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  253         backButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_back_hover.png"))); 
 
  254         backButton.addActionListener(
new java.awt.event.ActionListener() {
 
  255             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  256                 backButtonActionPerformed(evt);
 
  260         forwardButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward.png"))); 
 
  261         org.openide.awt.Mnemonics.setLocalizedText(forwardButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.forwardButton.text")); 
 
  262         forwardButton.setBorderPainted(
false);
 
  263         forwardButton.setContentAreaFilled(
false);
 
  264         forwardButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_disabled.png"))); 
 
  265         forwardButton.setMargin(
new java.awt.Insets(2, 0, 2, 0));
 
  266         forwardButton.setMaximumSize(
new java.awt.Dimension(55, 100));
 
  267         forwardButton.setMinimumSize(
new java.awt.Dimension(5, 5));
 
  268         forwardButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  269         forwardButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/btn_step_forward_hover.png"))); 
 
  270         forwardButton.addActionListener(
new java.awt.event.ActionListener() {
 
  271             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  272                 forwardButtonActionPerformed(evt);
 
  276         openViewPreferencesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/directorytree/view-preferences-23.png"))); 
 
  277         org.openide.awt.Mnemonics.setLocalizedText(openViewPreferencesButton, 
org.openide.util.NbBundle.getMessage(
DirectoryTreeTopComponent.class, 
"DirectoryTreeTopComponent.openViewPreferencesButton.text")); 
 
  278         openViewPreferencesButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
 
  279         openViewPreferencesButton.setBorderPainted(
false);
 
  280         openViewPreferencesButton.setContentAreaFilled(
false);
 
  281         openViewPreferencesButton.setMaximumSize(
new java.awt.Dimension(24, 24));
 
  282         openViewPreferencesButton.setMinimumSize(
new java.awt.Dimension(24, 24));
 
  283         openViewPreferencesButton.setPreferredSize(
new java.awt.Dimension(24, 24));
 
  284         openViewPreferencesButton.addActionListener(
new java.awt.event.ActionListener() {
 
  285             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  286                 openViewPreferencesButtonActionPerformed(evt);
 
  290         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(
this);
 
  291         this.setLayout(layout);
 
  292         layout.setHorizontalGroup(
 
  293             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  294             .addComponent(treeView)
 
  295             .addGroup(layout.createSequentialGroup()
 
  297                 .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  298                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  299                 .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  300                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
 
  301                 .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  304         layout.setVerticalGroup(
 
  305             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  306             .addGroup(layout.createSequentialGroup()
 
  308                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  309                     .addComponent(openViewPreferencesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  310                     .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  311                     .addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 
  312                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  313                 .addComponent(treeView, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
 
  319         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  322         String[] currentNodePath = backList.pollLast();
 
  323         forwardList.addLast(currentNodePath);
 
  324         forwardButton.setEnabled(
true);
 
  331         String[] newCurrentNodePath = backList.peekLast();
 
  334         if (backList.size() > 1) {
 
  335             backButton.setEnabled(
true);
 
  337             backButton.setEnabled(
false);
 
  341         setSelectedNode(newCurrentNodePath, null);
 
  343         this.setCursor(null);
 
  348         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  350         String[] newCurrentNodePath = forwardList.pollLast();
 
  351         if (!forwardList.isEmpty()) {
 
  352             forwardButton.setEnabled(
true);
 
  354             forwardButton.setEnabled(
false);
 
  357         backList.addLast(newCurrentNodePath);
 
  358         backButton.setEnabled(
true);
 
  361         setSelectedNode(newCurrentNodePath, null);
 
  363         this.setCursor(null);
 
  367         viewPreferencesPanel.
load();
 
  368         viewPreferencesPopupMenu.show(openViewPreferencesButton, 0, openViewPreferencesButton.getHeight() - 1);
 
  388         if (instance == null) {
 
  401         WindowManager winManager = WindowManager.
getDefault();
 
  402         TopComponent win = winManager.findTopComponent(PREFERRED_ID);
 
  405                     "Cannot find " + PREFERRED_ID + 
" component. It will not be located properly in the window system."); 
 
  409             return (DirectoryTreeTopComponent) win;
 
  412                 "There seem to be multiple components with the '" + PREFERRED_ID 
 
  413                 + 
"' ID. That is a potential source of errors and unexpected behavior."); 
 
  425         return TopComponent.PERSISTENCE_NEVER;
 
  436             GroupDataSourcesDialog dialog = 
new GroupDataSourcesDialog(dataSourceCount);
 
  438             if (dialog.groupByDataSourceSelected()) {
 
  440                 refreshContentTreeSafe();
 
  454     @NbBundle.Messages({
"# {0} - dataSourceCount",
 
  455         "DirectoryTreeTopComponent.componentOpened.groupDataSources.text=This case contains {0} data sources. Would you like to group by data source for faster loading?",
 
  456         "DirectoryTreeTopComponent.componentOpened.groupDataSources.title=Group by data source?"})
 
  460         this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  461         Case currentCase = null;
 
  469         if (null == currentCase || currentCase.hasData() == 
false) {
 
  470             getTree().setRootVisible(
false); 
 
  475                 long threshold = DEFAULT_DATASOURCE_GROUPING_THRESHOLD;
 
  479                     } 
catch (NumberFormatException ex) {
 
  480                         LOGGER.log(Level.SEVERE, 
"Group data sources threshold is not a number", ex);
 
  487                     int dataSourceCount = currentCase.getDataSources().size();
 
  489                             && dataSourceCount > threshold) {
 
  490                         promptForDataSourceGrouping(dataSourceCount);
 
  492                 } 
catch (TskCoreException ex) {
 
  493                     LOGGER.log(Level.SEVERE, 
"Error loading data sources", ex);
 
  499             autopsyTreeChildren = Children.create(autopsyTreeChildFactory, 
true);
 
  500             Node root = 
new AbstractNode(autopsyTreeChildren) {
 
  507                 public Action[] getActions(
boolean popup) {
 
  508                     return new Action[]{};
 
  514                 public Node.Handle getHandle() {
 
  515                     return new Node.Handle() {
 
  517                         public Node getNode() 
throws IOException {
 
  518                             return em.getRootContext();
 
  524             root = 
new DirectoryTreeFilterNode(root, 
true);
 
  526             em.setRootContext(root);
 
  527             em.getRootContext().setName(currentCase.getName());
 
  528             em.getRootContext().setDisplayName(currentCase.getName());
 
  529             getTree().setRootVisible(
false); 
 
  533             new SwingWorker<Node[], Void>() {
 
  535                 protected Node[] doInBackground() 
throws Exception {
 
  536                     Children rootChildren = em.getRootContext().getChildren();
 
  537                     TreeView tree = getTree();
 
  540                     if (!Objects.isNull(results)) {
 
  541                         tree.expandNode(results);
 
  542                         Children resultsChildren = results.getChildren();
 
  543                         Arrays.stream(resultsChildren.getNodes()).forEach(tree::expandNode);
 
  549                     if (!Objects.isNull(views)) {
 
  550                         Arrays.stream(views.getChildren().getNodes()).forEach(tree::expandNode);
 
  551                         tree.collapseNode(views);
 
  562                     if (rootChildren.getNodesCount() > 0) {
 
  563                         return new Node[]{rootChildren.getNodeAt(0)};
 
  569                 protected void done() {
 
  573                     if (!dataResult.isOpened()) {
 
  584                         Node[] selections = 
get();
 
  585                         if (selections != null && selections.length > 0) {
 
  586                             em.setSelectedNodes(selections);
 
  588                     } 
catch (PropertyVetoException ex) {
 
  589                         LOGGER.log(Level.SEVERE, 
"Error setting default selected node.", ex); 
 
  590                     } 
catch (InterruptedException | ExecutionException ex) {
 
  591                         LOGGER.log(Level.SEVERE, 
"Error expanding tree to initial state.", ex); 
 
  609         autopsyTreeChildren = null;
 
  612     void writeProperties(java.util.Properties p) {
 
  615         p.setProperty(
"version", 
"1.0");
 
  619     Object readProperties(java.util.Properties p) {
 
  620         if (instance == null) {
 
  628         String version = p.getProperty(
"version");
 
  651             return openCase.
hasData() == 
false;
 
  674         return new Action[]{};
 
  685         Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
 
  686         if (selectedNodes.length > 0) {
 
  687             result = selectedNodes[0];
 
  701             String changed = 
event.getPropertyName();
 
  711                 if (event.getOldValue() != null && 
event.getNewValue() == null) {
 
  713                     SwingUtilities.invokeLater(() -> {
 
  714                         Node emptyNode = 
new AbstractNode(Children.LEAF);
 
  715                         em.setRootContext(emptyNode);
 
  717                 } 
else if (event.getNewValue() != null) {
 
  719                     Case newCase = (
Case) event.getNewValue();
 
  720                     final String newCaseName = newCase.
getName();
 
  721                     SwingUtilities.invokeLater(() -> {
 
  722                         em.getRootContext().setName(newCaseName);
 
  723                         em.getRootContext().setDisplayName(newCaseName);
 
  753                     SwingUtilities.invokeLater(() -> {
 
  764             else if (changed.equals(ExplorerManager.PROP_SELECTED_NODES)) {
 
  765                 respondSelection((Node[]) event.getOldValue(), (Node[]) event.getNewValue());
 
  781     @NbBundle.Messages(
"DirectoryTreeTopComponent.emptyMimeNode.text=Data not available. Run file type identification module.")
 
  782     void respondSelection(
final Node[] oldNodes, 
final Node[] newNodes) {
 
  792         EventQueue.invokeLater(() -> {
 
  794             DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 
  796                 Node treeNode = DirectoryTreeTopComponent.this.getSelectedNode();
 
  797                 if (treeNode != null) {
 
  798                     Node originNode = ((DirectoryTreeFilterNode) treeNode).getOriginal();
 
  800                     Node drfn = 
new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em);
 
  802                     if (FileTypesByMimeType.isEmptyMimeTypeNode(originNode)) {
 
  805                         EmptyNode emptyNode = 
new EmptyNode(Bundle.DirectoryTreeTopComponent_emptyMimeNode_text());
 
  806                         dataResult.
setNode(
new TableFilterNode(emptyNode, 
true, 
"This Node Is Empty")); 
 
  807                     } 
else if (originNode instanceof DisplayableItemNode) {
 
  808                         dataResult.
setNode(
new TableFilterNode(drfn, 
true, ((DisplayableItemNode) originNode).getItemType()));
 
  810                         dataResult.
setNode(
new TableFilterNode(drfn, 
true));
 
  812                     String displayName = 
"";
 
  813                     Content content = originNode.getLookup().lookup(Content.class);
 
  814                     if (content != null) {
 
  816                             displayName = content.getUniquePath();
 
  817                         } 
catch (TskCoreException ex) {
 
  818                             LOGGER.log(Level.SEVERE, 
"Exception while calling Content.getUniquePath() for node: {0}", originNode); 
 
  820                     } 
else if (originNode.getLookup().lookup(String.class) != null) {
 
  821                         displayName = originNode.getLookup().lookup(String.class);
 
  823                     dataResult.
setPath(displayName);
 
  826                 if (oldNodes != null && newNodes != null
 
  827                         && (oldNodes.length == newNodes.length)) {
 
  828                     boolean sameNodes = 
true;
 
  829                     for (
int i = 0; i < oldNodes.length; i++) {
 
  830                         sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
 
  833                         dataResult.requestActive();
 
  842         updateHistory(em.getSelectedNodes());
 
  846         if (selectedNodes.length == 0) {
 
  850         Node selectedNode = selectedNodes[0];
 
  851         String selectedNodeName = selectedNode.getName();
 
  859         String[] currentLast = backList.peekLast();
 
  860         String lastNodeName = null;
 
  861         if (currentLast != null && currentLast.length > 0) {
 
  862             lastNodeName = currentLast[currentLast.length - 1];
 
  865         if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
 
  867             final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
 
  868             backList.addLast(selectedPath); 
 
  869             if (backList.size() > 1) {
 
  870                 backButton.setEnabled(
true);
 
  872                 backButton.setEnabled(
false);
 
  876             forwardButton.setEnabled(
false); 
 
  888         backButton.setEnabled(
false);
 
  889         forwardButton.setEnabled(
false);
 
  898         return (BeanTreeView) this.treeView;
 
  905         SwingUtilities.invokeLater(this::rebuildTree);
 
  912         SwingUtilities.invokeLater(() -> {
 
  914             if (autopsyTreeChildren == null) {
 
  919                 for (Node dataSource : autopsyTreeChildren.getNodes()) {
 
  921                     if (tagsNode != null) {
 
  928                     if (tagsNode != null) {
 
  949         if (null == currentCase || currentCase.
hasData() == 
false) {
 
  959         new SwingWorker<Void, Void>() {
 
  962             protected Void doInBackground() 
throws Exception {
 
  967             protected void done() {
 
  971                     selectFirstChildNode();
 
  973                 } 
catch (InterruptedException | ExecutionException ex) {
 
  974                     LOGGER.log(Level.SEVERE, 
"Error selecting tree node.", ex); 
 
  985         Children rootChildren = em.getRootContext().getChildren();
 
  987         if (rootChildren.getNodesCount() > 0) {
 
  988             Node firstNode = rootChildren.getNodeAt(0);
 
  989             if (firstNode != null) {
 
  990                 final String[] selectedPath = NodeOp.createPath(firstNode, em.getRootContext());
 
  991                 setSelectedNode(selectedPath, null);
 
 1003     private void setSelectedNode(
final String[] previouslySelectedNodePath, 
final String rootNodeName) {
 
 1004         if (previouslySelectedNodePath == null) {
 
 1007         SwingUtilities.invokeLater(
new Runnable() {
 
 1010                 if (previouslySelectedNodePath.length > 0 && (rootNodeName == null || previouslySelectedNodePath[0].equals(rootNodeName))) {
 
 1011                     Node selectedNode = null;
 
 1012                     ArrayList<String> selectedNodePath = 
new ArrayList<>(Arrays.asList(previouslySelectedNodePath));
 
 1013                     while (null == selectedNode && !selectedNodePath.isEmpty()) {
 
 1015                             selectedNode = NodeOp.findPath(em.getRootContext(), selectedNodePath.toArray(
new String[selectedNodePath.size()]));
 
 1016                         } 
catch (NodeNotFoundException ex) {
 
 1018                             if (selectedNodePath.size() > 1) {
 
 1019                                 selectedNodePath.remove(selectedNodePath.size() - 1);
 
 1021                                 StringBuilder nodePath = 
new StringBuilder();
 
 1022                                 for (
int i = 0; i < previouslySelectedNodePath.length; ++i) {
 
 1023                                     nodePath.append(previouslySelectedNodePath[i]).append(
"/");
 
 1025                                 LOGGER.log(Level.WARNING, 
"Failed to find any nodes to select on path " + nodePath.toString(), ex); 
 
 1031                     if (null != selectedNode) {
 
 1032                         if (rootNodeName != null) {
 
 1035                             backList.pollLast();
 
 1038                             em.setExploredContextAndSelection(selectedNode, 
new Node[]{selectedNode});
 
 1039                         } 
catch (PropertyVetoException ex) {
 
 1040                             LOGGER.log(Level.WARNING, 
"Property veto from ExplorerManager setting selection to " + selectedNode.getName(), ex); 
 
 1059         int typeID = art.getArtifactTypeID();
 
 1060         String typeName = art.getArtifactTypeName();
 
 1061         Children rootChilds = em.getRootContext().getChildren();
 
 1062         Node treeNode = null;
 
 1064         Children resultsChilds = resultsNode.getChildren();
 
 1065         if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
 
 1066             Node hashsetRootNode = resultsChilds.findChild(typeName);
 
 1067             Children hashsetRootChilds = hashsetRootNode.getChildren();
 
 1069                 String setName = null;
 
 1070                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1071                 for (BlackboardAttribute att : attributes) {
 
 1072                     int typeId = att.getAttributeType().getTypeID();
 
 1073                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1074                         setName = att.getValueString();
 
 1077                 treeNode = hashsetRootChilds.findChild(setName);
 
 1078             } 
catch (TskCoreException ex) {
 
 1079                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1081         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
 
 1082             Node keywordRootNode = resultsChilds.findChild(typeName);
 
 1083             Children keywordRootChilds = keywordRootNode.getChildren();
 
 1085                 String listName = null;
 
 1086                 String keywordName = null;
 
 1087                 String regex = null;
 
 1088                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1089                 for (BlackboardAttribute att : attributes) {
 
 1090                     int typeId = att.getAttributeType().getTypeID();
 
 1091                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1092                         listName = att.getValueString();
 
 1093                     } 
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
 
 1094                         keywordName = att.getValueString();
 
 1095                     } 
else if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
 
 1096                         regex = att.getValueString();
 
 1099                 if (listName == null) {
 
 1100                     if (regex == null) {  
 
 1101                         listName = NbBundle.getMessage(
KeywordHits.class, 
"KeywordHits.simpleLiteralSearch.text");
 
 1103                         listName = NbBundle.getMessage(
KeywordHits.class, 
"KeywordHits.singleRegexSearch.text");
 
 1106                 Node listNode = keywordRootChilds.findChild(listName);
 
 1107                 if (listNode == null) {
 
 1110                 Children listChildren = listNode.getChildren();
 
 1111                 if (listChildren == null) {
 
 1114                 if (regex != null) {  
 
 1115                     Node regexNode = listChildren.findChild(regex);
 
 1116                     if (regexNode == null) {
 
 1119                     listChildren = regexNode.getChildren();
 
 1120                     if (listChildren == null) {
 
 1125                 treeNode = listChildren.findChild(keywordName);
 
 1127             } 
catch (TskCoreException ex) {
 
 1128                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1130         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID()
 
 1131                 || typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID()) {
 
 1132             Node interestingItemsRootNode = resultsChilds.findChild(NbBundle
 
 1133                     .getMessage(
InterestingHits.class, 
"InterestingHits.interestingItems.text"));
 
 1134             Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
 
 1136                 String setName = null;
 
 1137                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1138                 for (BlackboardAttribute att : attributes) {
 
 1139                     int typeId = att.getAttributeType().getTypeID();
 
 1140                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID()) {
 
 1141                         setName = att.getValueString();
 
 1144                 Node setNode = interestingItemsRootChildren.findChild(setName);
 
 1145                 if (setNode == null) {
 
 1148                 Children interestingChildren = setNode.getChildren();
 
 1149                 if (interestingChildren == null) {
 
 1152                 treeNode = interestingChildren.findChild(art.getDisplayName());
 
 1153             } 
catch (TskCoreException ex) {
 
 1154                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1156         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
 
 1157             Node emailMsgRootNode = resultsChilds.findChild(typeName);
 
 1158             Children emailMsgRootChilds = emailMsgRootNode.getChildren();
 
 1159             Map<String, String> parsedPath = null;
 
 1161                 List<BlackboardAttribute> attributes = art.getAttributes();
 
 1162                 for (BlackboardAttribute att : attributes) {
 
 1163                     int typeId = att.getAttributeType().getTypeID();
 
 1164                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID()) {
 
 1169                 if (parsedPath == null) {
 
 1172                 Node defaultNode = emailMsgRootChilds.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class, 
"EmailExtracted.defaultAcct.text")));
 
 1173                 Children defaultChildren = defaultNode.getChildren();
 
 1174                 treeNode = defaultChildren.findChild(parsedPath.get(NbBundle.getMessage(
EmailExtracted.class, 
"EmailExtracted.defaultFolder.text")));
 
 1175             } 
catch (TskCoreException ex) {
 
 1176                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1179         } 
else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
 
 1180             Node accountRootNode = resultsChilds.findChild(art.getDisplayName());
 
 1181             Children accountRootChilds = accountRootNode.getChildren();
 
 1182             List<BlackboardAttribute> attributes;
 
 1183             String accountType = null;
 
 1184             String ccNumberName = null;
 
 1186                 attributes = art.getAttributes();
 
 1187                 for (BlackboardAttribute att : attributes) {
 
 1188                     int typeId = att.getAttributeType().getTypeID();
 
 1189                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID()) {
 
 1190                         accountType = att.getValueString();
 
 1192                     if (typeId == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID()) {
 
 1193                         ccNumberName = att.getValueString();
 
 1196                 if (accountType == null) {
 
 1200                 if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) {
 
 1201                     Node accountNode = accountRootChilds.findChild(Account.Type.CREDIT_CARD.getDisplayName());
 
 1202                     if (accountNode == null) {
 
 1205                     Children accountChildren = accountNode.getChildren();
 
 1206                     if (accountChildren == null) {
 
 1209                     Node binNode = accountChildren.findChild(NbBundle.getMessage(
Accounts.class, 
"Accounts.ByBINNode.name"));
 
 1210                     if (binNode == null) {
 
 1213                     Children binChildren = binNode.getChildren();
 
 1214                     if (ccNumberName == null) {
 
 1219                     String binName = StringUtils.rightPad(ccNumberName, 8, 
"0");
 
 1220                     binName = binName.substring(0, 8);
 
 1223                         bin = Integer.parseInt(binName);
 
 1224                     } 
catch (NumberFormatException ex) {
 
 1225                         LOGGER.log(Level.WARNING, 
"Unable to parseInt a BIN for node selection from string binName=" + binName, ex); 
 
 1229                     if (binInfo != null) {
 
 1230                         int startBin = ((
BINRange) binInfo).getBINstart();
 
 1231                         int endBin = ((
BINRange) binInfo).getBINend();
 
 1232                         if (startBin != endBin) {
 
 1233                             binName = Integer.toString(startBin) + 
"-" + Integer.toString(endBin).substring(5); 
 
 1236                     if (binName == null) {
 
 1239                     treeNode = binChildren.findChild(binName);
 
 1241                     treeNode = accountRootChilds.findChild(accountType);
 
 1243             } 
catch (TskCoreException ex) {
 
 1244                 LOGGER.log(Level.WARNING, 
"Error retrieving attributes", ex); 
 
 1248             Children extractedChilds = extractedContent.getChildren();
 
 1249             if (extractedChilds == null) {
 
 1252             treeNode = extractedChilds.findChild(typeName);
 
 1255         if (treeNode == null) {
 
 1259         DisplayableItemNode undecoratedParentNode = (DisplayableItemNode) ((DirectoryTreeFilterNode) treeNode).getOriginal();
 
 1261         getTree().expandNode(treeNode);
 
 1262         if (this.getSelectedNode().equals(treeNode)) {
 
 1263             this.setDirectoryListingActive();
 
 1264             this.respondSelection(em.getSelectedNodes(), 
new Node[]{treeNode});
 
 1267                 em.setExploredContextAndSelection(treeNode, 
new Node[]{treeNode});
 
 1268             } 
catch (PropertyVetoException ex) {
 
 1269                 LOGGER.log(Level.WARNING, 
"Property Veto: ", ex); 
 
 1277                 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()
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
void selectFirstChildNode()
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)
void promptForDataSourceGrouping(int dataSourceCount)
ExplorerManager getExplorerManager()
javax.swing.JButton backButton
static final String HIDE_SLACK_FILES_IN_DATA_SRCS_TREE
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 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)