6305 first batch of codacy fixes

This commit is contained in:
William Schaefer 2020-06-04 20:38:38 -04:00
parent 2af7b14da9
commit 628c2384d4
15 changed files with 150 additions and 131 deletions

View File

@ -53,7 +53,7 @@ final class DetailsPanel extends javax.swing.JPanel {
private final DataContentPanel dataContentPanel; private final DataContentPanel dataContentPanel;
private final DefaultListModel<AbstractFile> instancesListModel = new DefaultListModel<>(); private final DefaultListModel<AbstractFile> instancesListModel = new DefaultListModel<>();
private ListSelectionListener listener = null; private final ListSelectionListener listener;
/** /**
* Creates new form DetailsPanel. * Creates new form DetailsPanel.

View File

@ -166,6 +166,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/discovery/Bundle.properties" key="DiscoveryDialog.step1Label.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/discovery/Bundle.properties" key="DiscoveryDialog.step1Label.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.Box$Filler" name="filler1"> <Component class="javax.swing.Box$Filler" name="filler1">
<Properties> <Properties>
@ -180,12 +184,18 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/> <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/>
</AuxValues> </AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="jPanel1"> <Container class="javax.swing.JPanel" name="displaySettingsPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/> <BorderConstraints direction="Last"/>

View File

@ -23,27 +23,19 @@ import java.awt.Color;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JOptionPane;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.discovery.FileGroup.GroupSortingAlgorithm; import org.sleuthkit.autopsy.discovery.FileGroup.GroupSortingAlgorithm;
import org.sleuthkit.autopsy.discovery.FileSearch.GroupingAttributeType; import org.sleuthkit.autopsy.discovery.FileSearch.GroupingAttributeType;
import org.sleuthkit.autopsy.discovery.FileSorter.SortingMethod; import org.sleuthkit.autopsy.discovery.FileSorter.SortingMethod;
import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/** /**
* Dialog for displaying the controls and filters for configuration of a * Dialog for displaying the controls and filters for configuration of a
@ -61,7 +53,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
private static final Color SELECTED_COLOR = new Color(216, 230, 242); private static final Color SELECTED_COLOR = new Color(216, 230, 242);
private static final Color UNSELECTED_COLOR = new Color(240, 240, 240); private static final Color UNSELECTED_COLOR = new Color(240, 240, 240);
private SearchWorker searchWorker = null; private SearchWorker searchWorker = null;
private static DiscoveryDialog discoveryDialog; private static DiscoveryDialog discDialog;
private FileSearchData.FileType fileType = FileSearchData.FileType.IMAGE; private FileSearchData.FileType fileType = FileSearchData.FileType.IMAGE;
private final PropertyChangeListener listener; private final PropertyChangeListener listener;
@ -71,10 +63,10 @@ final class DiscoveryDialog extends javax.swing.JDialog {
* @return The instance of the Discovery Dialog. * @return The instance of the Discovery Dialog.
*/ */
static synchronized DiscoveryDialog getDiscoveryDialogInstance() { static synchronized DiscoveryDialog getDiscoveryDialogInstance() {
if (discoveryDialog == null) { if (discDialog == null) {
discoveryDialog = new DiscoveryDialog(); discDialog = new DiscoveryDialog();
} }
return discoveryDialog; return discDialog;
} }
/** /**
@ -88,13 +80,8 @@ final class DiscoveryDialog extends javax.swing.JDialog {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("FilterError") && evt.getNewValue() != null) { if (evt.getPropertyName().equals("FilterError") && evt.getNewValue() != null) {
String errorMessage = evt.getNewValue().toString(); setValid(evt.getNewValue().toString());
if (!StringUtils.isBlank(errorMessage)) {
setInvalid(errorMessage);
return;
}
} }
setValid();
} }
}; };
for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) { for (GroupSortingAlgorithm groupSortAlgorithm : GroupSortingAlgorithm.values()) {
@ -128,6 +115,15 @@ final class DiscoveryDialog extends javax.swing.JDialog {
fileType = FileSearchData.FileType.IMAGE; fileType = FileSearchData.FileType.IMAGE;
add(imageFilterPanel, CENTER); add(imageFilterPanel, CENTER);
imageFilterPanel.addPropertyChangeListener(listener); imageFilterPanel.addPropertyChangeListener(listener);
updateComboBoxes();
pack();
repaint();
}
/**
* Private helper method to perform combo box updates.
*/
private void updateComboBoxes() {
groupByCombobox.removeAllItems(); groupByCombobox.removeAllItems();
// Set up the grouping attributes // Set up the grouping attributes
for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGrouping()) { for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGrouping()) {
@ -146,8 +142,6 @@ final class DiscoveryDialog extends javax.swing.JDialog {
} }
} }
groupSortingComboBox.setSelectedIndex(0); groupSortingComboBox.setSelectedIndex(0);
pack();
repaint();
} }
/** /**
@ -169,7 +163,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
if (documentFilterPanel != null) { if (documentFilterPanel != null) {
documentFilterPanel.validateFields(); documentFilterPanel.validateFields();
} }
return; break;
default: default:
break; break;
} }
@ -188,9 +182,9 @@ final class DiscoveryDialog extends javax.swing.JDialog {
imagesButton = new javax.swing.JButton(); imagesButton = new javax.swing.JButton();
videosButton = new javax.swing.JButton(); videosButton = new javax.swing.JButton();
documentsButton = new javax.swing.JButton(); documentsButton = new javax.swing.JButton();
step1Label = new javax.swing.JLabel(); javax.swing.JLabel step1Label = new javax.swing.JLabel();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(104, 0), new java.awt.Dimension(104, 0), new java.awt.Dimension(104, 32767)); javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(104, 0), new java.awt.Dimension(104, 0), new java.awt.Dimension(104, 32767));
jPanel1 = new javax.swing.JPanel(); javax.swing.JPanel displaySettingsPanel = new javax.swing.JPanel();
searchButton = new javax.swing.JButton(); searchButton = new javax.swing.JButton();
errorLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel();
javax.swing.JButton cancelButton = new javax.swing.JButton(); javax.swing.JButton cancelButton = new javax.swing.JButton();
@ -344,15 +338,15 @@ final class DiscoveryDialog extends javax.swing.JDialog {
.addGap(8, 8, 8)) .addGap(8, 8, 8))
); );
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); javax.swing.GroupLayout displaySettingsPanelLayout = new javax.swing.GroupLayout(displaySettingsPanel);
jPanel1.setLayout(jPanel1Layout); displaySettingsPanel.setLayout(displaySettingsPanelLayout);
jPanel1Layout.setHorizontalGroup( displaySettingsPanelLayout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
.addGap(8, 8, 8) .addGap(8, 8, 8)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE) .addComponent(sortingPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(displaySettingsPanelLayout.createSequentialGroup()
.addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE) .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addComponent(cancelButton) .addComponent(cancelButton)
@ -360,21 +354,21 @@ final class DiscoveryDialog extends javax.swing.JDialog {
.addComponent(searchButton))) .addComponent(searchButton)))
.addGap(8, 8, 8)) .addGap(8, 8, 8))
); );
jPanel1Layout.setVerticalGroup( displaySettingsPanelLayout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, displaySettingsPanelLayout.createSequentialGroup()
.addGap(8, 8, 8) .addGap(8, 8, 8)
.addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8) .addGap(8, 8, 8)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(displaySettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton) .addComponent(cancelButton)
.addComponent(searchButton))) .addComponent(searchButton)))
.addGap(8, 8, 8)) .addGap(8, 8, 8))
); );
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_END); getContentPane().add(displaySettingsPanel, java.awt.BorderLayout.PAGE_END);
pack(); pack();
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -461,7 +455,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
// Get the selected filters // Get the selected filters
final DiscoveryTopComponent tc = DiscoveryTopComponent.getTopComponent(); final DiscoveryTopComponent tc = DiscoveryTopComponent.getTopComponent();
if (tc == null) { if (tc == null) {
setInvalid("No Top Component Found"); setValid("No Top Component Found");
return; return;
} }
if (tc.isOpened() == false) { if (tc.isOpened() == false) {
@ -519,64 +513,30 @@ final class DiscoveryDialog extends javax.swing.JDialog {
} }
/** /**
* Helper method to display an error message when the results of the * The adjust the controls to reflect whether the settings are valid based
* Discovery Top component may be incomplete. * on the error.
*/
void displayErrorMessage() {
//check if modules run and assemble message
try {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
Map<Long, DataSourceModulesWrapper> dataSourceIngestModules = new HashMap<>();
for (DataSource dataSource : skCase.getDataSources()) {
dataSourceIngestModules.put(dataSource.getId(), new DataSourceModulesWrapper(dataSource.getName()));
}
for (IngestJobInfo jobInfo : skCase.getIngestJobs()) {
dataSourceIngestModules.get(jobInfo.getObjectId()).updateModulesRun(jobInfo);
}
String message = "";
for (DataSourceModulesWrapper dsmodulesWrapper : dataSourceIngestModules.values()) {
message += dsmodulesWrapper.getMessage();
}
if (!message.isEmpty()) {
JOptionPane.showMessageDialog(discoveryDialog, message, Bundle.OpenDiscoveryAction_resultsIncomplete_text(), JOptionPane.INFORMATION_MESSAGE);
}
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, "Exception while determining which modules have been run for Discovery", ex);
}
validateDialog();
}
/**
* The settings are valid so enable the Search button
*/
private void setValid() {
errorLabel.setText("");
searchButton.setEnabled(true);
}
/**
* The settings are not valid so disable the search button and display the
* given error message.
* *
* @param error The error message to display. * @param error The error message to display, null if there is no error.
*/ */
private void setInvalid(String error) { private void setValid(String error) {
errorLabel.setText(error); if (StringUtils.isBlank(error)) {
searchButton.setEnabled(false); errorLabel.setText("");
searchButton.setEnabled(true);
} else {
errorLabel.setText(error);
searchButton.setEnabled(false);
}
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton documentsButton; private javax.swing.JButton documentsButton;
private javax.swing.JLabel errorLabel; private javax.swing.JLabel errorLabel;
private javax.swing.Box.Filler filler1;
private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox; private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox;
private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox; private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox;
private javax.swing.JButton imagesButton; private javax.swing.JButton imagesButton;
private javax.swing.JPanel jPanel1;
private javax.swing.JComboBox<SortingMethod> orderByCombobox; private javax.swing.JComboBox<SortingMethod> orderByCombobox;
private javax.swing.JButton searchButton; private javax.swing.JButton searchButton;
private javax.swing.JLabel step1Label;
private javax.swing.JButton videosButton; private javax.swing.JButton videosButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -61,7 +61,11 @@
</Container> </Container>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="jPanel1"> <Container class="javax.swing.JPanel" name="searchDetailsPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/> <BorderConstraints direction="First"/>
@ -125,6 +129,8 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues> </AuxValues>

View File

@ -98,7 +98,7 @@ public final class DiscoveryTopComponent extends TopComponent {
@Override @Override
protected void componentClosed() { protected void componentClosed() {
cancelCurrentSearch(); DiscoveryDialog.getDiscoveryDialogInstance().cancelSearch();
DiscoveryEventUtils.getDiscoveryEventBus().unregister(this); DiscoveryEventUtils.getDiscoveryEventBus().unregister(this);
DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel);
DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel);
@ -106,13 +106,6 @@ public final class DiscoveryTopComponent extends TopComponent {
super.componentClosed(); super.componentClosed();
} }
/**
* Cancel the in progress search.
*/
private void cancelCurrentSearch() {
DiscoveryDialog.getDiscoveryDialogInstance().cancelSearch();
}
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -124,9 +117,9 @@ public final class DiscoveryTopComponent extends TopComponent {
mainSplitPane = new javax.swing.JSplitPane(); mainSplitPane = new javax.swing.JSplitPane();
rightSplitPane = new AnimatedSplitPane(); rightSplitPane = new AnimatedSplitPane();
jPanel1 = new javax.swing.JPanel(); javax.swing.JPanel searchDetailsPanel = new javax.swing.JPanel();
newSearchButton = new javax.swing.JButton(); newSearchButton = new javax.swing.JButton();
progressMessageScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane progressMessageScrollPane = new javax.swing.JScrollPane();
progressMessageTextArea = new javax.swing.JTextArea(); progressMessageTextArea = new javax.swing.JTextArea();
setMinimumSize(new java.awt.Dimension(199, 200)); setMinimumSize(new java.awt.Dimension(199, 200));
@ -164,31 +157,31 @@ public final class DiscoveryTopComponent extends TopComponent {
progressMessageTextArea.setBorder(null); progressMessageTextArea.setBorder(null);
progressMessageScrollPane.setViewportView(progressMessageTextArea); progressMessageScrollPane.setViewportView(progressMessageTextArea);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); javax.swing.GroupLayout searchDetailsPanelLayout = new javax.swing.GroupLayout(searchDetailsPanel);
jPanel1.setLayout(jPanel1Layout); searchDetailsPanel.setLayout(searchDetailsPanelLayout);
jPanel1Layout.setHorizontalGroup( searchDetailsPanelLayout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) searchDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(searchDetailsPanelLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addComponent(newSearchButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(newSearchButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(progressMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 954, Short.MAX_VALUE) .addComponent(progressMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 954, Short.MAX_VALUE)
.addContainerGap()) .addContainerGap())
); );
jPanel1Layout.setVerticalGroup( searchDetailsPanelLayout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) searchDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(searchDetailsPanelLayout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(searchDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(searchDetailsPanelLayout.createSequentialGroup()
.addGap(8, 8, 8) .addGap(8, 8, 8)
.addComponent(progressMessageScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(progressMessageScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(searchDetailsPanelLayout.createSequentialGroup()
.addGap(17, 17, 17) .addGap(17, 17, 17)
.addComponent(newSearchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(newSearchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap()) .addContainerGap())
); );
add(jPanel1, java.awt.BorderLayout.PAGE_START); add(searchDetailsPanel, java.awt.BorderLayout.PAGE_START);
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void newSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSearchButtonActionPerformed private void newSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSearchButtonActionPerformed
@ -322,10 +315,8 @@ public final class DiscoveryTopComponent extends TopComponent {
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JSplitPane mainSplitPane; private javax.swing.JSplitPane mainSplitPane;
private javax.swing.JButton newSearchButton; private javax.swing.JButton newSearchButton;
private javax.swing.JScrollPane progressMessageScrollPane;
private javax.swing.JTextArea progressMessageTextArea; private javax.swing.JTextArea progressMessageTextArea;
private javax.swing.JSplitPane rightSplitPane; private javax.swing.JSplitPane rightSplitPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -22,14 +22,23 @@ import java.awt.Component;
import java.awt.Point; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane;
import org.openide.util.ImageUtilities; import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.IngestJobInfo;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
/** /**
@ -37,6 +46,7 @@ import org.sleuthkit.datamodel.TskCoreException;
*/ */
final class DiscoveryUiUtils { final class DiscoveryUiUtils {
private final static Logger logger = Logger.getLogger(DiscoveryUiUtils.class.getName());
private static final int BYTE_UNIT_CONVERSION = 1000; private static final int BYTE_UNIT_CONVERSION = 1000;
private static final int ICON_SIZE = 16; private static final int ICON_SIZE = 16;
private static final String RED_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/red-circle-exclamation.png"; private static final String RED_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/red-circle-exclamation.png";
@ -193,6 +203,35 @@ final class DiscoveryUiUtils {
return ICON_SIZE; return ICON_SIZE;
} }
/**
* Helper method to display an error message when the results of the
* Discovery Top component may be incomplete.
*/
static void displayErrorMessage(DiscoveryDialog dialog) {
//check if modules run and assemble message
try {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
Map<Long, DataSourceModulesWrapper> dataSourceIngestModules = new HashMap<>();
for (DataSource dataSource : skCase.getDataSources()) {
dataSourceIngestModules.put(dataSource.getId(), new DataSourceModulesWrapper(dataSource.getName()));
}
for (IngestJobInfo jobInfo : skCase.getIngestJobs()) {
dataSourceIngestModules.get(jobInfo.getObjectId()).updateModulesRun(jobInfo);
}
String message = "";
for (DataSourceModulesWrapper dsmodulesWrapper : dataSourceIngestModules.values()) {
message += dsmodulesWrapper.getMessage();
}
if (!message.isEmpty()) {
JOptionPane.showMessageDialog(dialog, message, Bundle.OpenDiscoveryAction_resultsIncomplete_text(), JOptionPane.INFORMATION_MESSAGE);
}
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, "Exception while determining which modules have been run for Discovery", ex);
}
dialog.validateDialog();
}
/** /**
* Private constructor for DiscoveryUiUtils utility class. * Private constructor for DiscoveryUiUtils utility class.
*/ */

View File

@ -17,6 +17,10 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="documentFiltersScrollPane"> <Container class="javax.swing.JScrollPane" name="documentFiltersScrollPane">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/> <BorderConstraints direction="Center"/>
@ -26,6 +30,10 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JPanel" name="documentFiltersPanel"> <Container class="javax.swing.JPanel" name="documentFiltersPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">

View File

@ -59,8 +59,8 @@ final class DocumentFilterPanel extends AbstractFiltersPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
documentFiltersScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane documentFiltersScrollPane = new javax.swing.JScrollPane();
documentFiltersPanel = new javax.swing.JPanel(); javax.swing.JPanel documentFiltersPanel = new javax.swing.JPanel();
documentsFiltersSplitPane = new javax.swing.JSplitPane(); documentsFiltersSplitPane = new javax.swing.JSplitPane();
setLayout(new java.awt.BorderLayout()); setLayout(new java.awt.BorderLayout());
@ -94,8 +94,6 @@ final class DocumentFilterPanel extends AbstractFiltersPanel {
return FILE_TYPE; return FILE_TYPE;
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel documentFiltersPanel;
private javax.swing.JScrollPane documentFiltersScrollPane;
private javax.swing.JSplitPane documentsFiltersSplitPane; private javax.swing.JSplitPane documentsFiltersSplitPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -17,6 +17,10 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="imageFiltersScrollPane"> <Container class="javax.swing.JScrollPane" name="imageFiltersScrollPane">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/> <BorderConstraints direction="Center"/>
@ -26,6 +30,10 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JPanel" name="imageFiltersPanel"> <Container class="javax.swing.JPanel" name="imageFiltersPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">

View File

@ -63,8 +63,8 @@ final class ImageFilterPanel extends AbstractFiltersPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
imageFiltersScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane imageFiltersScrollPane = new javax.swing.JScrollPane();
imageFiltersPanel = new javax.swing.JPanel(); javax.swing.JPanel imageFiltersPanel = new javax.swing.JPanel();
imageFiltersSplitPane = new javax.swing.JSplitPane(); imageFiltersSplitPane = new javax.swing.JSplitPane();
setLayout(new java.awt.BorderLayout()); setLayout(new java.awt.BorderLayout());
@ -101,8 +101,6 @@ final class ImageFilterPanel extends AbstractFiltersPanel {
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel imageFiltersPanel;
private javax.swing.JScrollPane imageFiltersScrollPane;
private javax.swing.JSplitPane imageFiltersSplitPane; private javax.swing.JSplitPane imageFiltersSplitPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -30,7 +30,6 @@ import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction; import org.openide.util.actions.CallableSystemAction;
import org.openide.util.actions.Presenter; import org.openide.util.actions.Presenter;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* Class to open the Discovery dialog. Allows the user to run searches and see * Class to open the Discovery dialog. Allows the user to run searches and see
@ -45,8 +44,6 @@ import org.sleuthkit.autopsy.coreutils.Logger;
@NbBundle.Messages({"CTL_OpenDiscoveryAction=Discovery"}) @NbBundle.Messages({"CTL_OpenDiscoveryAction=Discovery"})
public final class OpenDiscoveryAction extends CallableSystemAction implements Presenter.Toolbar { public final class OpenDiscoveryAction extends CallableSystemAction implements Presenter.Toolbar {
private static final Logger logger = Logger.getLogger(OpenDiscoveryAction.class.getName());
private static final String DISPLAY_NAME = Bundle.CTL_OpenDiscoveryAction(); private static final String DISPLAY_NAME = Bundle.CTL_OpenDiscoveryAction();
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final JButton toolbarButton = new JButton(); private final JButton toolbarButton = new JButton();
@ -71,7 +68,7 @@ public final class OpenDiscoveryAction extends CallableSystemAction implements P
final DiscoveryDialog discDialog = DiscoveryDialog.getDiscoveryDialogInstance(); final DiscoveryDialog discDialog = DiscoveryDialog.getDiscoveryDialogInstance();
discDialog.cancelSearch(); discDialog.cancelSearch();
discDialog.setVisible(true); discDialog.setVisible(true);
discDialog.displayErrorMessage(); DiscoveryUiUtils.displayErrorMessage(discDialog);
} }
/** /**

View File

@ -87,7 +87,6 @@ final class ResultsPanel extends javax.swing.JPanel {
imageThumbnailViewer.addListSelectionListener((e) -> { imageThumbnailViewer.addListSelectionListener((e) -> {
if (resultType == FileSearchData.FileType.IMAGE) { if (resultType == FileSearchData.FileType.IMAGE) {
if (!e.getValueIsAdjusting()) { if (!e.getValueIsAdjusting()) {
List<AbstractFile> files = getInstancesForSelected();
//send populateMesage //send populateMesage
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected())); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
} else { } else {
@ -291,14 +290,13 @@ final class ResultsPanel extends javax.swing.JPanel {
}); });
} }
@Subscribe
/** /**
* Set the page number and retrieve its contents. * Set the page number and retrieve its contents.
* *
* @param startingEntry The index of the first file in the group to include * @param startingEntry The index of the first file in the group to include
* in this page. * in this page.
*/ */
@Subscribe
private synchronized void setPage(int startingEntry) { private synchronized void setPage(int startingEntry) {
int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex()); int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
synchronized (this) { synchronized (this) {

View File

@ -40,7 +40,7 @@ final class SwingAnimator {
//duration in milliseconds betweeen each firing of the Timer //duration in milliseconds betweeen each firing of the Timer
private static final int INITIAL_TIMING = 10; private static final int INITIAL_TIMING = 10;
private static int timing = INITIAL_TIMING; private int timing = INITIAL_TIMING;
/** /**
* *

View File

@ -17,6 +17,10 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="videoFiltersScrollPane"> <Container class="javax.swing.JScrollPane" name="videoFiltersScrollPane">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/> <BorderConstraints direction="Center"/>
@ -31,6 +35,10 @@
<Dimension value="[223, 66]"/> <Dimension value="[223, 66]"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">

View File

@ -60,8 +60,8 @@ final class VideoFilterPanel extends AbstractFiltersPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
videoFiltersScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane videoFiltersScrollPane = new javax.swing.JScrollPane();
videoFiltersPanel = new javax.swing.JPanel(); javax.swing.JPanel videoFiltersPanel = new javax.swing.JPanel();
videoFiltersSplitPane = new javax.swing.JSplitPane(); videoFiltersSplitPane = new javax.swing.JSplitPane();
setLayout(new java.awt.BorderLayout()); setLayout(new java.awt.BorderLayout());
@ -98,8 +98,6 @@ final class VideoFilterPanel extends AbstractFiltersPanel {
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel videoFiltersPanel;
private javax.swing.JScrollPane videoFiltersScrollPane;
private javax.swing.JSplitPane videoFiltersSplitPane; private javax.swing.JSplitPane videoFiltersSplitPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables