19 package org.sleuthkit.autopsy.menuactions;
21 import java.util.ArrayList;
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.NbBundle;
34 class SearchResultMenu
extends JMenuItem implements DynamicMenuContent {
36 private static final long serialVersionUID = 1L;
38 @NbBundle.Messages({
"SearchResultMenu.resultViewers.text=Result Viewers"})
40 public JComponent[] getMenuPresenters() {
41 JMenu submenu =
new JMenu(Bundle.SearchResultMenu_resultViewers_text());
43 if (Case.isCaseOpen()) {
45 if (!dataResultsIds.isEmpty()) {
46 for (String resultTabId : dataResultsIds) {
47 JMenuItem item =
new JMenuItem(resultTabId);
48 item.addActionListener(
new OpenTopComponentAction(resultTabId));
53 submenu.setEnabled(!dataResultsIds.isEmpty());
54 List<JComponent> menuItems =
new ArrayList<>();
55 menuItems.add(submenu);
56 return menuItems.toArray(
new JComponent[menuItems.size()]);
60 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
61 return getMenuPresenters();
65 public boolean isEnabled() {
66 return Case.isCaseOpen();
static List< String > getActiveComponentIds()