19 package org.sleuthkit.autopsy.ingest;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25 import javax.swing.JComponent;
26 import javax.swing.JMenuItem;
27 import org.openide.awt.DynamicMenuContent;
28 import org.openide.util.NbBundle;
38 final class RunIngestSubMenu
extends JMenuItem implements DynamicMenuContent {
48 public JComponent[] getMenuPresenters() {
49 List<Content> dataSources =
new ArrayList<>();
52 dataSources = Case.getOpenCase().getDataSources();
53 }
catch (IllegalStateException ex) {
56 }
catch (TskCoreException | NoCurrentCaseException e) {
57 System.out.println(
"Exception getting images: " + e.getMessage());
59 JComponent[] comps =
new JComponent[dataSources.size()];
62 for (
int i = 0; i < dataSources.size(); i++) {
63 String action = dataSources.get(i).getName();
64 JMenuItem menuItem =
new JMenuItem(action);
65 menuItem.setActionCommand(action.toUpperCase());
66 menuItem.addActionListener(
new RunIngestModulesAction(Collections.<Content>singletonList(dataSources.get(i))));
70 if (dataSources.isEmpty()) {
77 private JComponent[] getEmpty() {
78 JComponent[] comps =
new JComponent[1];
79 JMenuItem emptyMenu =
new JMenuItem(NbBundle.getMessage(RunIngestSubMenu.class,
"RunIngestSubMenu.menuItem.empty"));
81 comps[0].setEnabled(
false);
96 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
97 return getMenuPresenters();