20 package org.sleuthkit.autopsy.menuactions;
22 import java.util.List;
23 import javax.swing.JComponent;
24 import javax.swing.JMenu;
25 import javax.swing.JMenuItem;
26 import org.openide.awt.DynamicMenuContent;
27 import org.openide.util.Lookup;
28 import org.openide.util.NbBundle;
29 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));
55 defaultItem.setEnabled(
false);
57 defaultItem.setEnabled(
true);
60 comps[counter++] = defaultItem;
63 if (newWindowLists != null) {
64 if (newWindowLists.size() > 0) {
66 JMenu submenu =
new JMenu(
67 NbBundle.getMessage(
this.getClass(),
"DataContentDynamicMenu.menu.dataContentWin.text"));
68 for (
int i = 0; i < newWindowLists.size(); i++) {
70 JMenuItem item =
new JMenuItem(dctc.getName());
71 item.addActionListener(
new OpenTopComponentAction(dctc));
75 comps[counter++] = submenu;
83 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
84 return getMenuPresenters();
static boolean existsCurrentCase()
static synchronized DataContentTopComponent findInstance()
static List< DataContentTopComponent > getNewWindowList()
static Case getCurrentCase()