19 package org.sleuthkit.autopsy.logicalimager.configuration;
21 import java.awt.Component;
22 import java.awt.Dialog;
24 import java.nio.file.Path;
25 import java.nio.file.Paths;
26 import java.text.MessageFormat;
27 import java.util.ArrayList;
28 import java.util.List;
29 import javax.swing.JComponent;
30 import org.openide.DialogDisplayer;
31 import org.openide.WizardDescriptor;
32 import org.openide.awt.ActionID;
33 import org.openide.awt.ActionReference;
34 import org.openide.awt.ActionRegistration;
35 import org.openide.modules.InstalledFileLocator;
36 import org.openide.util.HelpCtx;
37 import org.openide.util.NbBundle;
38 import org.openide.util.NbBundle.Messages;
39 import org.openide.util.actions.CallableSystemAction;
44 @ActionID(category =
"Tools",
id =
"org.sleuthkit.autopsy.logicalimager.configuration.CreateLogicalImagerAction")
45 @ActionRegistration(displayName =
"#CTL_CreateLogicalImagerAction", lazy =
false)
46 @ActionReference(path =
"Menu/Tools", position = 2000, separatorBefore = 1999)
47 @Messages(
"CTL_CreateLogicalImagerAction=Create Logical Imager")
50 private static final long serialVersionUID = 1L;
51 private static final String LOGICAL_IMAGER_DIR =
"tsk_logical_imager";
52 private static final String LOGICAL_IMAGER_EXE =
"tsk_logical_imager.exe";
53 private static final Path LOGICAL_IMAGER_EXE_PATH = Paths.get(LOGICAL_IMAGER_DIR, LOGICAL_IMAGER_EXE);
60 static File getLogicalImagerExe() {
65 "CreateLogicalImagerAction.title=Create Logical Imager"
69 List<WizardDescriptor.Panel<WizardDescriptor>> panels =
new ArrayList<>();
70 panels.add(
new ConfigWizardPanel1());
71 panels.add(
new ConfigWizardPanel2());
72 panels.add(
new ConfigWizardPanel3());
73 String[] steps =
new String[panels.size()];
74 for (
int i = 0; i < panels.size(); i++) {
75 Component c = panels.get(i).getComponent();
77 steps[i] = c.getName();
78 if (c instanceof JComponent) {
79 JComponent jc = (JComponent) c;
80 jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
81 jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
82 jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE,
true);
83 jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED,
true);
84 jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED,
true);
87 WizardDescriptor wiz =
new WizardDescriptor(
new WizardDescriptor.ArrayIterator<>(panels));
89 wiz.setTitleFormat(
new MessageFormat(
"{0}"));
90 wiz.setTitle(Bundle.CreateLogicalImagerAction_title());
91 Dialog dialog = DialogDisplayer.getDefault().createDialog(wiz);
92 dialog.setVisible(
true);
97 return Bundle.CTL_CreateLogicalImagerAction();
102 return HelpCtx.DEFAULT_HELP;
107 File logicalImagerExe = getLogicalImagerExe();
108 return logicalImagerExe != null && logicalImagerExe.exists();