19 package org.sleuthkit.autopsy.menuactions;
21 import java.util.Collection;
22 import javax.swing.JComponent;
23 import javax.swing.JMenuItem;
24 import org.openide.awt.DynamicMenuContent;
25 import org.openide.util.Lookup;
26 import org.openide.windows.TopComponent;
36 class DataExplorerDynamicMenu
extends JMenuItem implements DynamicMenuContent {
38 DataExplorerDynamicMenu() {
42 public JComponent[] getMenuPresenters() {
43 Collection<? extends DataExplorer> dataExplorers = Lookup.getDefault().lookupAll(DataExplorer.class);
45 int totalItem = dataExplorers.size();
46 JComponent[] comps =
new JComponent[totalItem];
49 for (DataExplorer dx : dataExplorers) {
50 if (!dx.hasMenuOpenAction()) {
54 JMenuItem item =
new JMenuItem(explorerWin.getName());
55 item.addActionListener(
new OpenTopComponentAction(explorerWin));
58 Case currentCase = Case.getCurrentCaseThrows();
59 item.setEnabled(currentCase.hasData());
60 }
catch (NoCurrentCaseException ex) {
61 item.setEnabled(
false);
71 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
72 return getMenuPresenters();
TopComponent getTopComponent()