19 package org.sleuthkit.autopsy.casemodule;
 
   21 import java.awt.Dimension;
 
   22 import java.awt.Toolkit;
 
   23 import java.awt.event.ActionEvent;
 
   24 import java.beans.PropertyChangeEvent;
 
   25 import java.beans.PropertyChangeListener;
 
   26 import java.util.logging.Level;
 
   27 import javax.swing.Action;
 
   28 import javax.swing.JDialog;
 
   29 import javax.swing.JFrame;
 
   30 import org.openide.util.HelpCtx;
 
   31 import org.openide.util.NbBundle;
 
   32 import org.openide.util.actions.CallableSystemAction;
 
   33 import org.openide.windows.WindowManager;
 
   43 final class CasePropertiesAction 
extends CallableSystemAction {
 
   45     private static JDialog popUpWindow;
 
   50     CasePropertiesAction() {
 
   51         putValue(Action.NAME, NbBundle.getMessage(CasePropertiesAction.class, 
"CTL_CasePropertiesAction")); 
 
   52         this.setEnabled(
false);
 
   53         Case.addEventSubscriber(Case.Events.CURRENT_CASE.toString(), 
new PropertyChangeListener() {
 
   55             public void propertyChange(PropertyChangeEvent evt) {
 
   66     public void performAction() {
 
   67         if (popUpWindow == null) {
 
   69             String title = NbBundle.getMessage(this.getClass(), 
"CasePropertiesAction.window.title");
 
   70             popUpWindow = 
new JDialog((JFrame) WindowManager.getDefault().getMainWindow(), title, 
false);
 
   73                 CaseInformationPanel caseInformationPanel = 
new CaseInformationPanel();
 
   74                 caseInformationPanel.addCloseButtonAction((ActionEvent e) -> {
 
   75                     popUpWindow.dispose();
 
   78                 popUpWindow.add(caseInformationPanel);
 
   79                 popUpWindow.setResizable(
true);
 
   83                 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
 
   84                 double w = popUpWindow.getSize().getWidth();
 
   85                 double h = popUpWindow.getSize().getHeight();
 
   86                 popUpWindow.setLocation((
int) ((screenDimension.getWidth() - w) / 2), (int) ((screenDimension.getHeight() - h) / 2));
 
   88                 popUpWindow.setVisible(
true);
 
   89             } 
catch (Exception ex) {
 
   90                 Logger.getLogger(CasePropertiesAction.class.getName()).log(Level.WARNING, 
"Error displaying Case Properties window.", ex); 
 
   93         popUpWindow.setVisible(
true);
 
   94         popUpWindow.toFront();
 
  103     public String getName() {
 
  104         return NbBundle.getMessage(CasePropertiesAction.class, 
"CTL_CasePropertiesAction");
 
  113     public HelpCtx getHelpCtx() {
 
  114         return HelpCtx.DEFAULT_HELP;
 
  117     static void closeCasePropertiesWindow() {
 
  118         popUpWindow.dispose();