only show the message once

This commit is contained in:
Karl Mortensen 2015-06-24 15:50:10 -04:00
parent 641e33cf51
commit cd7e9f6513

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013-2015 Basis Technology Corp. * Copyright 2013-2014 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -35,6 +35,7 @@ import org.openide.nodes.Node;
import org.openide.nodes.Sheet; import org.openide.nodes.Sheet;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups; import org.openide.util.lookup.Lookups;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
@ -151,6 +152,7 @@ public class DeletedContent implements AutopsyVisitableItem {
private SleuthkitCase skCase; private SleuthkitCase skCase;
private Observable notifier; private Observable notifier;
private static boolean maxFilesDialogShown = false;
public DeletedContentsChildren(SleuthkitCase skCase) { public DeletedContentsChildren(SleuthkitCase skCase) {
this.skCase = skCase; this.skCase = skCase;
@ -180,45 +182,22 @@ public class DeletedContent implements AutopsyVisitableItem {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
String eventType = evt.getPropertyName(); String eventType = evt.getPropertyName();
// new file was added
if (eventType.equals(IngestManager.IngestModuleEvent.CONTENT_CHANGED.toString())) { if (eventType.equals(IngestManager.IngestModuleEvent.CONTENT_CHANGED.toString())) {
/** // @@@ COULD CHECK If the new file is deleted before notifying...
* Checking for a current case is a stop gap measure update();
* until a different way of handling the closing of
* cases is worked out. Currently, remote events may be
* received for a case that is already closed.
*/
try {
Case.getCurrentCase();
// new file was added
// @@@ COULD CHECK If the new file is deleted before notifying...
update();
} catch (IllegalStateException notUsed) {
/**
* Case is closed, do nothing.
*/
}
} else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) } else if (eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString())
|| eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString()) || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())) {
|| eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { update();
/** } else if (eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) {
* Checking for a current case is a stop gap measure update();
* until a different way of handling the closing of
* cases is worked out. Currently, remote events may be
* received for a case that is already closed.
*/
try {
Case.getCurrentCase();
update();
} catch (IllegalStateException notUsed) {
/**
* Case is closed, do nothing.
*/
}
} else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) { } else if (eventType.equals(Case.Events.CURRENT_CASE.toString())) {
// case was closed. Remove listeners so that we don't get called with a stale case handle // case was closed. Remove listeners so that we don't get called with a stale case handle
if (evt.getNewValue() == null) { if (evt.getNewValue() == null) {
removeListeners(); removeListeners();
} }
maxFilesDialogShown = false;
} }
} }
}; };
@ -357,14 +336,19 @@ public class DeletedContent implements AutopsyVisitableItem {
List<AbstractFile> queryList = runFsQuery(); List<AbstractFile> queryList = runFsQuery();
if (queryList.size() == MAX_OBJECTS) { if (queryList.size() == MAX_OBJECTS) {
queryList.remove(queryList.size() - 1); queryList.remove(queryList.size() - 1);
SwingUtilities.invokeLater(new Runnable() {
@Override // only show the dialog once
public void run() { if (maxFilesDialogShown == false) {
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), maxFilesDialogShown = true;
"DeletedContent.createKeys.maxObjects.msg", SwingUtilities.invokeLater(new Runnable() {
MAX_OBJECTS - 1)); @Override
} public void run() {
}); JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(),
"DeletedContent.createKeys.maxObjects.msg",
MAX_OBJECTS - 1));
}
});
}
} }
list.addAll(queryList); list.addAll(queryList);
return true; return true;