19 package org.sleuthkit.autopsy.menuactions;
21 import java.util.List;
22 import javax.swing.JComponent;
23 import javax.swing.JMenu;
24 import javax.swing.JMenuItem;
25 import org.openide.awt.DynamicMenuContent;
26 import org.openide.util.Lookup;
27 import org.openide.util.NbBundle;
28 import org.openide.windows.TopComponent;
38 class DataContentDynamicMenu
extends JMenuItem implements DynamicMenuContent {
41 public JComponent[] getMenuPresenters() {
45 int totalItems = newWindowLists.size() > 0 ? 2 : 1;
46 JComponent[] comps =
new JComponent[totalItems];
50 JMenuItem defaultItem =
new JMenuItem(contentWin.getName());
52 defaultItem.addActionListener(
new OpenTopComponentAction(contentWin));
56 defaultItem.setEnabled(currentCase.
hasData());
58 defaultItem.setEnabled(
false);
61 comps[counter++] = defaultItem;
64 if (newWindowLists != null) {
65 if (newWindowLists.size() > 0) {
67 JMenu submenu =
new JMenu(
68 NbBundle.getMessage(
this.getClass(),
"DataContentDynamicMenu.menu.dataContentWin.text"));
69 for (
int i = 0; i < newWindowLists.size(); i++) {
71 JMenuItem item =
new JMenuItem(dctc.getName());
72 item.addActionListener(
new OpenTopComponentAction(dctc));
76 comps[counter++] = submenu;
84 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
85 return getMenuPresenters();
static synchronized DataContentTopComponent findInstance()
static List< DataContentTopComponent > getNewWindowList()
static Case getCurrentCaseThrows()