Skip to content
Snippets Groups Projects
Commit 8d28696b authored by APriestman's avatar APriestman
Browse files

ImageAnlyzer bug fixes related to case closing.

parent ee77b930
Branches
Tags
No related merge requests found
...@@ -190,7 +190,9 @@ private ImageAnalyzerController() { ...@@ -190,7 +190,9 @@ private ImageAnalyzerController() {
}); });
groupManager.getAnalyzedGroups().addListener((Observable o) -> { groupManager.getAnalyzedGroups().addListener((Observable o) -> {
checkForGroups(); if(Case.isCaseOpen()){
checkForGroups();
}
}); });
groupManager.getUnSeenGroups().addListener((Observable observable) -> { groupManager.getUnSeenGroups().addListener((Observable observable) -> {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
import org.openide.windows.Mode; import org.openide.windows.Mode;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane; import org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane;
import org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane; import org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane;
...@@ -67,6 +68,7 @@ public final class ImageAnalyzerTopComponent extends TopComponent implements Exp ...@@ -67,6 +68,7 @@ public final class ImageAnalyzerTopComponent extends TopComponent implements Exp
public final static String PREFERRED_ID = "ImageAnalyzerTopComponent"; public final static String PREFERRED_ID = "ImageAnalyzerTopComponent";
private static final Logger LOGGER = Logger.getLogger(ImageAnalyzerTopComponent.class.getName()); private static final Logger LOGGER = Logger.getLogger(ImageAnalyzerTopComponent.class.getName());
private static boolean topComponentInitialized = false;
public static void openTopComponent() { public static void openTopComponent() {
//TODO:eventually move to this model, throwing away everything and rebuilding controller groupmanager etc for each case. //TODO:eventually move to this model, throwing away everything and rebuilding controller groupmanager etc for each case.
...@@ -79,6 +81,7 @@ public static void openTopComponent() { ...@@ -79,6 +81,7 @@ public static void openTopComponent() {
// timeLineController.openTimeLine(); // timeLineController.openTimeLine();
final ImageAnalyzerTopComponent tc = (ImageAnalyzerTopComponent) WindowManager.getDefault().findTopComponent("ImageAnalyzerTopComponent"); final ImageAnalyzerTopComponent tc = (ImageAnalyzerTopComponent) WindowManager.getDefault().findTopComponent("ImageAnalyzerTopComponent");
if (tc != null) { if (tc != null) {
topComponentInitialized = true;
WindowManager.getDefault().isTopComponentFloating(tc); WindowManager.getDefault().isTopComponentFloating(tc);
Mode mode = WindowManager.getDefault().findMode("timeline"); Mode mode = WindowManager.getDefault().findMode("timeline");
if (mode != null) { if (mode != null) {
...@@ -90,12 +93,14 @@ public static void openTopComponent() { ...@@ -90,12 +93,14 @@ public static void openTopComponent() {
} }
public static void closeTopComponent() { public static void closeTopComponent() {
final TopComponent etc = WindowManager.getDefault().findTopComponent("ImageAnalyzerTopComponent"); if(topComponentInitialized){
if (etc != null) { final TopComponent etc = WindowManager.getDefault().findTopComponent("ImageAnalyzerTopComponent");
try { if (etc != null) {
etc.close(); try {
} catch (Exception e) { etc.close();
LOGGER.log(Level.SEVERE, "failed to close ImageAnalyzerTopComponent", e); } catch (Exception e) {
LOGGER.log(Level.SEVERE, "failed to close ImageAnalyzerTopComponent", e);
}
} }
} }
} }
...@@ -128,7 +133,7 @@ public ImageAnalyzerTopComponent() { ...@@ -128,7 +133,7 @@ public ImageAnalyzerTopComponent() {
setName(Bundle.CTL_ImageAnalyzerTopComponent()); setName(Bundle.CTL_ImageAnalyzerTopComponent());
setToolTipText(Bundle.HINT_ImageAnalyzerTopComponent()); setToolTipText(Bundle.HINT_ImageAnalyzerTopComponent());
initComponents(); initComponents();
Platform.runLater(() -> {//initialize jfx ui Platform.runLater(() -> {//initialize jfx ui
......
...@@ -162,7 +162,11 @@ private Image generateAndSaveThumbnail(final DrawableFile<?> file) { ...@@ -162,7 +162,11 @@ private Image generateAndSaveThumbnail(final DrawableFile<?> file) {
try (InputStream inputStream = new BufferedInputStream(new ReadContentInputStream(file.getAbstractFile()))) { try (InputStream inputStream = new BufferedInputStream(new ReadContentInputStream(file.getAbstractFile()))) {
final Image thumbnail = new Image(inputStream, MAX_ICON_SIZE, MAX_ICON_SIZE, true, true); final Image thumbnail = new Image(inputStream, MAX_ICON_SIZE, MAX_ICON_SIZE, true, true);
if (thumbnail.isError()) { //if there was an error loading the image via JFX, fall back on Swing if (thumbnail.isError()) { //if there was an error loading the image via JFX, fall back on Swing
LOGGER.log(Level.WARNING, "problem loading image: " + file.getName() + " .", thumbnail.getException()); LOGGER.log(Level.WARNING, "problem loading thumbnail for image: " + file.getName() + " .");
// Doing it this way puts the whole stack trace in the console output, which is probably not
// needed. There are a significant number of cases where this is expected to fail (bitmaps,
// empty files, etc.)
//LOGGER.log(Level.WARNING, "problem loading image: " + file.getName() + " .", thumbnail.getException());
return fallbackToSwingImage(file); return fallbackToSwingImage(file);
} else { //if the load went successfully, save the thumbnail to disk on a background thread } else { //if the load went successfully, save the thumbnail to disk on a background thread
imageSaver.execute(() -> { imageSaver.execute(() -> {
......
...@@ -618,6 +618,11 @@ public void setSortOrder(SortOrder sortOrder) { ...@@ -618,6 +618,11 @@ public void setSortOrder(SortOrder sortOrder) {
* @param force true to force a full db query regroup * @param force true to force a full db query regroup
*/ */
public <A extends Comparable<A>> void regroup(final DrawableAttribute<A> groupBy, final GroupSortBy sortBy, final SortOrder sortOrder, Boolean force) { public <A extends Comparable<A>> void regroup(final DrawableAttribute<A> groupBy, final GroupSortBy sortBy, final SortOrder sortOrder, Boolean force) {
if(! Case.isCaseOpen()){
return;
}
//only re-query the db if the group by attribute changed or it is forced //only re-query the db if the group by attribute changed or it is forced
if (groupBy != getGroupBy() || force == true) { if (groupBy != getGroupBy() || force == true) {
setGroupBy(groupBy); setGroupBy(groupBy);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment