Merge pull request #2345 from eugene7646/improvements

UI improvements and bug fixes
This commit is contained in:
Richard Cordovano 2016-09-15 16:13:08 -04:00 committed by GitHub
commit 493befde93
10 changed files with 213 additions and 43 deletions

View File

@ -37,16 +37,19 @@ import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.sleuthkit.autopsy.coreutils.Logger;
import java.util.logging.Level;
import org.openide.util.HelpCtx;
import org.openide.util.actions.CallableSystemAction;
import org.sleuthkit.autopsy.ingest.IngestManager;
/**
* An action that opens an existing case.
*/
@ServiceProvider(service = CaseOpenAction.class)
public final class CaseOpenAction implements ActionListener {
public final class CaseOpenAction extends CallableSystemAction implements ActionListener {
private static final Logger logger = Logger.getLogger(CaseOpenAction.class.getName());
private static final String PROP_BASECASE = "LBL_BaseCase_PATH"; //NON-NLS
private static final long serialVersionUID = 1L;
private final JFileChooser fileChooser = new JFileChooser();
private final FileFilter caseMetadataFileFilter;
@ -140,4 +143,18 @@ public final class CaseOpenAction implements ActionListener {
}).start();
}
}
@Override
public void performAction() {
}
@Override
public String getName() {
return NbBundle.getMessage(CaseOpenAction.class, "CTL_OpenAction");
}
@Override
public HelpCtx getHelpCtx() {
return HelpCtx.DEFAULT_HELP;
}
}

View File

@ -1,6 +1,7 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.sleuthkit.autopsy.experimental
OpenIDE-Module-Layer: org/sleuthkit/autopsy/experimental/autoingest/layer.xml
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

View File

@ -39,6 +39,14 @@
<specification-version>9.8.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.loaders</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.63.2</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.modules</code-name-base>
<build-prerequisite/>

View File

@ -0,0 +1,99 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.experimental.autoingest;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.openide.util.actions.SystemAction;
import org.sleuthkit.autopsy.casemodule.CaseCloseAction;
import org.sleuthkit.autopsy.casemodule.CaseOpenAction;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences;
final class AutoIngestCaseOpenAction extends CallableSystemAction implements ActionListener {
private static final Logger logger = Logger.getLogger(AutoIngestCaseOpenAction.class.getName());
private static final long serialVersionUID = 1L;
public AutoIngestCaseOpenAction() {
}
@Override
public void actionPerformed(ActionEvent e) {
AutoIngestUserPreferences.SelectedMode mode = AutoIngestUserPreferences.getMode();
switch (mode) {
case REVIEW:
if (Case.isCaseOpen()) {
/*
* In review mode, close the currently open case, if any, and
* then display the review mode cases panel. This can be
* accomplished by invoking CaseCloseAction because it calls
* StartupWindowProvider.getInstance().open() after it closes
* the current case.
*/
SystemAction.get(CaseCloseAction.class).actionPerformed(e);
} else {
// no case is open, so show the startup window
StartupWindowProvider.getInstance().open();
}
break;
case AUTOMATED:
/*
* New case action is disabled in auto ingest mode.
*/
break;
case STANDALONE:
/**
* In standalone mode, invoke default Autopsy version of CaseOpenAction.
*/
Lookup.getDefault().lookup(CaseOpenAction.class).actionPerformed(e);
break;
default:
logger.log(Level.SEVERE, "Attempting to open case in unsupported mode {0}", mode.toString());
}
}
@Override
public void performAction() {
}
@Override
public String getName() {
return NbBundle.getMessage(AutoIngestCaseOpenAction.class, "CTL_OpenAction");
}
@Override
public HelpCtx getHelpCtx() {
return HelpCtx.DEFAULT_HELP;
}
}

View File

