19package org.sleuthkit.autopsy.casemodule;
21import java.awt.Component;
22import java.awt.Cursor;
23import java.awt.Dialog;
24import java.awt.Dimension;
25import java.awt.event.ActionEvent;
26import java.awt.event.ActionListener;
27import java.text.MessageFormat;
28import java.util.logging.Level;
29import javax.swing.Action;
30import javax.swing.ImageIcon;
31import javax.swing.JButton;
32import javax.swing.RootPaneContainer;
33import javax.swing.SwingUtilities;
34import javax.swing.event.ChangeEvent;
35import javax.swing.event.ChangeListener;
36import org.openide.DialogDisplayer;
37import org.openide.WizardDescriptor;
38import org.openide.awt.ActionID;
39import org.openide.awt.ActionReference;
40import org.openide.awt.ActionReferences;
41import org.openide.awt.ActionRegistration;
42import org.openide.util.ChangeSupport;
43import org.openide.util.HelpCtx;
44import org.openide.util.NbBundle;
45import org.openide.util.actions.CallableSystemAction;
46import org.openide.util.actions.Presenter;
47import org.openide.util.lookup.ServiceProvider;
48import org.openide.windows.WindowManager;
49import org.sleuthkit.autopsy.actions.IngestRunningCheck;
50import org.sleuthkit.autopsy.coreutils.Logger;
51import org.sleuthkit.datamodel.Image;
58@ActionID(category =
"Tools",
id =
"org.sleuthkit.autopsy.casemodule.AddImageAction")
59@ActionRegistration(displayName =
"#CTL_AddImage", lazy =
false)
60@ActionReferences(value = {
61 @ActionReference(path =
"Toolbars/Case", position = 100)})
63public final class
AddImageAction extends CallableSystemAction implements Presenter.Toolbar {
66 private static final Dimension
SIZE =
new Dimension(875, 550);
73 static final String TIMEZONE_PROP =
"timeZone";
75 static final String DATASOURCEPATH_PROP =
"dataSrcPath";
77 static final String DATASOURCETYPE_PROP =
"dataSrcType";
79 static final String IMAGECLEANUPTASK_PROP =
"finalFileCleanup";
81 static final String IMAGEID_PROP =
"imageId";
83 static final String PROCESS_PROP =
"process";
85 static final String LOOKUPFILES_PROP =
"lookupFiles";
87 static final String NOFATORPHANS_PROP =
"nofatorphans";
91 private WizardDescriptor.Iterator<WizardDescriptor>
iterator;
99 putValue(Action.NAME, NbBundle.getMessage(
AddImageAction.class,
"CTL_AddImage"));
119 String optionsDlgTitle = NbBundle.getMessage(this.getClass(),
"AddImageAction.ingestConfig.ongoingIngest.title");
120 String optionsDlgMessage = NbBundle.getMessage(this.getClass(),
"AddImageAction.ingestConfig.ongoingIngest.msg");
122 RootPaneContainer root = (RootPaneContainer) WindowManager.getDefault().getMainWindow();
123 root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
124 root.getGlassPane().setVisible(
true);
125 WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
126 iterator =
new AddImageWizardIterator(
this);
128 wizardDescriptor.setTitle(NbBundle.getMessage(
this.getClass(),
"AddImageAction.wizard.title"));
136 Dimension d =
dialog.getSize();
138 root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
139 root.getGlassPane().setVisible(
false);
155 wizardDescriptor.setValue(WizardDescriptor.FINISH_OPTION);
156 dialog.setVisible(
false);
160 final Runnable r =
new Runnable() {
163 actionPerformed(
null);
167 SwingUtilities.invokeLater(r);
187 return NbBundle.getMessage(
AddImageAction.class,
"CTL_AddImageButton");
197 return HelpCtx.DEFAULT_HELP;
207 ImageIcon icon =
new ImageIcon(getClass().getResource(
"btn_icon_add_image.png"));
220 super.setEnabled(value);
236 for (Object wizardButton : wizardButtons) {
237 JButton tempButton = (JButton) wizardButton;
238 if (tempButton.getText().equals(buttonText)) {
239 tempButton.setDefaultCapable(
true);
240 tempButton.requestFocus();
263 abstract class CleanupTask
implements ChangeListener {
266 public void stateChanged(ChangeEvent e) {
270 }
catch (Exception ex) {
271 Logger logger = Logger.
getLogger(this.getClass().getName());
272 logger.log(Level.WARNING,
"Error cleaning up from wizard.", ex);
281 public void enable() {
282 cleanupSupport.addChangeListener(
this);
290 abstract void cleanup() throws Exception;
295 public
void disable() {
296 cleanupSupport.removeChangeListener(
this);
static boolean checkAndConfirmProceed(String optionsDlgTitle, String optionsDlgMessage)
Component getToolbarPresenter()
final JButton toolbarButton
final ChangeSupport cleanupSupport
void actionPerformed(ActionEvent e)
void setEnabled(boolean value)
WizardDescriptor wizardDescriptor
static final long serialVersionUID
WizardDescriptor.Iterator< WizardDescriptor > iterator
static final Dimension SIZE
void requestFocusButton(String buttonText)
synchronized static Logger getLogger(String name)
void runTask(Image newImage)