Merge pull request #3910 from briangsweeney/3602_3961_CommonSearch_Dialog_logic

3602 3961 common search dialog logic
This commit is contained in:
Richard Cordovano 2018-06-27 19:26:20 -04:00 committed by GitHub
commit 752927849f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -104,12 +104,15 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
CommonFilesPanel.this.selectDataSourceComboBox.setModel(CommonFilesPanel.this.dataSourcesList);
boolean multipleDataSources = this.caseHasMultipleSources();
CommonFilesPanel.this.allDataSourcesRadioButton.setEnabled(multipleDataSources);
CommonFilesPanel.this.allDataSourcesRadioButton.setSelected(multipleDataSources);
CommonFilesPanel.this.allDataSourcesRadioButton.setEnabled(true);
CommonFilesPanel.this.allDataSourcesRadioButton.setSelected(true);
if (!multipleDataSources) {
CommonFilesPanel.this.withinDataSourceRadioButton.setSelected(true);
withinDataSourceSelected(true);
CommonFilesPanel.this.withinDataSourceRadioButton.setEnabled(false);
CommonFilesPanel.this.withinDataSourceRadioButton.setSelected(false);
withinDataSourceSelected(false);
CommonFilesPanel.this.selectDataSourceComboBox.setEnabled(false);
}
CommonFilesPanel.this.searchButton.setEnabled(true);
@ -120,7 +123,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
}
private boolean caseHasMultipleSources() {
return CommonFilesPanel.this.dataSourceMap.size() >= 2;
return CommonFilesPanel.this.dataSourceMap.size() >= 3;
}
@Override

View File

@ -19,11 +19,14 @@
package org.sleuthkit.autopsy.commonfilesearch;
import java.awt.event.ActionEvent;
import java.util.logging.Level;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.core.Installer;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.coreutils.Logger;
/**
* Encapsulates a menu action which triggers the common files search dialog.
@ -32,15 +35,22 @@ final public class CommonFilesSearchAction extends CallableSystemAction {
private static CommonFilesSearchAction instance = null;
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(CommonFilesSearchAction.class.getName());
CommonFilesSearchAction() {
super();
this.setEnabled(false);
}
@Override
public boolean isEnabled(){
return super.isEnabled() && Case.isCaseOpen() && Installer.isJavaFxInited();
boolean shouldBeEnabled = false;
try {
shouldBeEnabled = Case.isCaseOpen() && Case.getCurrentCase().getDataSources().size() > 1;
} catch(TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting data sources for action enabled check", ex);
}
return super.isEnabled() && shouldBeEnabled;
}
public static synchronized CommonFilesSearchAction getDefault() {