mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
listing open images
This commit is contained in:
parent
660763b19d
commit
eb2cb472ca
@ -18,10 +18,16 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.ingest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JSeparator;
|
||||
import org.openide.awt.DynamicMenuContent;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* This class is used to populate the list of open images to run ingest on them
|
||||
@ -30,29 +36,39 @@ class UpdateIngestImages extends JMenuItem implements DynamicMenuContent {
|
||||
|
||||
@Override
|
||||
public JComponent[] getMenuPresenters() {
|
||||
int length = 2;
|
||||
JComponent[] comps = new JComponent[length + 2]; // + 2 for separator and clear menu
|
||||
List<Image> images = new ArrayList<>();
|
||||
JComponent[] comps = new JComponent[1];
|
||||
SleuthkitCase sk = null;
|
||||
try {
|
||||
sk = Case.getCurrentCase().getSleuthkitCase();
|
||||
} catch (IllegalStateException ex) {
|
||||
// create a disabled empty menu
|
||||
comps = new JComponent[1];
|
||||
JMenuItem emptyMenu = new JMenuItem("unempty");
|
||||
comps[0] = emptyMenu;
|
||||
comps[0].setEnabled(false);
|
||||
return comps;
|
||||
}
|
||||
try {
|
||||
images = sk.getImages();
|
||||
} catch (TskCoreException e) {
|
||||
System.out.println("Exception getting images: " + e.getMessage());
|
||||
}
|
||||
comps = new JComponent[images.size()]; // + 2 for separator and clear menu
|
||||
|
||||
// if it has the recent menus, add them to the component list
|
||||
for (int i = 0; i < length; i++) {
|
||||
String action = "action " + i;
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
String action = images.get(i).getName();
|
||||
JMenuItem menuItem = new JMenuItem(action);
|
||||
menuItem.setActionCommand(action.toUpperCase());
|
||||
comps[i] = menuItem;
|
||||
}
|
||||
|
||||
// if it has recent case, create clear menu
|
||||
if (true) {
|
||||
comps[length] = new JSeparator();
|
||||
JMenuItem clearMenu = new JMenuItem("unclear");
|
||||
comps[length + 1] = clearMenu;
|
||||
} // otherwise, just create a disabled empty menu
|
||||
else {
|
||||
comps = new JComponent[1];
|
||||
JMenuItem emptyMenu = new JMenuItem("unempty");
|
||||
comps[0] = emptyMenu;
|
||||
comps[0].setEnabled(false);
|
||||
}
|
||||
// if (true) {
|
||||
// comps[images.size()] = new JSeparator();
|
||||
// JMenuItem clearMenu = new JMenuItem("unclear");
|
||||
// comps[images.size() + 1] = clearMenu;
|
||||
// }
|
||||
return comps;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user