Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CaseDetailsAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.casemodule;
20 
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;
32 
37 final class CaseDetailsAction extends CallableSystemAction {
38 
39  private static final long serialVersionUID = 1L;
40  private static JDialog caseDetailsDialog;
41 
42  CaseDetailsAction() {
43  putValue(Action.NAME, NbBundle.getMessage(CaseDetailsAction.class, "CTL_CaseDetailsAction"));
44  this.setEnabled(false);
45  Case.addEventTypeSubscriber(EnumSet.of(Case.Events.CURRENT_CASE), (PropertyChangeEvent evt) -> {
46  setEnabled(null != evt.getNewValue());
47  });
48  }
49 
50  @Override
51  public void performAction() {
52  SwingUtilities.invokeLater(() -> {
53  String title = NbBundle.getMessage(this.getClass(), "CaseDetailsAction.window.title");
54  Frame mainWindow = WindowManager.getDefault().getMainWindow();
55  caseDetailsDialog = new JDialog(mainWindow, title, true);
56  CaseInformationPanel caseInformationPanel = new CaseInformationPanel();
57  caseInformationPanel.addCloseButtonAction((ActionEvent e) -> {
58  caseDetailsDialog.dispose();
59  });
60  caseDetailsDialog.add(caseInformationPanel);
61  caseDetailsDialog.setResizable(true);
62  caseDetailsDialog.pack();
63  caseDetailsDialog.setLocationRelativeTo(mainWindow);
64  caseDetailsDialog.setVisible(true);
65  caseDetailsDialog.toFront();
66  });
67  }
68 
69  @Override
70  public String getName() {
71  return NbBundle.getMessage(CaseDetailsAction.class, "CTL_CaseDetailsAction");
72  }
73 
74  @Override
75  public HelpCtx getHelpCtx() {
76  return HelpCtx.DEFAULT_HELP;
77  }
78 }

Copyright © 2012-2021 Basis Technology. Generated on: Thu Sep 30 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.