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;
39 final class RunIngestSubMenu
extends JMenuItem implements DynamicMenuContent {
41 private static final Logger logger = Logger.getLogger(RunIngestSubMenu.class.getName());
51 public JComponent[] getMenuPresenters() {
52 List<Content> dataSources =
new ArrayList<>();
55 dataSources = Case.getCurrentCaseThrows().getDataSources();
56 }
catch (IllegalStateException | NoCurrentCaseException ex) {
59 }
catch (TskCoreException e) {
60 System.out.println(
"Exception getting images: " + e.getMessage());
62 JComponent[] comps =
new JComponent[dataSources.size()];
65 for (
int i = 0; i < dataSources.size(); i++) {
66 String action = dataSources.get(i).getName();
67 JMenuItem menuItem =
new JMenuItem(action);
68 menuItem.setActionCommand(action.toUpperCase());
69 menuItem.addActionListener(
new RunIngestModulesAction(Collections.<Content>singletonList(dataSources.get(i))));
73 if (dataSources.isEmpty()) {
80 private JComponent[] getEmpty() {
81 JComponent[] comps =
new JComponent[1];
82 JMenuItem emptyMenu =
new JMenuItem(NbBundle.getMessage(RunIngestSubMenu.class,
"RunIngestSubMenu.menuItem.empty"));
84 comps[0].setEnabled(
false);
99 public JComponent[] synchMenuPresenters(JComponent[] jcs) {
100 return getMenuPresenters();