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;
|
package org.sleuthkit.autopsy.ingest;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
import org.openide.awt.DynamicMenuContent;
|
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
|
* 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
|
@Override
|
||||||
public JComponent[] getMenuPresenters() {
|
public JComponent[] getMenuPresenters() {
|
||||||
int length = 2;
|
List<Image> images = new ArrayList<>();
|
||||||
JComponent[] comps = new JComponent[length + 2]; // + 2 for separator and clear menu
|
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
|
// if it has the recent menus, add them to the component list
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < images.size(); i++) {
|
||||||
String action = "action " + i;
|
String action = images.get(i).getName();
|
||||||
JMenuItem menuItem = new JMenuItem(action);
|
JMenuItem menuItem = new JMenuItem(action);
|
||||||
menuItem.setActionCommand(action.toUpperCase());
|
menuItem.setActionCommand(action.toUpperCase());
|
||||||
comps[i] = menuItem;
|
comps[i] = menuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it has recent case, create clear menu
|
// if (true) {
|
||||||
if (true) {
|
// comps[images.size()] = new JSeparator();
|
||||||
comps[length] = new JSeparator();
|
// JMenuItem clearMenu = new JMenuItem("unclear");
|
||||||
JMenuItem clearMenu = new JMenuItem("unclear");
|
// comps[images.size() + 1] = clearMenu;
|
||||||
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);
|
|
||||||
}
|
|
||||||
return comps;
|
return comps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user