19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Frame;
22 import java.awt.event.ActionEvent;
23 import java.beans.PropertyChangeEvent;
24 import java.util.EnumSet;
25 import javax.swing.Action;
26 import javax.swing.JDialog;
27 import javax.swing.SwingUtilities;
28 import org.openide.util.HelpCtx;
29 import org.openide.util.NbBundle;
30 import org.openide.util.actions.CallableSystemAction;
31 import org.openide.windows.WindowManager;
37 final class CasePropertiesAction
extends CallableSystemAction {
39 private static final long serialVersionUID = 1L;
40 private static JDialog casePropertiesDialog;
42 CasePropertiesAction() {
43 putValue(Action.NAME, NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction"));
44 this.setEnabled(
false);
45 Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
46 setEnabled(null != evt.getNewValue());
51 public void performAction() {
52 SwingUtilities.invokeLater(() -> {
53 String title = NbBundle.getMessage(this.getClass(),
"CasePropertiesAction.window.title");
54 Frame mainWindow = WindowManager.getDefault().getMainWindow();
55 casePropertiesDialog =
new JDialog(mainWindow, title,
true);
56 CaseInformationPanel caseInformationPanel =
new CaseInformationPanel();
57 caseInformationPanel.addCloseButtonAction((ActionEvent e) -> {
58 casePropertiesDialog.setVisible(
false);
60 casePropertiesDialog.add(caseInformationPanel);
61 casePropertiesDialog.setResizable(
true);
62 casePropertiesDialog.pack();
63 casePropertiesDialog.setLocationRelativeTo(mainWindow);
64 casePropertiesDialog.setVisible(
true);
65 casePropertiesDialog.toFront();
70 public String getName() {
71 return NbBundle.getMessage(CasePropertiesAction.class,
"CTL_CasePropertiesAction");
75 public HelpCtx getHelpCtx() {
76 return HelpCtx.DEFAULT_HELP;