Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
OpenPersonasAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2020 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.centralrepository.persona;
20 
21 import javax.swing.JMenuItem;
22 import org.openide.awt.ActionID;
23 import org.openide.awt.ActionReference;
24 import org.openide.awt.ActionReferences;
25 import org.openide.awt.ActionRegistration;
26 import org.openide.util.HelpCtx;
27 import org.openide.util.NbBundle;
28 import org.openide.util.actions.CallableSystemAction;
29 import org.openide.windows.TopComponent;
30 import org.openide.windows.WindowManager;
33 
38 @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.centralrepository.persona.OpenPersonasAction")
39 @ActionRegistration(displayName = "#CTL_OpenPersonas", lazy = false)
40 @ActionReferences(value = {
41  @ActionReference(path = "Menu/Tools", position = 1825, separatorBefore = 1824)
42 })
43 public final class OpenPersonasAction extends CallableSystemAction {
44 
45  private static final long serialVersionUID = 1L;
46 
47  private final JMenuItem menuItem;
48 
49  public OpenPersonasAction() {
50  menuItem = super.getMenuPresenter();
51  this.setEnabled(CentralRepository.isEnabled());
52  }
53 
54  @Override
56  public void performAction() {
57  final TopComponent topComponent = WindowManager.getDefault().findTopComponent("PersonasTopComponent");
58  if (topComponent != null) {
59  if (topComponent.isOpened() == false) {
60  topComponent.open();
61  }
62  topComponent.toFront();
63  topComponent.requestActive();
64  }
65  }
66 
67  @Override
68  @NbBundle.Messages("OpenPersonasAction.displayName=Personas")
69  public String getName() {
70  return Bundle.OpenPersonasAction_displayName();
71  }
72 
73  @Override
74  public HelpCtx getHelpCtx() {
75  return HelpCtx.DEFAULT_HELP;
76  }
77 
78  @Override
79  public boolean asynchronous() {
80  return false; // run on edt
81  }
82 
83  @Override
84  public void setEnabled(boolean enable) {
85  super.setEnabled(enable);
86  menuItem.setEnabled(enable);
87  }
88 
89  @Override
90  public boolean isEnabled() {
92  }
93 
94  @Override
95  public JMenuItem getMenuPresenter() {
96  return menuItem;
97  }
98 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.