mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
graceful handling in the event that no datasources are available
This commit is contained in:
parent
62c5f037b5
commit
f29af7e012
@ -85,7 +85,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
||||
"CommonFilesPanel.buildDataSourceMap.done.noCurrentCaseException=Unable to open case file.",
|
||||
"CommonFilesPanel.buildDataSourceMap.done.exception=Unexpected exception building data sources map.",
|
||||
"CommonFilesPanel.buildDataSourceMap.done.interupted=Something went wrong building the Common Files Search dialog box.",
|
||||
"CommonFilesPanel.buildDataSourceMap.done.sqlException=Unable to query db for data sources."})
|
||||
"CommonFilesPanel.buildDataSourceMap.done.sqlException=Unable to query db for data sources.",
|
||||
"CommonFilesPanel.buildDataSourcesMap.updateUi.noDataSources=No data sources were found."})
|
||||
private void setupDataSources() {
|
||||
|
||||
new SwingWorker<Map<Long, String>, Void>() {
|
||||
@ -95,20 +96,27 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
||||
private void updateUi() {
|
||||
|
||||
String[] dataSourcesNames = new String[CommonFilesPanel.this.dataSourceMap.size()];
|
||||
dataSourcesNames = CommonFilesPanel.this.dataSourceMap.values().toArray(dataSourcesNames);
|
||||
CommonFilesPanel.this.dataSourcesList = new DataSourceComboBoxModel(dataSourcesNames);
|
||||
CommonFilesPanel.this.selectDataSourceComboBox.setModel(CommonFilesPanel.this.dataSourcesList);
|
||||
|
||||
boolean multipleDataSources = this.caseHasMultipleSources();
|
||||
CommonFilesPanel.this.allDataSourcesRadioButton.setEnabled(multipleDataSources);
|
||||
CommonFilesPanel.this.allDataSourcesRadioButton.setSelected(multipleDataSources);
|
||||
//only enable all this stuff if we actually have datasources
|
||||
if (dataSourcesNames.length > 0) {
|
||||
dataSourcesNames = CommonFilesPanel.this.dataSourceMap.values().toArray(dataSourcesNames);
|
||||
CommonFilesPanel.this.dataSourcesList = new DataSourceComboBoxModel(dataSourcesNames);
|
||||
CommonFilesPanel.this.selectDataSourceComboBox.setModel(CommonFilesPanel.this.dataSourcesList);
|
||||
|
||||
if (!multipleDataSources) {
|
||||
CommonFilesPanel.this.withinDataSourceRadioButton.setSelected(true);
|
||||
withinDataSourceSelected(true);
|
||||
boolean multipleDataSources = this.caseHasMultipleSources();
|
||||
CommonFilesPanel.this.allDataSourcesRadioButton.setEnabled(multipleDataSources);
|
||||
CommonFilesPanel.this.allDataSourcesRadioButton.setSelected(multipleDataSources);
|
||||
|
||||
if (!multipleDataSources) {
|
||||
CommonFilesPanel.this.withinDataSourceRadioButton.setSelected(true);
|
||||
withinDataSourceSelected(true);
|
||||
}
|
||||
|
||||
CommonFilesPanel.this.searchButton.setEnabled(true);
|
||||
} else {
|
||||
MessageNotifyUtil.Message.error(Bundle.CommonFilesPanel_buildDataSourcesMap_updateUi_noDataSources());
|
||||
CommonFilesPanel.this.cancelButtonActionPerformed(null);
|
||||
}
|
||||
|
||||
CommonFilesPanel.this.searchButton.setEnabled(true);
|
||||
}
|
||||
|
||||
private boolean caseHasMultipleSources() {
|
||||
@ -496,7 +504,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_withinDataSourceRadioButtonActionPerformed
|
||||
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
SwingUtilities.windowForComponent(this).dispose();
|
||||
SwingUtilities.windowForComponent(this).dispose();
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
private void withinDataSourceSelected(boolean selected) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user