diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java index 1e0c9c5621..d243bab86b 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java @@ -362,6 +362,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C this.rootNode.addNodeListener(dummyNodeListener); } + resetTabs(selectedNode); setupTabs(selectedNode); if (selectedNode != null) { @@ -369,58 +370,42 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C this.numberMatchLabel.setText(Integer.toString(childrenCount)); } this.numberMatchLabel.setVisible(true); - - - resetTabs(selectedNode); - - // set the display on the current active tab - int currentActiveTab = this.dataResultTabbedPanel.getSelectedIndex(); - if (currentActiveTab != -1) { - UpdateWrapper drv = viewers.get(currentActiveTab); - drv.setNode(selectedNode); - } } - private void setupTabs(final Node selectedNode) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - //update/disable tabs based on if supported for this node - int drvC = 0; - for (UpdateWrapper drv : viewers) { + private void setupTabs(Node selectedNode) { + //update/disable tabs based on if supported for this node + int drvC = 0; + for (UpdateWrapper drv : viewers) { - if (drv.isSupported(selectedNode)) { - dataResultTabbedPanel.setEnabledAt(drvC, true); - } else { - dataResultTabbedPanel.setEnabledAt(drvC, false); - } - ++drvC; - } + if (drv.isSupported(selectedNode)) { + dataResultTabbedPanel.setEnabledAt(drvC, true); + } else { + dataResultTabbedPanel.setEnabledAt(drvC, false); + } + ++drvC; + } - // if the current tab is no longer enabled, then find one that is - boolean hasViewerEnabled = true; - int currentActiveTab = dataResultTabbedPanel.getSelectedIndex(); - if ((currentActiveTab == -1) || (dataResultTabbedPanel.isEnabledAt(currentActiveTab) == false)) { - hasViewerEnabled = false; - for (int i = 0; i < dataResultTabbedPanel.getTabCount(); i++) { - if (dataResultTabbedPanel.isEnabledAt(i)) { - currentActiveTab = i; - hasViewerEnabled = true; - break; - } - } - - if (hasViewerEnabled) { - dataResultTabbedPanel.setSelectedIndex(currentActiveTab); - } - } - - if (hasViewerEnabled) { - viewers.get(currentActiveTab).setNode(selectedNode); + // if the current tab is no longer enabled, then find one that is + boolean hasViewerEnabled = true; + int currentActiveTab = dataResultTabbedPanel.getSelectedIndex(); + if ((currentActiveTab == -1) || (dataResultTabbedPanel.isEnabledAt(currentActiveTab) == false)) { + hasViewerEnabled = false; + for (int i = 0; i < dataResultTabbedPanel.getTabCount(); i++) { + if (dataResultTabbedPanel.isEnabledAt(i)) { + currentActiveTab = i; + hasViewerEnabled = true; + break; } } - }); - + + if (hasViewerEnabled) { + dataResultTabbedPanel.setSelectedIndex(currentActiveTab); + } + } + + if (hasViewerEnabled) { + viewers.get(currentActiveTab).setNode(selectedNode); + } } @Override @@ -622,12 +607,22 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C } @Override - public void childrenAdded(NodeMemberEvent nme) { + public void childrenAdded(final NodeMemberEvent nme) { Node[] delta = nme.getDelta(); if (load && containsReal(delta)) { load = false; - setupTabs(nme.getNode()); - updateMatches(); + if (SwingUtilities.isEventDispatchThread()) { + setupTabs(nme.getNode()); + updateMatches(); + } else { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + setupTabs(nme.getNode()); + updateMatches(); + } + }); + } } } @@ -645,14 +640,9 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C * */ private void updateMatches() { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (rootNode != null && rootNode.getChildren() != null) { - setNumMatches(rootNode.getChildren().getNodesCount()); - } - } - }); + if (rootNode != null && rootNode.getChildren() != null) { + setNumMatches(rootNode.getChildren().getNodesCount()); + } } @Override diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index 5b59f12812..475b6bc395 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -278,108 +278,103 @@ public class DataResultViewerTable extends AbstractDataResultViewer { * @param root The parent Node of the ContentNodes */ private void setupTable(final Node root) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - //wrap to filter out children - //note: this breaks the tree view mode in this generic viewer, - //so wrap nodes earlier if want 1 level view - //if (!(root instanceof TableFilterNode)) { - /// root = new TableFilterNode(root, true); - //} + //wrap to filter out children + //note: this breaks the tree view mode in this generic viewer, + //so wrap nodes earlier if want 1 level view + //if (!(root instanceof TableFilterNode)) { + /// root = new TableFilterNode(root, true); + //} - em.setRootContext(root); + em.setRootContext(root); - final OutlineView ov = ((OutlineView) DataResultViewerTable.this.tableScrollPanel); + final OutlineView ov = ((OutlineView) DataResultViewerTable.this.tableScrollPanel); + + if (ov == null) { + return; + } + + propertiesAcc.clear(); + + DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100); + List props = new ArrayList(propertiesAcc); + if (props.size() > 0) { + Node.Property prop = props.remove(0); + ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName()); + } + + + // *********** Make the TreeTableView to be sortable *************** + + //First property column is sortable, but also sorted initially, so + //initially this one will have the arrow icon: + if (props.size() > 0) { + props.get(0).setValue("TreeColumnTTV", Boolean.TRUE); // Identifies special property representing first (tree) column. + props.get(0).setValue("SortingColumnTTV", Boolean.TRUE); // TreeTableView should be initially sorted by this property column. + } + + // The rest of the columns are sortable, but not initially sorted, + // so initially will have no arrow icon: + String[] propStrings = new String[props.size() * 2]; + for (int i = 0; i < props.size(); i++) { + props.get(i).setValue("ComparableColumnTTV", Boolean.TRUE); + propStrings[2 * i] = props.get(i).getName(); + propStrings[2 * i + 1] = props.get(i).getDisplayName(); + } + + ov.setPropertyColumns(propStrings); + // ***************************************************************** + + // // set the first entry + // Children test = root.getChildren(); + // Node firstEntryNode = test.getNodeAt(0); + // try { + // this.getExplorerManager().setSelectedNodes(new Node[]{firstEntryNode}); + // } catch (PropertyVetoException ex) {} + + + // show the horizontal scroll panel and show all the content & header + + int totalColumns = props.size(); + + //int scrollWidth = ttv.getWidth(); + int margin = 4; + int startColumn = 1; - if (ov == null) { - return; - } - - propertiesAcc.clear(); - - DataResultViewerTable.this.getAllChildPropertyHeadersRec(root, 100); - List props = new ArrayList(propertiesAcc); - if (props.size() > 0) { - Node.Property prop = props.remove(0); - ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(prop.getDisplayName()); - } - - - // *********** Make the TreeTableView to be sortable *************** - - //First property column is sortable, but also sorted initially, so - //initially this one will have the arrow icon: - if (props.size() > 0) { - props.get(0).setValue("TreeColumnTTV", Boolean.TRUE); // Identifies special property representing first (tree) column. - props.get(0).setValue("SortingColumnTTV", Boolean.TRUE); // TreeTableView should be initially sorted by this property column. - } - - // The rest of the columns are sortable, but not initially sorted, - // so initially will have no arrow icon: - String[] propStrings = new String[props.size() * 2]; - for (int i = 0; i < props.size(); i++) { - props.get(i).setValue("ComparableColumnTTV", Boolean.TRUE); - propStrings[2 * i] = props.get(i).getName(); - propStrings[2 * i + 1] = props.get(i).getDisplayName(); - } - - ov.setPropertyColumns(propStrings); - // ***************************************************************** - - // // set the first entry - // Children test = root.getChildren(); - // Node firstEntryNode = test.getNodeAt(0); - // try { - // this.getExplorerManager().setSelectedNodes(new Node[]{firstEntryNode}); - // } catch (PropertyVetoException ex) {} - - - // show the horizontal scroll panel and show all the content & header - - int totalColumns = props.size(); - - //int scrollWidth = ttv.getWidth(); - int margin = 4; - int startColumn = 1; - - // If there is only one column (which was removed from props above) - // Just let the table resize itself. - ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS); + // If there is only one column (which was removed from props above) + // Just let the table resize itself. + ov.getOutline().setAutoResizeMode((props.size() > 0) ? JTable.AUTO_RESIZE_OFF : JTable.AUTO_RESIZE_ALL_COLUMNS); - // get first 100 rows values for the table - Object[][] content = null; - content = getRowValues(root, 100); + // get first 100 rows values for the table + Object[][] content = null; + content = getRowValues(root, 100); - if (content != null) { - // get the fontmetrics - final Graphics graphics = ov.getGraphics(); - if (graphics != null) { - final FontMetrics metrics = graphics.getFontMetrics(); + if (content != null) { + // get the fontmetrics + final Graphics graphics = ov.getGraphics(); + if (graphics != null) { + final FontMetrics metrics = graphics.getFontMetrics(); - // for the "Name" column - int nodeColWidth = Math.min(getMaxColumnWidth(0, metrics, margin, 40, firstColumnLabel, content), 250); // Note: 40 is the width of the icon + node lines. Change this value if those values change! - ov.getOutline().getColumnModel().getColumn(0).setPreferredWidth(nodeColWidth); + // for the "Name" column + int nodeColWidth = Math.min(getMaxColumnWidth(0, metrics, margin, 40, firstColumnLabel, content), 250); // Note: 40 is the width of the icon + node lines. Change this value if those values change! + ov.getOutline().getColumnModel().getColumn(0).setPreferredWidth(nodeColWidth); - // get the max for each other column - for (int colIndex = startColumn; colIndex <= totalColumns; colIndex++) { - int colWidth = Math.min(getMaxColumnWidth(colIndex, metrics, margin, 8, props, content), 350); - ov.getOutline().getColumnModel().getColumn(colIndex).setPreferredWidth(colWidth); - } - } - } - - // if there's no content just auto resize all columns - if (!(content.length > 0)) { - // turn on the auto resize - ov.getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + // get the max for each other column + for (int colIndex = startColumn; colIndex <= totalColumns; colIndex++) { + int colWidth = Math.min(getMaxColumnWidth(colIndex, metrics, margin, 8, props, content), 350); + ov.getOutline().getColumnModel().getColumn(colIndex).setPreferredWidth(colWidth); } } - }); + } + + // if there's no content just auto resize all columns + if (!(content.length > 0)) { + // turn on the auto resize + ov.getOutline().setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + } } private static Object[][] getRowValues(Node node, int rows) { @@ -492,11 +487,20 @@ public class DataResultViewerTable extends AbstractDataResultViewer { } @Override - public void childrenAdded(NodeMemberEvent nme) { + public void childrenAdded(final NodeMemberEvent nme) { Node[] delta = nme.getDelta(); if (load && containsReal(delta)) { load = false; - setupTable(nme.getNode()); + if (SwingUtilities.isEventDispatchThread()) { + setupTable(nme.getNode()); + } else { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + setupTable(nme.getNode()); + } + }); + } } } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ViewContextAction.java b/Core/src/org/sleuthkit/autopsy/directorytree/ViewContextAction.java index e03e869a97..e959e7e3ed 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ViewContextAction.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ViewContextAction.java @@ -24,12 +24,14 @@ import java.beans.PropertyVetoException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.concurrent.ExecutionException; import java.util.logging.Level; import org.sleuthkit.autopsy.coreutils.Logger; import javax.swing.AbstractAction; +import javax.swing.SwingWorker; +import org.openide.nodes.AbstractNode; import org.openide.explorer.ExplorerManager; import org.openide.explorer.view.TreeView; -import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; @@ -44,7 +46,14 @@ import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.VolumeSystem; /** - * View the directory content associated with the given Artifact + * View the directory content associated with the given Artifact in the DataResultViewer. + * + * 1. Expands the Directory Tree to the location of the parent Node of the + * associated Content. + * 2. Selects the parent Node of the associated Content in the Directory Tree, + * which causes the parent Node's Children to be visible in the DataResultViewer. + * 3. Waits for all the Children to be contentNode in the DataResultViewer and + * selects the Node that represents the Content. */ public class ViewContextAction extends AbstractAction { @@ -81,61 +90,116 @@ public class ViewContextAction extends AbstractAction { Node generated = new DirectoryTreeFilterNode(new AbstractNode(new RootContentChildren(hierarchy)), true); Children genChilds = generated.getChildren(); - final DirectoryTreeTopComponent directoryTree = DirectoryTreeTopComponent.findInstance(); - TreeView tree = directoryTree.getTree(); - ExplorerManager man = directoryTree.getExplorerManager(); - Node dirRoot = man.getRootContext(); - Children dirChilds = dirRoot.getChildren(); - Node imagesRoot = dirChilds.findChild(DataSourcesNode.NAME); - dirChilds = imagesRoot.getChildren(); + final DirectoryTreeTopComponent dirTree = DirectoryTreeTopComponent.findInstance(); + TreeView dirTreeView = dirTree.getTree(); + ExplorerManager dirTreeExplorerManager = dirTree.getExplorerManager(); + Node dirTreeRootNode = dirTreeExplorerManager.getRootContext(); + Children dirChilds = dirTreeRootNode.getChildren(); + Children currentChildren = dirChilds.findChild(DataSourcesNode.NAME).getChildren(); Node dirExplored = null; + // Find the parent node of the content in the directory tree for (int i = 0; i < genChilds.getNodesCount() - 1; i++) { Node currentGeneratedNode = genChilds.getNodeAt(i); - for (int j = 0; j < dirChilds.getNodesCount(); j++) { - Node currentDirectoryTreeNode = dirChilds.getNodeAt(j); + for (int j = 0; j < currentChildren.getNodesCount(); j++) { + Node currentDirectoryTreeNode = currentChildren.getNodeAt(j); if (currentGeneratedNode.getDisplayName().equals(currentDirectoryTreeNode.getDisplayName())) { dirExplored = currentDirectoryTreeNode; - tree.expandNode(dirExplored); - dirChilds = currentDirectoryTreeNode.getChildren(); + dirTreeView.expandNode(dirExplored); + currentChildren = currentDirectoryTreeNode.getChildren(); break; } } } + // Set the parent node of the content as the selection in the + // directory tree try { if (dirExplored != null) { - tree.expandNode(dirExplored); - man.setExploredContextAndSelection(dirExplored, new Node[]{dirExplored}); + dirTreeView.expandNode(dirExplored); + dirTreeExplorerManager.setExploredContextAndSelection(dirExplored, new Node[]{dirExplored}); } - } catch (PropertyVetoException ex) { logger.log(Level.WARNING, "Couldn't set selected node", ex); } - // Another thread is needed because we have to wait for dataResult to populate + EventQueue.invokeLater(new Runnable() { @Override public void run() { - DataResultTopComponent dataResult = directoryTree.getDirectoryListing(); - Node resultRoot = dataResult.getRootNode(); - Children resultChilds = resultRoot.getChildren(); - Node generated = content.accept(new RootContentChildren.CreateSleuthkitNodeVisitor()); - for (int i = 0; i < resultChilds.getNodesCount(); i++) { - Node current = resultChilds.getNodeAt(i); - if (generated.getName().equals(current.getName())) { - dataResult.requestActive(); - dataResult.setSelectedNodes(new Node[]{current}); - DirectoryTreeTopComponent.getDefault().fireViewerComplete(); - break; - } - } + DataResultTopComponent dataResultTC = dirTree.getDirectoryListing(); + Node currentRootNodeOfDataResultTC = dataResultTC.getRootNode(); + Node contentNode = content.accept(new RootContentChildren.CreateSleuthkitNodeVisitor()); + new SelectionWorker(dataResultTC, contentNode.getName(), currentRootNodeOfDataResultTC).execute(); } }); } }); } + + /** + * Waits for a Node's children to be generated, regardless of whether they + * are lazily loaded, then sets the correct selection in a specified + * DataResultTopComponent. + */ + private class SelectionWorker extends SwingWorker { + + DataResultTopComponent dataResultTC; + String nameOfNodeToSelect; + Node originalRootNodeOfDataResultTC; + + SelectionWorker(DataResultTopComponent dataResult, String nameToSelect, Node originalRoot) { + this.dataResultTC = dataResult; + this.nameOfNodeToSelect = nameToSelect; + this.originalRootNodeOfDataResultTC = originalRoot; + } + + @Override + protected Node[] doInBackground() throws Exception { + // Calls to Children::getNodes(true) block until all child Nodes have + // been created, regardless of whether they are created lazily. + // This means that this call will return the actual child Nodes + // and will *NEVER* return a proxy wait Node. This is done on the + // background thread to ensure we are not hanging the ui as it could + // be a lengthy operation. + return originalRootNodeOfDataResultTC.getChildren().getNodes(true); + } + + @Override + protected void done() { + Node[] nodesDisplayedInDataResultViewer; + try { + nodesDisplayedInDataResultViewer = get(); + } catch (InterruptedException | ExecutionException ex) { + logger.log(Level.WARNING, "Failed to get nodes in selection worker.", ex); + return; + } + + // It is possible the user selected a different Node to be displayed + // in the DataResultViewer while the child Nodes were being generated. + // In that case, we don't want to set the selection because it the + // nodes returned from get() won't be in the DataResultTopComponent's + // ExplorerManager. If we did call setSelectedNodes, it would clear + // the current selection, which is not good. + if (dataResultTC.getRootNode().equals(originalRootNodeOfDataResultTC) == false) { + return; + } + + // Find the correct node to select from the nodes that are displayed + // in the data result viewer and set it as the selection of the + // DataResultTopComponent. + for (Node node : nodesDisplayedInDataResultViewer) { + if (nameOfNodeToSelect.equals(node.getName())) { + dataResultTC.requestActive(); + dataResultTC.setSelectedNodes(new Node[]{node}); + DirectoryTreeTopComponent.getDefault().fireViewerComplete(); + break; + } + } + } + + } /** * The ReverseHierarchyVisitor class is designed to return a list of Content diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties index 1bfc26e95b..7b728c5005 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties @@ -38,7 +38,6 @@ KeywordSearchPanel.settingsLabel.text= KeywordSearchListsViewerPanel.searchAddButton.text=Search KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists KeywordSearchListsViewerPanel.ingestIndexLabel.text=Files Indexed: -KeywordSearchEditListPanel.selectorsCombo.toolTipText=Regular Expression selector type (optional) KeywordSearchPanel.searchButton.text= KeywordSearchPanel.cutMenuItem.text=Cut KeywordSearchPanel.copyMenuItem.text=Copy diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/JerichoParserWrapper.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/JerichoParserWrapper.java index aea91e3f5a..ba723ddff4 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/JerichoParserWrapper.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/JerichoParserWrapper.java @@ -26,10 +26,10 @@ import java.util.List; import java.util.logging.Level; import org.sleuthkit.autopsy.coreutils.Logger; import net.htmlparser.jericho.Attributes; +import net.htmlparser.jericho.Renderer; import net.htmlparser.jericho.Source; import net.htmlparser.jericho.StartTag; import net.htmlparser.jericho.StartTagType; -import net.htmlparser.jericho.TextExtractor; /** * Uses Jericho HTML Parser to create a Reader for output, consisting of @@ -46,6 +46,15 @@ public class JerichoParserWrapper { this.in = in; } + /** + * Returns the reader, initialized in parse(), which will be + * null if parse() is not called or if parse() throws an error. + * @return Reader + */ + public Reader getReader() { + return reader; + } + /** * Initialize the reader by parsing the InputStream, adding it to StringBuilder, * and creating a StringReader from it. @@ -57,7 +66,7 @@ public class JerichoParserWrapper { Source source = new Source(in); source.fullSequentialParse(); - StringBuilder text = new StringBuilder(); + String text; StringBuilder scripts = new StringBuilder(); StringBuilder links = new StringBuilder(); StringBuilder images = new StringBuilder(); @@ -68,14 +77,8 @@ public class JerichoParserWrapper { int numImages = 1; int numComments = 1; int numOthers = 1; - - // Extract text from the source - TextExtractor extractor = new TextExtractor(source); - // Split it at every ". " but keep the . - String[] lines = extractor.toString().split("(?<=\\. )"); - for(String s : lines) { - text.append(s).append("\n"); - } + + text = renderHTMLAsPlainText(source); // Get all the tags in the source List tags = source.getAllStartTags(); @@ -113,7 +116,7 @@ public class JerichoParserWrapper { } } - out.append(text.toString()).append("\n"); + out.append(text).append("\n\n"); out.append("----------NONVISIBLE TEXT----------\n\n"); if(numScripts>1) { @@ -139,13 +142,14 @@ public class JerichoParserWrapper { } } - /** - * Returns the reader, initialized in parse(), which will be - * null if parse() is not called or if parse() throws an error. - * @return Reader - */ - public Reader getReader() { - return reader; + // Extract text from the source, nicely formatted with whitespace and + // newlines where appropriate. + private String renderHTMLAsPlainText(Source source) { + Renderer renderer = source.getRenderer(); + renderer.setNewLine("\n"); + renderer.setIncludeHyperlinkURLs(false); + renderer.setDecorateFontStyles(false); + renderer.setIncludeAlternateText(false); + return renderer.toString(); } - } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form index 326354f950..8e9ae1651c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.form @@ -206,20 +206,16 @@ - + - + - - - - - + @@ -234,10 +230,7 @@ - - - - + @@ -276,19 +269,6 @@ - - - - - - - - - - - - - diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java index a720dde3ba..ce91aefd16 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchEditListPanel.java @@ -126,18 +126,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec break; } } - if (selected > -1 && selected < keywords.size()) { - Keyword k = keywords.get(selected); - BlackboardAttribute.ATTRIBUTE_TYPE selType = k.getType(); - if (selType != null) { - selectorsCombo.setSelectedIndex(selType.ordinal()); - } else { - //set to none (last item) - selectorsCombo.setSelectedIndex(selectorsCombo.getItemCount() - 1); - } - } - - } } }); @@ -195,15 +183,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec } } }); - - //selectors - selectorsCombo.setEnabled(false); - for (BlackboardAttribute.ATTRIBUTE_TYPE type : BlackboardAttribute.ATTRIBUTE_TYPE.values()) { - selectorsCombo.addItem(type.getDisplayName()); - } - selectorsCombo.addItem(""); - selectorsCombo.setSelectedIndex(selectorsCombo.getItemCount() - 1); - } /** @@ -251,7 +230,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec chRegex.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked); keywordOptionsLabel.setEnabled(addWordButton.isEnabled() || chRegex.isEnabled()); keywordOptionsSeparator.setEnabled(addWordButton.isEnabled() || chRegex.isEnabled()); - selectorsCombo.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked && chRegex.isSelected()); useForIngestCheckbox.setEnabled(listSet && (!ingestOngoing || !inIngest)); useForIngestCheckbox.setSelected(useForIngest); ingestMessagesCheckbox.setEnabled(useForIngestCheckbox.isEnabled() && useForIngestCheckbox.isSelected()); @@ -295,7 +273,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec addWordButton = new javax.swing.JButton(); addWordField = new javax.swing.JTextField(); chRegex = new javax.swing.JCheckBox(); - selectorsCombo = new javax.swing.JComboBox(); deleteWordButton = new javax.swing.JButton(); ingestMessagesCheckbox = new javax.swing.JCheckBox(); keywordsLabel = new javax.swing.JLabel(); @@ -359,8 +336,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec } }); - selectorsCombo.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.selectorsCombo.toolTipText")); // NOI18N - deleteWordButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.deleteWordButton.text")); // NOI18N deleteWordButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -373,17 +348,14 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec addKeywordPanelLayout.setHorizontalGroup( addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(addKeywordPanelLayout.createSequentialGroup() - .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(addKeywordPanelLayout.createSequentialGroup() - .addComponent(addWordField) + .addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(addWordButton)) .addComponent(deleteWordButton)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addKeywordPanelLayout.createSequentialGroup() - .addComponent(chRegex) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(selectorsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(chRegex, javax.swing.GroupLayout.Alignment.LEADING)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); addKeywordPanelLayout.setVerticalGroup( @@ -394,9 +366,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec .addComponent(addWordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(addWordButton)) .addGap(7, 7, 7) - .addGroup(addKeywordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(selectorsCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(chRegex)) + .addComponent(chRegex) .addGap(7, 7, 7) .addComponent(deleteWordButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) @@ -515,14 +485,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec String newWord = addWordField.getText().trim(); boolean isLiteral = !chRegex.isSelected(); final Keyword keyword = new Keyword(newWord, isLiteral); - if (!isLiteral) { - //get selector - int selI = this.selectorsCombo.getSelectedIndex(); - if (selI < this.selectorsCombo.getItemCount() - 1) { - BlackboardAttribute.ATTRIBUTE_TYPE selector = BlackboardAttribute.ATTRIBUTE_TYPE.values()[selI]; - keyword.setType(selector); - } - } if (newWord.equals("")) { return; @@ -620,7 +582,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec }//GEN-LAST:event_exportButtonActionPerformed private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed - selectorsCombo.setEnabled(chRegex.isEnabled() && chRegex.isSelected()); }//GEN-LAST:event_chRegexActionPerformed private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useForIngestCheckboxActionPerformed @@ -659,7 +620,6 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JPopupMenu rightClickMenu; private javax.swing.JButton saveListButton; private javax.swing.JMenuItem selectAllMenuItem; - private javax.swing.JComboBox selectorsCombo; private javax.swing.JCheckBox useForIngestCheckbox; // End of variables declaration//GEN-END:variables