@ -53,7 +53,12 @@ import org.netbeans.api.options.OptionsDisplayer;
import org.openide.DialogDisplayer;
import org.openide.LifecycleManager;
import org.openide.NotifyDescriptor;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.sleuthkit.autopsy.casemodule.CaseNewAction;
import org.sleuthkit.autopsy.casemodule.CaseOpenAction;
import org.sleuthkit.autopsy.core.ServicesMonitor;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
@ -176,6 +181,8 @@ public final class AutoIngestDashboard extends JPanel implements Observer {
* controlling automated ingest for a single node within the cluster.
*/
private AutoIngestDashboard() {
disableUiMenuActions();
manager = AutoIngestManager.getInstance();
pendingTableModel = new DefaultTableModel(JobsTableModelColumns.headers, 0) {
@ -217,6 +224,36 @@ public final class AutoIngestDashboard extends JPanel implements Observer {
*/
UIManager.put("PopupMenu.consumeEventOnClose", false);
}
private void disableUiMenuActions() {
/*
* Disable the new case action in auto ingest mode.
*/
CallableSystemAction.get(CaseNewAction.class).setEnabled(false);
/*
* Disable the new case action in auto ingest mode.
*/
CallableSystemAction.get(CaseOpenAction.class).setEnabled(false);
CallableSystemAction.get(AutoIngestCaseOpenAction.class).setEnabled(false);
/*
* Permanently delete the "Open Recent Cases" item in the "Case" menu.
* This is quite drastic, as it also affects Autopsy standalone mode on
* this machine, but we need to make sure a user can't open case in
* automated ingest mode. "Open Recent Cases" item can't be disabled via
* CallableSystemAction because of how it is defined in layer.xml, i.e.
* it is defined as "folder", not "file".
*/
FileObject root = FileUtil.getConfigRoot();
FileObject openRecentCasesMenu = root.getFileObject("Menu/Case/OpenRecentCase");
if (openRecentCasesMenu != null) {
try {
openRecentCasesMenu.delete();
} catch (IOException ignore) {
}
}
}
/**
* Queries the services monitor and sets the text for the services status

View File

@ -1,3 +1,4 @@
CTL_OpenAction=Open Case...
AutoIngestDashboard.bnRefresh.text=&Refresh
AutoIngestDashboard.lbCompleted.text=Completed Jobs
AutoIngestDashboard.lbRunning.text=Running Jobs
@ -218,7 +219,6 @@ SingleUserCaseImporter.FailedToComplete=Failed to complete processing of
SingleUserCaseImporter.CompletedBatch=Completed batch processing of
SingleUserCaseImporter.AbortingBatch=Aborting batch processing of
SingleUserCaseImporter.SourceImageMissing=. Source image missing for
ReviewModeCasePanel.bnOptions.text=Op&tions
ReviewModeCasePanel.CaseHeaderText=Case
ReviewModeCasePanel.CreatedTimeHeaderText=Created Time
ReviewModeCasePanel.StatusIconHeaderText=Status

View File

@ -33,8 +33,6 @@
<Component id="bnRefresh" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="bnShowLog" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="bnOptions" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="panelFilter" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
@ -63,7 +61,6 @@
<Component id="bnOpen" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bnRefresh" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bnShowLog" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bnOptions" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
</Group>
@ -236,15 +233,5 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bnShowLogActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="bnOptions">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties" key="ReviewModeCasePanel.bnOptions.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bnOptionsActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -39,7 +39,6 @@ import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
import java.awt.Cursor;
import java.io.IOException;
import org.netbeans.api.options.OptionsDisplayer;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.CaseMetadata;
import org.sleuthkit.autopsy.experimental.autoingest.ReviewModeCaseManager.ReviewModeCaseManagerException;
@ -385,7 +384,6 @@ public final class ReviewModeCasePanel extends JPanel {
rbDays = new javax.swing.JRadioButton();
rbGroupLabel = new javax.swing.JLabel();
bnShowLog = new javax.swing.JButton();
bnOptions = new javax.swing.JButton();
setName("Completed Cases"); // NOI18N
@ -492,13 +490,6 @@ public final class ReviewModeCasePanel extends JPanel {
}
});
org.openide.awt.Mnemonics.setLocalizedText(bnOptions, org.openide.util.NbBundle.getMessage(ReviewModeCasePanel.class, "ReviewModeCasePanel.bnOptions.text")); // NOI18N
bnOptions.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnOptionsActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -513,8 +504,6 @@ public final class ReviewModeCasePanel extends JPanel {
.addComponent(bnRefresh)
.addGap(18, 18, 18)
.addComponent(bnShowLog)
.addGap(18, 18, 18)
.addComponent(bnOptions)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20))
@ -536,8 +525,7 @@ public final class ReviewModeCasePanel extends JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bnOpen)
.addComponent(bnRefresh)
.addComponent(bnShowLog)
.addComponent(bnOptions))
.addComponent(bnShowLog))
.addGap(36, 36, 36))))
);
}// </editor-fold>//GEN-END:initComponents
@ -611,12 +599,6 @@ public final class ReviewModeCasePanel extends JPanel {
}
}//GEN-LAST:event_bnShowLogActionPerformed
private void bnOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnOptionsActionPerformed
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
OptionsDisplayer.getDefault().open();
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}//GEN-LAST:event_bnOptionsActionPerformed
private void casesTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_casesTableMouseClicked
if (evt.getClickCount() == 2) {
Path caseMetadataFilePath = Paths.get((String) caseTableModel.getValueAt(casesTable.getSelectedRow(),
@ -628,7 +610,6 @@ public final class ReviewModeCasePanel extends JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bnOpen;
private javax.swing.JButton bnOptions;
private javax.swing.JButton bnRefresh;
private javax.swing.JButton bnShowLog;
private javax.swing.JTable casesTable;

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<!-- ======================================================
Actions
====================================================== -->
<folder name="Actions">
<folder name="Case">
<file name="org-sleuthkit-autopsy-experimental-autoingest-AutoIngestCaseOpenAction.instance">
<attr name="delegate" newvalue="org.sleuthkit.autopsy.experimental.autoingest.AutoIngestCaseOpenAction"/>
<attr name="displayName" stringvalue="Open Case"/>
<attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
<attr name="noIconInMenu" boolvalue="false"/>
</file>
</folder>
</folder>
<!-- ======================================================
Menu hidden
=========================================================== -->
<folder name="Menu">
<folder name="Help">
<file name="org-sleuthkit-autopsy-corecomponents-CustomAboutAction.shadow_hidden"/>
</folder>
<folder name="Case">
<file name="org-sleuthkit-autopsy-casemodule-CaseOpenAction.shadow_hidden"/>
<file name="org-sleuthkit-autopsy-experimental-autoingest-AutoIngestCaseOpenAction.shadow">
<attr name="originalFile" stringvalue="Actions/Case/org-sleuthkit-autopsy-experimental-autoingest-AutoIngestCaseOpenAction.instance"/>
<attr name="position" intvalue="101"/>
</file>
</folder>
</folder>
</filesystem>

View File

@ -36,6 +36,7 @@ import java.awt.Dimension;
import java.nio.file.Paths;
import org.openide.util.ImageUtilities;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -220,10 +221,12 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel {
needsSaving = true;
}
if (needsSaving) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
}
AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.AUTOMATED);
@ -240,10 +243,12 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel {
} else if (jRadioButtonReview.isSelected()) {
String thePath = AutoIngestUserPreferences.getAutoModeResultsFolder();
if (thePath != null && 0 != outputPathTextField.getText().compareTo(thePath)) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"),
NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"),
JOptionPane.WARNING_MESSAGE);
});
}
AutoIngestUserPreferences.setMode(AutoIngestUserPreferences.SelectedMode.REVIEW);