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.NbBundle;
27 import org.openide.windows.TopComponent;
36 class DataContentDynamicMenu
extends JMenuItem implements DynamicMenuContent {
38 private static final long serialVersionUID = 1L;
40 @NbBundle.Messages({
"DataContentDynamicMenu.mainContentViewer.name=Main",
41 "DataContentDynamicMenu.contentViewers.text=Content Viewers"})
43 public JComponent[] getMenuPresenters() {
44 JMenu submenu =
new JMenu(Bundle.DataContentDynamicMenu_contentViewers_text());
50 JMenuItem defaultItem =
new JMenuItem(Bundle.DataContentDynamicMenu_mainContentViewer_name());
51 defaultItem.addActionListener(
new OpenTopComponentAction(contentWin));
54 defaultItem.setEnabled(currentCase.
hasData());
56 defaultItem.setEnabled(
false);
58 submenu.add(defaultItem);
60 if (!newWindowLists.isEmpty()) {
61 for (
int i = 0; i < newWindowLists.size(); i++) {
63 JMenuItem item =
new JMenuItem(dctc.getName());
64 item.addActionListener(
new OpenTopComponentAction(dctc));
70 submenu.setEnabled(submenu.getItemCount() > 0);
71 JComponent[] comps =
new JComponent[1];
77 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
78 return getMenuPresenters();
82 public boolean isEnabled() {
static synchronized DataContentTopComponent findInstance()
static List< DataContentTopComponent > getNewWindowList()
static Case getCurrentCaseThrows()
static boolean isCaseOpen()