Merge pull request #2221 from BasisOlivers/2149

Added timeline to the toolbar.
This commit is contained in:
Richard Cordovano 2016-06-08 14:02:04 -04:00
commit c7b38e6a28
11 changed files with 71 additions and 37 deletions

View File

@ -46,7 +46,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.apache.commons.io.FileUtils;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.openide.util.actions.CallableSystemAction;
@ -76,6 +75,7 @@ import org.sleuthkit.autopsy.events.AutopsyEventException;
import org.sleuthkit.autopsy.events.AutopsyEventPublisher;
import org.sleuthkit.autopsy.ingest.IngestJob;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.timeline.OpenTimelineAction;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag;
@ -1519,28 +1519,22 @@ public class Case implements SleuthkitCase.ErrorObserver {
if (RuntimeProperties.coreComponentsAreActive()) {
// enable these menus
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
if (toChangeTo.hasData()) {
// open all top components
SwingUtilities.invokeLater(() -> {
CoreComponentControl.openCoreWindows();
});
} else {
// close all top components
SwingUtilities.invokeLater(() -> {
CoreComponentControl.closeCoreWindows();
});
}
}
if (RuntimeProperties.coreComponentsAreActive()) {
SwingUtilities.invokeLater(() -> {
updateMainWindowTitle(currentCase.getName());
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
CallableSystemAction.get(OpenTimelineAction.class).setEnabled(true);
if (toChangeTo.hasData()) {
// open all top components
CoreComponentControl.openCoreWindows();
} else {
// close all top components
CoreComponentControl.closeCoreWindows();
}
});
updateMainWindowTitle(currentCase.getName());
} else {
SwingUtilities.invokeLater(() -> {
Frame f = WindowManager.getDefault().getMainWindow();
@ -1549,9 +1543,9 @@ public class Case implements SleuthkitCase.ErrorObserver {
}
} else { // case is closed
if (RuntimeProperties.coreComponentsAreActive()) {
SwingUtilities.invokeLater(() -> {
if (RuntimeProperties.coreComponentsAreActive()) {
SwingUtilities.invokeLater(() -> {
// close all top components first
CoreComponentControl.closeCoreWindows();
@ -1560,15 +1554,11 @@ public class Case implements SleuthkitCase.ErrorObserver {
CallableSystemAction.get(CaseCloseAction.class).setEnabled(false); // Case Close menu
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false); // Case Properties menu
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false); // Delete Case menu
});
}
CallableSystemAction.get(OpenTimelineAction.class).setEnabled(false);
}
//clear pending notifications
SwingUtilities.invokeLater(() -> {
//clear pending notifications
MessageNotifyUtil.Notify.clear();
});
SwingUtilities.invokeLater(() -> {
Frame f = WindowManager.getDefault().getMainWindow();
f.setTitle(Case.getAppName()); // set the window name to just application name
});
@ -1664,7 +1654,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
* Deletes reports from the case.
*
* @param reports Collection of Report to be deleted from the case.
* @param deleteFromDisk No longer supported - ignored.
* @param deleteFromDisk No longer supported - ignored.
*
* @throws TskCoreException
* @deprecated Use deleteReports(Collection<? extends Report> reports)
@ -1674,5 +1664,5 @@ public class Case implements SleuthkitCase.ErrorObserver {
public void deleteReports(Collection<? extends Report> reports, boolean deleteFromDisk) throws TskCoreException {
deleteReports(reports);
}
}

View File

@ -387,11 +387,11 @@
<file name="org-sleuthkit-autopsy-report-ReportWizardAction.shadow">
<attr name="displayName" bundlevalue="org.sleuthkit.autopsy.report.Bundle#Toolbars/Reports/org-sleuthkit-autopsy-report-ReportWizardAction.shadow"/>
<attr name="originalFile" stringvalue="Actions/Tools/org-sleuthkit-autopsy-report-ReportWizardAction.instance"/>
<attr name="position" intvalue="102"/>
<attr name="position" intvalue="103"/>
</file>
</folder>
<folder name="Ingest">
<attr intvalue="103" name="position"/>
<attr intvalue="104" name="position"/>
<file name="org-sleuthkit-autopsy-ingest-IngestMessagesAction.shadow">
<attr name="originalFile" stringvalue="Actions/Tools/org-sleuthkit-autopsy-ingest-IngestMessagesAction.instance"/>
</file>

View File

@ -18,8 +18,13 @@
*/
package org.sleuthkit.autopsy.timeline;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.logging.Level;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
@ -27,6 +32,7 @@ import org.openide.awt.ActionRegistration;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.openide.util.actions.Presenter;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.core.Installer;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -36,8 +42,9 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.timeline.Timeline")
@ActionRegistration(displayName = "#CTL_MakeTimeline", lazy = false)
@ActionReferences(value = {
@ActionReference(path = "Menu/Tools", position = 100)})
public class OpenTimelineAction extends CallableSystemAction {
@ActionReference(path = "Menu/Tools", position = 100),
@ActionReference(path = "Toolbars/Case", position = 102)})
public class OpenTimelineAction extends CallableSystemAction implements Presenter.Toolbar {
private static final Logger LOGGER = Logger.getLogger(OpenTimelineAction.class.getName());
@ -45,10 +52,22 @@ public class OpenTimelineAction extends CallableSystemAction {
private static TimeLineController timeLineController = null;
private JButton toolbarButton = new JButton();
synchronized static void invalidateController() {
timeLineController = null;
}
public OpenTimelineAction() {
toolbarButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
performAction();
}
});
this.setEnabled(false);
}
@Override
public boolean isEnabled() {
/**
@ -102,4 +121,29 @@ public class OpenTimelineAction extends CallableSystemAction {
public boolean asynchronous() {
return false; // run on edt
}
/**
* Set this action to be enabled/disabled
*
* @param value whether to enable this action or not
*/
@Override
public void setEnabled(boolean value) {
super.setEnabled(value);
toolbarButton.setEnabled(value);
}
/**
* Returns the toolbar component of this action
*
* @return component the toolbar button
*/
@Override
public Component getToolbarPresenter() {
ImageIcon icon = new ImageIcon("Core/src/org/sleuthkit/autopsy/timeline/images/btn_icon_timeline_colorized_26.png"); //NON-NLS
toolbarButton.setIcon(icon);
toolbarButton.setText(this.getName());
return toolbarButton;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -31,7 +31,7 @@ import org.openide.util.Lookup;
*/
@OptionsPanelController.TopLevelRegistration(
categoryName = "#OptionsCategory_Name_Options",
iconBase = "org/sleuthkit/autopsy/imagegallery/images/polaroid_32_silhouette.png",
iconBase = "org/sleuthkit/autopsy/imagegallery/images/btn_icon_image_gallery_32.png",
keywords = "#OptionsCategory_Keywords_Options",
keywordsCategory = "Options",
position = 10

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB