diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CasePreferences.java b/Core/src/org/sleuthkit/autopsy/casemodule/CasePreferences.java
index 8d40b23538..8be8a44882 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/CasePreferences.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/CasePreferences.java
@@ -18,15 +18,18 @@
*/
package org.sleuthkit.autopsy.casemodule;
+import java.beans.PropertyChangeEvent;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.EnumSet;
import java.util.Properties;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
/**
* Read and update case preference file values.
@@ -38,25 +41,40 @@ public final class CasePreferences {
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());
- private Boolean groupItemsInTreeByDataSource = null;
+ private static Boolean groupItemsInTreeByDataSource = null;
- //DLG:
- public CasePreferences(Case currentCase) {
- loadFromStorage(currentCase);
+ private CasePreferences() {
}
- public Boolean getGroupItemsInTreeByDataSource() {
+ static {
+ Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
+ if (evt.getNewValue() != null) {
+ loadFromStorage((Case) evt.getNewValue());
+ } else {
+ saveToStorage((Case) evt.getOldValue());
+ clear();
+ }
+ });
+ try {
+ loadFromStorage(Case.getCurrentCaseThrows());
+ } catch (NoCurrentCaseException ex) {
+ logger.log(Level.SEVERE, "No current case open.", ex);
+ }
+ }
+
+ public static Boolean getGroupItemsInTreeByDataSource() {
return groupItemsInTreeByDataSource;
}
- public void setGroupItemsInTreeByDataSource(boolean value) {
+ public static void setGroupItemsInTreeByDataSource(boolean value) {
groupItemsInTreeByDataSource = value;
+ DirectoryTreeTopComponent.getDefault().refreshContentTreeSafe();
}
/**
* Load case preferences from the settings file.
*/
- private void loadFromStorage(Case currentCase) {
+ private static void loadFromStorage(Case currentCase) {
Path settingsFile = Paths.get(currentCase.getConfigDirectory(), SETTINGS_FILE); //NON-NLS
if (settingsFile.toFile().exists()) {
// Read the settings
@@ -73,11 +91,15 @@ public final class CasePreferences {
}
}
}
+
+ private static void clear() {
+ groupItemsInTreeByDataSource = null;
+ }
/**
* Store case preferences in the settings file.
*/
- public void saveToStorage(Case currentCase) {
+ private static void saveToStorage(Case currentCase) {
Path settingsFile = Paths.get(currentCase.getConfigDirectory(), SETTINGS_FILE); //NON-NLS
Properties props = new Properties();
if (groupItemsInTreeByDataSource != null) {
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.form
index 1fcbee8b23..e2313f0ce5 100755
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.form
@@ -16,319 +16,368 @@
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java
index 1e9b1fcbbd..51dc4d4f5d 100755
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanel.java
@@ -28,11 +28,13 @@ import java.util.Objects;
import java.util.Properties;
import java.util.logging.Level;
import javax.swing.JPanel;
+import org.netbeans.spi.options.OptionsPanelController;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
/**
* Panel for configuring view preferences.
@@ -41,18 +43,30 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
private static final Logger logger = Logger.getLogger(ViewPreferencesPanel.class.getName());
- private Case currentCase = null;
- private CasePreferences casePreferences = null;
+ private boolean immediateUpdates;
/**
* Creates new form ViewPreferencesPanel
+ *
+ * //DLG: Might not need this constructor anymore.
*/
public ViewPreferencesPanel() {
initComponents();
}
+ /**
+ * Creates new form ViewPreferencesPanel
+ *
+ * //DLG:
+ */
+ public ViewPreferencesPanel(boolean immediateUpdates) {
+ initComponents();
+ this.immediateUpdates = immediateUpdates;
+ }
+
@Override
public void load() {
+ // Global Settings
boolean keepPreferredViewer = UserPreferences.keepPreferredContentViewer();
keepCurrentViewerRadioButton.setSelected(keepPreferredViewer);
useBestViewerRadioButton.setSelected(!keepPreferredViewer);
@@ -67,16 +81,17 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
dataSourcesHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInDataSourcesTree());
viewsHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInViewsTree());
- hideOtherUsersTagsCheckbox.setSelected(UserPreferences.showOnlyCurrentUserTags() == false);
-
- try {
- currentCase = Case.getCurrentCaseThrows();
- casePreferences = new CasePreferences(currentCase);
+ // Current Case Settings
+ boolean caseIsOpen = Case.isCaseOpen();
+ currentCaseSettingsPanel.setEnabled(caseIsOpen);
+ hideOtherUsersTagsCheckbox.setEnabled(caseIsOpen);
+ groupByDataSourceCheckbox.setEnabled(caseIsOpen);
- groupByDataSourceCheckbox.setSelected(Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true));
- } catch (NoCurrentCaseException ex) {
- // No open case.
- }
+ hideOtherUsersTagsCheckbox.setSelected(UserPreferences.showOnlyCurrentUserTags() == false);
+ groupByDataSourceCheckbox.setSelected(Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true));
+
+ // Current Session Settings
+ hideRejectedResultsCheckbox.setSelected(DirectoryTreeTopComponent.getDefault().getShowRejectedResults() == false);
}
@Override
@@ -87,22 +102,23 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
UserPreferences.setHideKnownFilesInViewsTree(viewsHideKnownCheckbox.isSelected());
UserPreferences.setHideSlackFilesInDataSourcesTree(dataSourcesHideSlackCheckbox.isSelected());
UserPreferences.setHideSlackFilesInViewsTree(viewsHideSlackCheckbox.isSelected());
+ UserPreferences.setShowOnlyCurrentUserTags(hideOtherUsersTagsCheckbox.isSelected() == false);
- UserPreferences.setShowOnlyCurrentUserTags(hideOtherUsersTagsCheckbox.isSelected());
+ storeGroupItemsInTreeByDataSource();
- if (currentCase != null) {
+ DirectoryTreeTopComponent.getDefault().setShowRejectedResults(hideRejectedResultsCheckbox.isSelected() == false);
+ }
+
+ private void storeGroupItemsInTreeByDataSource() {
+ if (Case.isCaseOpen()) {
/*
* Only write the value if it has already been previously stored, or
* if the checkbox is selected. This allows GroupDataSourcesDialog
* to work.
*/
- if (casePreferences.getGroupItemsInTreeByDataSource() != null || groupByDataSourceCheckbox.isSelected()) {
- firePropertyChange(
- CasePreferences.GROUP_ITEMS_IN_TREE_BY_DATASOURCE,
- casePreferences.getGroupItemsInTreeByDataSource(), Boolean.valueOf(groupByDataSourceCheckbox.isSelected()));
- casePreferences.setGroupItemsInTreeByDataSource(groupByDataSourceCheckbox.isSelected());
+ if (CasePreferences.getGroupItemsInTreeByDataSource() != null || groupByDataSourceCheckbox.isSelected()) {
+ CasePreferences.setGroupItemsInTreeByDataSource(groupByDataSourceCheckbox.isSelected());
}
- casePreferences.saveToStorage(currentCase);
}
}
@@ -115,6 +131,8 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
// //GEN-BEGIN:initComponents
private void initComponents() {
+ viewPreferencesScrollPane = new javax.swing.JScrollPane();
+ viewPreferencesPanel = new javax.swing.JPanel();
globalSettingsPanel = new javax.swing.JPanel();
selectFileLabel = new javax.swing.JLabel();
useBestViewerRadioButton = new javax.swing.JRadioButton();
@@ -134,6 +152,8 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
currentSessionSettingsPanel = new javax.swing.JPanel();
hideRejectedResultsCheckbox = new javax.swing.JCheckBox();
+ viewPreferencesScrollPane.setBorder(null);
+
globalSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.globalSettingsPanel.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(selectFileLabel, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.selectFileLabel.text")); // NOI18N
@@ -157,14 +177,34 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
org.openide.awt.Mnemonics.setLocalizedText(hideKnownFilesLabel, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.hideKnownFilesLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(dataSourcesHideKnownCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.dataSourcesHideKnownCheckbox.text")); // NOI18N
+ dataSourcesHideKnownCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ dataSourcesHideKnownCheckboxActionPerformed(evt);
+ }
+ });
org.openide.awt.Mnemonics.setLocalizedText(viewsHideKnownCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.viewsHideKnownCheckbox.text")); // NOI18N
+ viewsHideKnownCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ viewsHideKnownCheckboxActionPerformed(evt);
+ }
+ });
org.openide.awt.Mnemonics.setLocalizedText(hideSlackFilesLabel, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.hideSlackFilesLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(dataSourcesHideSlackCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.dataSourcesHideSlackCheckbox.text")); // NOI18N
+ dataSourcesHideSlackCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ dataSourcesHideSlackCheckboxActionPerformed(evt);
+ }
+ });
org.openide.awt.Mnemonics.setLocalizedText(viewsHideSlackCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.viewsHideSlackCheckbox.text")); // NOI18N
+ viewsHideSlackCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ viewsHideSlackCheckboxActionPerformed(evt);
+ }
+ });
org.openide.awt.Mnemonics.setLocalizedText(displayTimeLabel, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.displayTimeLabel.text")); // NOI18N
@@ -186,7 +226,7 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
globalSettingsPanel.setLayout(globalSettingsPanelLayout);
globalSettingsPanelLayout.setHorizontalGroup(
globalSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, globalSettingsPanelLayout.createSequentialGroup()
+ .addGroup(globalSettingsPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(globalSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(displayTimeLabel)
@@ -250,8 +290,18 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
currentCaseSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.currentCaseSettingsPanel.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(hideOtherUsersTagsCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.hideOtherUsersTagsCheckbox.text")); // NOI18N
+ hideOtherUsersTagsCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ hideOtherUsersTagsCheckboxActionPerformed(evt);
+ }
+ });
org.openide.awt.Mnemonics.setLocalizedText(groupByDataSourceCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.groupByDataSourceCheckbox.text")); // NOI18N
+ groupByDataSourceCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ groupByDataSourceCheckboxActionPerformed(evt);
+ }
+ });
javax.swing.GroupLayout currentCaseSettingsPanelLayout = new javax.swing.GroupLayout(currentCaseSettingsPanel);
currentCaseSettingsPanel.setLayout(currentCaseSettingsPanelLayout);
@@ -277,6 +327,11 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
currentSessionSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.currentSessionSettingsPanel.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(hideRejectedResultsCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.hideRejectedResultsCheckbox.text")); // NOI18N
+ hideRejectedResultsCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ hideRejectedResultsCheckboxActionPerformed(evt);
+ }
+ });
javax.swing.GroupLayout currentSessionSettingsPanelLayout = new javax.swing.GroupLayout(currentSessionSettingsPanel);
currentSessionSettingsPanel.setLayout(currentSessionSettingsPanelLayout);
@@ -294,50 +349,139 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
.addComponent(hideRejectedResultsCheckbox))
);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ javax.swing.GroupLayout viewPreferencesPanelLayout = new javax.swing.GroupLayout(viewPreferencesPanel);
+ viewPreferencesPanel.setLayout(viewPreferencesPanelLayout);
+ viewPreferencesPanelLayout.setHorizontalGroup(
+ viewPreferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, viewPreferencesPanelLayout.createSequentialGroup()
.addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(viewPreferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(currentSessionSettingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(globalSettingsPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(currentCaseSettingsPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(currentCaseSettingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(globalSettingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ viewPreferencesPanelLayout.setVerticalGroup(
+ viewPreferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(viewPreferencesPanelLayout.createSequentialGroup()
.addComponent(globalSettingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGap(11, 11, 11)
.addComponent(currentCaseSettingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(currentSessionSettingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
+
+ viewPreferencesScrollPane.setViewportView(viewPreferencesPanel);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(viewPreferencesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 562, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(viewPreferencesScrollPane)
+ );
}// //GEN-END:initComponents
private void useBestViewerRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useBestViewerRadioButtonActionPerformed
useBestViewerRadioButton.setSelected(true);
keepCurrentViewerRadioButton.setSelected(false);
+ if (immediateUpdates) {
+ UserPreferences.setKeepPreferredContentViewer(false);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
}//GEN-LAST:event_useBestViewerRadioButtonActionPerformed
private void keepCurrentViewerRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keepCurrentViewerRadioButtonActionPerformed
useBestViewerRadioButton.setSelected(false);
keepCurrentViewerRadioButton.setSelected(true);
+ if (immediateUpdates) {
+ UserPreferences.setKeepPreferredContentViewer(true);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
}//GEN-LAST:event_keepCurrentViewerRadioButtonActionPerformed
private void useLocalTimeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useLocalTimeRadioButtonActionPerformed
useLocalTimeRadioButton.setSelected(true);
useGMTTimeRadioButton.setSelected(false);
+ if (immediateUpdates) {
+ UserPreferences.setDisplayTimesInLocalTime(true);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
}//GEN-LAST:event_useLocalTimeRadioButtonActionPerformed
private void useGMTTimeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useGMTTimeRadioButtonActionPerformed
useLocalTimeRadioButton.setSelected(false);
useGMTTimeRadioButton.setSelected(true);
+ if (immediateUpdates) {
+ UserPreferences.setDisplayTimesInLocalTime(false);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
}//GEN-LAST:event_useGMTTimeRadioButtonActionPerformed
+ private void dataSourcesHideKnownCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideKnownCheckboxActionPerformed
+ if (immediateUpdates) {
+ UserPreferences.setHideKnownFilesInDataSourcesTree(dataSourcesHideKnownCheckbox.isSelected());
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_dataSourcesHideKnownCheckboxActionPerformed
+
+ private void viewsHideKnownCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideKnownCheckboxActionPerformed
+ if (immediateUpdates) {
+ UserPreferences.setHideKnownFilesInViewsTree(viewsHideKnownCheckbox.isSelected());
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_viewsHideKnownCheckboxActionPerformed
+
+ private void dataSourcesHideSlackCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSourcesHideSlackCheckboxActionPerformed
+ if (immediateUpdates) {
+ UserPreferences.setHideSlackFilesInDataSourcesTree(dataSourcesHideSlackCheckbox.isSelected());
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_dataSourcesHideSlackCheckboxActionPerformed
+
+ private void viewsHideSlackCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewsHideSlackCheckboxActionPerformed
+ if (immediateUpdates) {
+ UserPreferences.setHideSlackFilesInViewsTree(viewsHideSlackCheckbox.isSelected());
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_viewsHideSlackCheckboxActionPerformed
+
+ private void hideOtherUsersTagsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hideOtherUsersTagsCheckboxActionPerformed
+ if (immediateUpdates) {
+ UserPreferences.setShowOnlyCurrentUserTags(hideOtherUsersTagsCheckbox.isSelected() == false);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_hideOtherUsersTagsCheckboxActionPerformed
+
+ private void groupByDataSourceCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_groupByDataSourceCheckboxActionPerformed
+ if (immediateUpdates) {
+ storeGroupItemsInTreeByDataSource();
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_groupByDataSourceCheckboxActionPerformed
+
+ private void hideRejectedResultsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hideRejectedResultsCheckboxActionPerformed
+ if (immediateUpdates) {
+ DirectoryTreeTopComponent.getDefault().setShowRejectedResults(hideRejectedResultsCheckbox.isSelected() == false);
+ } else {
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_hideRejectedResultsCheckboxActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel currentCaseSettingsPanel;
@@ -356,6 +500,8 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
private javax.swing.JRadioButton useBestViewerRadioButton;
private javax.swing.JRadioButton useGMTTimeRadioButton;
private javax.swing.JRadioButton useLocalTimeRadioButton;
+ private javax.swing.JPanel viewPreferencesPanel;
+ private javax.swing.JScrollPane viewPreferencesScrollPane;
private javax.swing.JCheckBox viewsHideKnownCheckbox;
private javax.swing.JCheckBox viewsHideSlackCheckbox;
// End of variables declaration//GEN-END:variables
diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanelController.java b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanelController.java
index 40efcd0149..75a6bb4c42 100755
--- a/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanelController.java
+++ b/Core/src/org/sleuthkit/autopsy/corecomponents/ViewPreferencesPanelController.java
@@ -106,7 +106,7 @@ public final class ViewPreferencesPanelController extends OptionsPanelController
*/
private ViewPreferencesPanel getPanel() {
if (panel == null) {
- panel = new ViewPreferencesPanel();
+ panel = new ViewPreferencesPanel(false);
panel.addPropertyChangeListener((PropertyChangeEvent evt) -> {
if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) {
changed();
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/AutopsyTreeChildFactory.java b/Core/src/org/sleuthkit/autopsy/datamodel/AutopsyTreeChildFactory.java
index 6fd17f6c4c..5af1d5c085 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/AutopsyTreeChildFactory.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/AutopsyTreeChildFactory.java
@@ -54,15 +54,9 @@ public final class AutopsyTreeChildFactory extends ChildFactory.Detachable list) {
try {
- Case currentCase = Case.getCurrentCaseThrows();
- CasePreferences casePreferences = new CasePreferences(currentCase);
SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase();
- if (Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true)) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
List dataSources = tskCase.getDataSources();
List keys = new ArrayList<>();
dataSources.forEach((datasource) -> {
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
index 370cc5cec7..57bd68911c 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/DeletedContent.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -39,6 +40,7 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -460,7 +462,7 @@ public class DeletedContent implements AutopsyVisitableItem {
+ " OR known IS NULL)"; //NON-NLS
}
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
query += " AND data_source_obj_id = " + filteringDSObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java b/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java
index d9df849d86..ff268f2de2 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/EmailExtracted.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -39,6 +40,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -161,7 +163,7 @@ public class EmailExtracted implements AutopsyVisitableItem {
+ "attribute_type_id=" + pathAttrId //NON-NLS
+ " AND blackboard_attributes.artifact_id=blackboard_artifacts.artifact_id" //NON-NLS
+ " AND blackboard_artifacts.artifact_type_id=" + artId; //NON-NLS
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
query += " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java
index dc19f0ecb1..3ab5f6cb90 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/ExtractedContent.java
@@ -292,9 +292,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
protected boolean createKeys(List list) {
if (skCase != null) {
try {
- Case currentCase = Case.getCurrentCaseThrows();
- CasePreferences casePreferences = new CasePreferences(currentCase);
- List types = Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true) ?
+ List types = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true) ?
blackboard.getArtifactTypesInUse(datasourceObjId) :
skCase.getArtifactTypesInUse() ;
@@ -316,8 +314,6 @@ public class ExtractedContent implements AutopsyVisitableItem {
node.updateDisplayName();
}
}
- } catch (NoCurrentCaseException ex) {
- Logger.getLogger(TypeFactory.class.getName()).log(Level.SEVERE, "No current case open: " + ex.getLocalizedMessage()); //NON-NLS
} catch (TskCoreException ex) {
Logger.getLogger(TypeFactory.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage()); //NON-NLS
}
@@ -361,14 +357,9 @@ public class ExtractedContent implements AutopsyVisitableItem {
// a performance increase might be had by adding a
// "getBlackboardArtifactCount()" method to skCase
try {
- Case currentCase = Case.getCurrentCaseThrows();
- CasePreferences casePreferences = new CasePreferences(currentCase);
- this.childCount = Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true) ?
+ this.childCount = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true) ?
blackboard.getArtifactsCount(type.getTypeID(), datasourceObjId) :
skCase.getBlackboardArtifactsTypeCount(type.getTypeID());
- } catch (NoCurrentCaseException ex) {
- Logger.getLogger(TypeNode.class.getName())
- .log(Level.WARNING, "No current case open.", ex); //NON-NLS
} catch (TskException ex) {
Logger.getLogger(TypeNode.class.getName())
.log(Level.WARNING, "Error getting child count", ex); //NON-NLS
@@ -490,15 +481,11 @@ public class ExtractedContent implements AutopsyVisitableItem {
protected boolean createKeys(List list) {
if (skCase != null) {
try {
- Case currentCase = Case.getCurrentCaseThrows();
- CasePreferences casePreferences = new CasePreferences(currentCase);
List arts =
- Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true) ?
+ Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true) ?
blackboard.getArtifacts(type.getTypeID(), datasourceObjId) :
skCase.getBlackboardArtifacts(type.getTypeID());
list.addAll(arts);
- } catch (NoCurrentCaseException ex) {
- Logger.getLogger(ArtifactFactory.class.getName()).log(Level.SEVERE, "No current case open.", ex); //NON-NLS
} catch (TskException ex) {
Logger.getLogger(ArtifactFactory.class.getName()).log(Level.SEVERE, "Couldn't get blackboard artifacts from database", ex); //NON-NLS
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java
index 51ece423da..8ce1aa75c8 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileSize.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -36,6 +37,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -446,7 +448,7 @@ public class FileSize implements AutopsyVisitableItem {
}
// filter by datasource if indicated in user preferences
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
query += " AND data_source_obj_id = " + filteringDSObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java
index 1d24f081ab..5f1f33607d 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByExtension.java
@@ -23,6 +23,7 @@ import java.beans.PropertyChangeListener;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -37,6 +38,7 @@ import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -363,7 +365,7 @@ public final class FileTypesByExtension implements AutopsyVisitableItem {
+ (UserPreferences.hideKnownFilesInViewsTree()
? " AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN.getFileKnownValue() + ")"
: " ")
- + (UserPreferences.groupItemsInTreeByDatasource()
+ + (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? " AND data_source_obj_id = " + filteringDataSourceObjId()
: " ")
+ " AND (extension IN (" + filter.getFilter().stream()
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java
index 90cb90ae77..ad4ea9de99 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypesByMimeType.java
@@ -28,6 +28,7 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -41,6 +42,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import static org.sleuthkit.autopsy.core.UserPreferences.hideKnownFilesInViewsTree;
@@ -101,7 +103,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
+ TskData.TSK_DB_FILES_TYPE_ENUM.LOCAL.ordinal()
+ (hideSlackFilesInViewsTree() ? "" : ("," + TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.ordinal()))
+ "))"
- + ( UserPreferences.groupItemsInTreeByDatasource() ? " AND data_source_obj_id = " + this.filteringDataSourceObjId() : " ")
+ + ( Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true) ? " AND data_source_obj_id = " + this.filteringDataSourceObjId() : " ")
+ (hideKnownFilesInViewsTree() ? (" AND (known IS NULL OR known != " + TskData.FileKnown.KNOWN.getFileKnownValue() + ")") : "");
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/HashsetHits.java b/Core/src/org/sleuthkit/autopsy/datamodel/HashsetHits.java
index 24bae3d368..8ff6645562 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/HashsetHits.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/HashsetHits.java
@@ -30,6 +30,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -41,6 +42,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -141,7 +143,7 @@ public class HashsetHits implements AutopsyVisitableItem {
+ "attribute_type_id=" + setNameId //NON-NLS
+ " AND blackboard_attributes.artifact_id=blackboard_artifacts.artifact_id" //NON-NLS
+ " AND blackboard_artifacts.artifact_type_id=" + artId; //NON-NLS
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
query += " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/InterestingHits.java b/Core/src/org/sleuthkit/autopsy/datamodel/InterestingHits.java
index 67622d180c..6e3c138fcd 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/InterestingHits.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/InterestingHits.java
@@ -30,6 +30,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -41,6 +42,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -132,7 +134,7 @@ public class InterestingHits implements AutopsyVisitableItem {
+ "attribute_type_id=" + setNameId //NON-NLS
+ " AND blackboard_attributes.artifact_id=blackboard_artifacts.artifact_id" //NON-NLS
+ " AND blackboard_artifacts.artifact_type_id=" + artId; //NON-NLS
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
query += " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java b/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java
index 51367297b8..9e60fba7f8 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/KeywordHits.java
@@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -43,6 +44,7 @@ import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -321,7 +323,7 @@ public class KeywordHits implements AutopsyVisitableItem {
}
String queryStr = KEYWORD_HIT_ATTRIBUTES_QUERY;
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
queryStr += " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId;
}
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
index b5f8ecff39..abf77350d2 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/Tags.java
@@ -23,6 +23,7 @@ import java.beans.PropertyChangeListener;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
+import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
@@ -34,6 +35,7 @@ import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.core.UserPreferences;
@@ -244,11 +246,11 @@ public class Tags implements AutopsyVisitableItem {
List tagNamesInUse;
if (UserPreferences.showOnlyCurrentUserTags()) {
String userName = System.getProperty(USER_NAME_PROPERTY);
- tagNamesInUse = UserPreferences.groupItemsInTreeByDatasource()
+ tagNamesInUse = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUseForUser(datasourceObjId, userName)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUseForUser(userName);
} else {
- tagNamesInUse = UserPreferences.groupItemsInTreeByDatasource()
+ tagNamesInUse = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse(datasourceObjId)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
}
@@ -301,7 +303,7 @@ public class Tags implements AutopsyVisitableItem {
TagsManager tm = Case.getCurrentCaseThrows().getServices().getTagsManager();
if (UserPreferences.showOnlyCurrentUserTags()) {
String userName = System.getProperty(USER_NAME_PROPERTY);
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
tagsCount = tm.getContentTagsCountByTagNameForUser(tagName, datasourceObjId, userName);
tagsCount += tm.getBlackboardArtifactTagsCountByTagNameForUser(tagName, datasourceObjId, userName);
} else {
@@ -309,7 +311,7 @@ public class Tags implements AutopsyVisitableItem {
tagsCount += tm.getBlackboardArtifactTagsCountByTagNameForUser(tagName, userName);
}
} else {
- if (UserPreferences.groupItemsInTreeByDatasource()) {
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
tagsCount = tm.getContentTagsCountByTagName(tagName, datasourceObjId);
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId);
} else {
@@ -422,11 +424,11 @@ public class Tags implements AutopsyVisitableItem {
if (UserPreferences.showOnlyCurrentUserTags()) {
String userName = System.getProperty(USER_NAME_PROPERTY);
- tagsCount = UserPreferences.groupItemsInTreeByDatasource()
+ tagsCount = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagNameForUser(tagName, datasourceObjId, userName)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagNameForUser(tagName, userName);
} else {
- tagsCount = UserPreferences.groupItemsInTreeByDatasource()
+ tagsCount = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName, datasourceObjId)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
}
@@ -484,7 +486,7 @@ public class Tags implements AutopsyVisitableItem {
protected boolean createKeys(List keys) {
// Use the content tags bearing the specified tag name as the keys.
try {
- List contentTags = UserPreferences.groupItemsInTreeByDatasource()
+ List contentTags = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName, datasourceObjId)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName);
if (UserPreferences.showOnlyCurrentUserTags()) {
@@ -542,11 +544,11 @@ public class Tags implements AutopsyVisitableItem {
try {
if (UserPreferences.showOnlyCurrentUserTags()) {
String userName = System.getProperty(USER_NAME_PROPERTY);
- tagsCount = UserPreferences.groupItemsInTreeByDatasource()
+ tagsCount = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagNameForUser(tagName, datasourceObjId, userName)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagNameForUser(tagName, userName);
} else {
- tagsCount = UserPreferences.groupItemsInTreeByDatasource()
+ tagsCount = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
}
@@ -604,7 +606,7 @@ public class Tags implements AutopsyVisitableItem {
protected boolean createKeys(List keys) {
try {
// Use the blackboard artifact tags bearing the specified tag name as the keys.
- List artifactTags = UserPreferences.groupItemsInTreeByDatasource()
+ List artifactTags = Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)
? Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName, datasourceObjId)
: Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName);
if (UserPreferences.showOnlyCurrentUserTags()) {
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java
index ff34985bc7..af4dd6c35e 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/accounts/Accounts.java
@@ -153,14 +153,8 @@ final public class Accounts implements AutopsyVisitableItem {
* based on the UserPreferences groupItemsInTreeByDatasource setting
*/
private String getFilterByDataSourceClause() {
- try {
- Case currentCase = Case.getCurrentCaseThrows();
- CasePreferences casePreferences = new CasePreferences(currentCase);
- if (Objects.equals(casePreferences.getGroupItemsInTreeByDataSource(), true)) {
- return " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId + " ";
- }
- } catch (NoCurrentCaseException ex) {
- LOGGER.log(Level.SEVERE, "No current case open.", ex); //DLG: Review this change. How should we return out of this???
+ if (Objects.equals(CasePreferences.getGroupItemsInTreeByDataSource(), true)) {
+ return " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId + " ";
}
return " ";
diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.form b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.form
index bacd1d8903..ccdd7650ea 100644
--- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.form
+++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeTopComponent.form
@@ -1,6 +1,14 @@