Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DataResultMenu.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 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.menuactions;
20 
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import javax.swing.JMenu;
24 import javax.swing.JMenuItem;
25 import org.openide.util.HelpCtx;
26 import org.openide.util.NbBundle;
27 import org.openide.util.actions.CallableSystemAction;
28 import org.openide.util.actions.Presenter;
30 
34 class DataResultMenu extends CallableSystemAction implements Presenter.Menu, PropertyChangeListener {
35 
36  JMenu menu = new JMenu(NbBundle.getMessage(this.getClass(), "DataResultMenu.menu.dataResWin.text"));
37 
38  DataResultMenu() {
39  }
40 
41  @Override
42  public JMenuItem getMenuPresenter() {
43  return new SearchResultMenu();
44  }
45 
46  @Override
47  public void propertyChange(PropertyChangeEvent evt) {
48  String changed = evt.getPropertyName();
49  Object oldValue = evt.getOldValue();
50  Object newValue = evt.getNewValue();
51 
52  if (changed.equals(Case.Events.CURRENT_CASE.toString())) {
53  if (newValue != null) {
54  // enable all menus when a case is created / opened
55  int totalMenus = menu.getItemCount();
56  for (int i = 0; i < totalMenus; i++) {
57  menu.getItem(i).setEnabled(true);
58  }
59  } else {
60  // disable all menus when the case is closed
61  int totalMenus = menu.getItemCount();
62  for (int i = 0; i < totalMenus; i++) {
63  menu.getItem(i).setEnabled(false);
64  }
65  }
66  }
67  }
68 
69  @Override
70  public void performAction() {
71 
72  }
73 
74  @Override
75  public String getName() {
76  return NbBundle.getMessage(this.getClass(), "DataResultMenu.getName.text");
77  }
78 
79  @Override
80  public HelpCtx getHelpCtx() {
81  return HelpCtx.DEFAULT_HELP;
82  }
83 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.