mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
prevent progressdialog from blocking input to the main timeline window
This commit is contained in:
parent
5f4b2f2b54
commit
843fefac25
@ -88,6 +88,7 @@ public class PromptDialogManager {
|
|||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
public void showProgressDialog(CancellationProgressTask<?> task) {
|
public void showProgressDialog(CancellationProgressTask<?> task) {
|
||||||
currentDialog = new ProgressDialog(task);
|
currentDialog = new ProgressDialog(task);
|
||||||
|
currentDialog.initModality(Modality.NONE);
|
||||||
currentDialog.headerTextProperty().bind(task.titleProperty());
|
currentDialog.headerTextProperty().bind(task.titleProperty());
|
||||||
setDialogIcons(currentDialog);
|
setDialogIcons(currentDialog);
|
||||||
currentDialog.setTitle(Bundle.PromptDialogManager_progressDialog_title());
|
currentDialog.setTitle(Bundle.PromptDialogManager_progressDialog_title());
|
||||||
@ -98,6 +99,7 @@ public class PromptDialogManager {
|
|||||||
//co-ordinate task cancelation and dialog hiding.
|
//co-ordinate task cancelation and dialog hiding.
|
||||||
task.setOnCancelled(cancelled -> currentDialog.close());
|
task.setOnCancelled(cancelled -> currentDialog.close());
|
||||||
task.setOnSucceeded(succeeded -> currentDialog.close());
|
task.setOnSucceeded(succeeded -> currentDialog.close());
|
||||||
|
task.setOnFailed(failed -> currentDialog.close());
|
||||||
dialogPane.getButtonTypes().setAll(ButtonType.CANCEL);
|
dialogPane.getButtonTypes().setAll(ButtonType.CANCEL);
|
||||||
final Node cancelButton = dialogPane.lookupButton(ButtonType.CANCEL);
|
final Node cancelButton = dialogPane.lookupButton(ButtonType.CANCEL);
|
||||||
cancelButton.disableProperty().bind(task.cancellableProperty().not());
|
cancelButton.disableProperty().bind(task.cancellableProperty().not());
|
||||||
|
@ -30,6 +30,8 @@ import java.util.TimeZone;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.Observable;
|
import javafx.beans.Observable;
|
||||||
@ -288,26 +290,17 @@ public class TimeLineController {
|
|||||||
advance(filteredEvents.zoomParametersProperty().get().withTimeRange(boundingEventsInterval));
|
advance(filteredEvents.zoomParametersProperty().get().withTimeRange(boundingEventsInterval));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* rebuld the repo.
|
|
||||||
*
|
|
||||||
* @return False if the repo was not rebuilt because because the user
|
|
||||||
* aborted after prompt about ingest running. True if the repo was
|
|
||||||
* rebuilt.
|
|
||||||
*/
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
void rebuildRepo() {
|
private void rebuildRepoHelper(Function<Consumer<Worker.State>, CancellationProgressTask<?>> repoBuilder) {
|
||||||
SwingUtilities.invokeLater(this::closeTimelineWindow);
|
SwingUtilities.invokeLater(this::closeTimelineWindow);
|
||||||
final CancellationProgressTask<?> rebuildRepository = eventsRepository.rebuildRepository();
|
|
||||||
boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
|
boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
|
||||||
rebuildRepository.stateProperty().addListener((stateProperty, oldState, newSate) -> {
|
final CancellationProgressTask<?> rebuildRepository = repoBuilder.apply(newSate -> {
|
||||||
//this will be on JFX thread
|
|
||||||
setIngestRunning(ingestRunning);
|
setIngestRunning(ingestRunning);
|
||||||
|
//this will be on JFX thread
|
||||||
switch (newSate) {
|
switch (newSate) {
|
||||||
case SUCCEEDED:
|
case SUCCEEDED:
|
||||||
setEventsDBStale(false);
|
setEventsDBStale(false);
|
||||||
SwingUtilities.invokeLater(TimeLineController.this::showWindow);
|
SwingUtilities.invokeLater(TimeLineController.this::showWindow);
|
||||||
|
|
||||||
historyManager.reset(filteredEvents.zoomParametersProperty().get());
|
historyManager.reset(filteredEvents.zoomParametersProperty().get());
|
||||||
TimeLineController.this.showFullRange();
|
TimeLineController.this.showFullRange();
|
||||||
break;
|
break;
|
||||||
@ -318,7 +311,18 @@ public class TimeLineController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
promptDialogManager.showProgressDialog(rebuildRepository);
|
promptDialogManager.showProgressDialog(rebuildRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rebuld the repo.
|
||||||
|
*
|
||||||
|
* @return False if the repo was not rebuilt because because the user
|
||||||
|
* aborted after prompt about ingest running. True if the repo was
|
||||||
|
* rebuilt.
|
||||||
|
*/
|
||||||
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
|
void rebuildRepo() {
|
||||||
|
rebuildRepoHelper(eventsRepository::rebuildRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -329,17 +333,7 @@ public class TimeLineController {
|
|||||||
*/
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
void rebuildTagsTable() {
|
void rebuildTagsTable() {
|
||||||
|
rebuildRepoHelper(eventsRepository::rebuildTags);
|
||||||
SwingUtilities.invokeLater(this::closeTimelineWindow);
|
|
||||||
CancellationProgressTask<?> rebuildTags = eventsRepository.rebuildTags();
|
|
||||||
rebuildTags.stateProperty().addListener((stateProperty, oldState, newSate) -> {
|
|
||||||
//this will be on JFX thread
|
|
||||||
if (newSate == Worker.State.SUCCEEDED) {
|
|
||||||
SwingUtilities.invokeLater(TimeLineController.this::showWindow);
|
|
||||||
showFullRange();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
promptDialogManager.showProgressDialog(rebuildTags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
||||||
|
@ -35,6 +35,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@ -44,6 +45,7 @@ import javafx.beans.property.ReadOnlyObjectProperty;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.collections.ObservableMap;
|
import javafx.collections.ObservableMap;
|
||||||
|
import javafx.concurrent.Worker;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
@ -177,7 +179,6 @@ public class EventsRepository {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public TimeLineEvent getEventById(Long eventID) {
|
public TimeLineEvent getEventById(Long eventID) {
|
||||||
return idToEventCache.getUnchecked(eventID);
|
return idToEventCache.getUnchecked(eventID);
|
||||||
}
|
}
|
||||||
@ -310,8 +311,6 @@ public class EventsRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean areFiltersEquivalent(RootFilter f1, RootFilter f2) {
|
public boolean areFiltersEquivalent(RootFilter f1, RootFilter f2) {
|
||||||
return SQLHelper.getSQLWhere(f1).equals(SQLHelper.getSQLWhere(f2));
|
return SQLHelper.getSQLWhere(f1).equals(SQLHelper.getSQLWhere(f2));
|
||||||
}
|
}
|
||||||
@ -322,13 +321,13 @@ public class EventsRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
public CancellationProgressTask<Void> rebuildRepository() {
|
public CancellationProgressTask<Void> rebuildRepository(Consumer<Worker.State> onStateChange) {
|
||||||
return rebuildRepository(DBPopulationMode.FULL);
|
return rebuildRepository(DBPopulationMode.FULL, onStateChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
public CancellationProgressTask<Void> rebuildTags() {
|
public CancellationProgressTask<Void> rebuildTags(Consumer<Worker.State> onStateChange) {
|
||||||
return rebuildRepository(DBPopulationMode.TAGS_ONLY);
|
return rebuildRepository(DBPopulationMode.TAGS_ONLY, onStateChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -336,12 +335,12 @@ public class EventsRepository {
|
|||||||
* @param mode the value of mode
|
* @param mode the value of mode
|
||||||
*/
|
*/
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||||
private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode) {
|
private CancellationProgressTask<Void> rebuildRepository(final DBPopulationMode mode, Consumer<Worker.State> onStateChange) {
|
||||||
LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS
|
LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS
|
||||||
if (dbWorker != null) {
|
if (dbWorker != null) {
|
||||||
dbWorker.cancel();
|
dbWorker.cancel();
|
||||||
}
|
}
|
||||||
dbWorker = new DBPopulationWorker(mode);
|
dbWorker = new DBPopulationWorker(mode, onStateChange);
|
||||||
workerExecutor.execute(dbWorker);
|
workerExecutor.execute(dbWorker);
|
||||||
return dbWorker;
|
return dbWorker;
|
||||||
}
|
}
|
||||||
@ -406,10 +405,11 @@ public class EventsRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBPopulationWorker(DBPopulationMode mode) {
|
DBPopulationWorker(DBPopulationMode mode, Consumer<Worker.State> onStateChange) {
|
||||||
skCase = autoCase.getSleuthkitCase();
|
skCase = autoCase.getSleuthkitCase();
|
||||||
tagsManager = autoCase.getServices().getTagsManager();
|
tagsManager = autoCase.getServices().getTagsManager();
|
||||||
this.dbPopulationMode = mode;
|
this.dbPopulationMode = mode;
|
||||||
|
this.stateProperty().addListener(observable -> onStateChange.accept(getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void restartProgressHandle(String title, String message, Double workDone, double total, Boolean cancellable) {
|
void restartProgressHandle(String title, String message, Double workDone, double total, Boolean cancellable) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user