mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-08 06:09:32 +00:00
6781 fix use of invoke later
This commit is contained in:
parent
4950e0e165
commit
59df1bb378
@ -63,10 +63,9 @@ class ArtifactsWorker extends SwingWorker<List<BlackboardArtifact>, Void> {
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
List<BlackboardArtifact> listOfArtifacts = new ArrayList<>();
|
||||
if (!isCancelled()) {
|
||||
try {
|
||||
listOfArtifacts.addAll(get());
|
||||
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ArtifactSearchResultEvent(artifactType, get()));
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.log(Level.SEVERE, "Exception while trying to get list of artifacts for Domain details for artifact type: "
|
||||
+ artifactType.getDisplayName() + " and domain: " + domain, ex);
|
||||
@ -74,7 +73,5 @@ class ArtifactsWorker extends SwingWorker<List<BlackboardArtifact>, Void> {
|
||||
//Worker was cancelled after previously finishing its background work, exception ignored to cut down on non-helpful logging
|
||||
}
|
||||
}
|
||||
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ArtifactSearchResultEvent(artifactType, listOfArtifacts));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -118,10 +118,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
if (event.getStateChange() == ItemEvent.SELECTED) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getSelectedFilterPanel().setLastGroupingAttributeType(groupByCombobox.getItemAt(groupByCombobox.getSelectedIndex()));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -129,9 +126,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
if (event.getStateChange() == ItemEvent.SELECTED) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getSelectedFilterPanel().setLastSortingMethod(orderByCombobox.getItemAt(orderByCombobox.getSelectedIndex()));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -139,9 +134,7 @@ final class DiscoveryDialog extends javax.swing.JDialog {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
if (event.getStateChange() == ItemEvent.SELECTED) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getSelectedFilterPanel().setLastGroupSortingAlg(groupSortingComboBox.getItemAt(groupSortingComboBox.getSelectedIndex()));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -125,25 +125,25 @@ final class DomainArtifactsTabPanel extends JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handleArtifactSearchResultEvent(DiscoveryEventUtils.ArtifactSearchResultEvent artifactresultEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (artifactType == artifactresultEvent.getArtifactType()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
listPanel.removeListSelectionListener(listener);
|
||||
listPanel.addArtifacts(artifactresultEvent.getListOfArtifacts());
|
||||
status = ArtifactRetrievalStatus.POPULATED;
|
||||
setEnabled(!listPanel.isEmpty());
|
||||
listPanel.addSelectionListener(listener);
|
||||
listPanel.selectFirst();
|
||||
revalidate();
|
||||
repaint();
|
||||
try {
|
||||
DiscoveryEventUtils.getDiscoveryEventBus().unregister(this);
|
||||
} catch (IllegalArgumentException notRegistered) {
|
||||
logger.log(Level.INFO, "Attempting to unregister tab which was not registered");
|
||||
// attempting to remove a tab that was never registered
|
||||
}
|
||||
status = ArtifactRetrievalStatus.POPULATED;
|
||||
setEnabled(!listPanel.isEmpty());
|
||||
validate();
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of Artifact the panel exists for.
|
||||
|
@ -96,8 +96,8 @@ final class DomainDetailsPanel extends JPanel {
|
||||
* Run the worker which retrieves the list of artifacts for the domain to
|
||||
* populate the details area.
|
||||
*/
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
|
||||
private void runDomainWorker() {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
Component selectedComponent = jTabbedPane1.getSelectedComponent();
|
||||
if (selectedComponent instanceof DomainArtifactsTabPanel) {
|
||||
if (detailsWorker != null && !detailsWorker.isDone()) {
|
||||
@ -105,13 +105,12 @@ final class DomainDetailsPanel extends JPanel {
|
||||
}
|
||||
DomainArtifactsTabPanel selectedTab = (DomainArtifactsTabPanel) selectedComponent;
|
||||
if (selectedTab.getStatus() == DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED) {
|
||||
selectedTab.setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATING);
|
||||
DiscoveryEventUtils.getDiscoveryEventBus().register(selectedTab);
|
||||
selectedTab.setStatus(DomainArtifactsTabPanel.ArtifactRetrievalStatus.POPULATING);
|
||||
detailsWorker = new ArtifactsWorker(selectedTab.getArtifactType(), domain);
|
||||
detailsWorker.execute();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,8 +121,8 @@ final class DomainDetailsPanel extends JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handlePopulateDomainTabsEvent(DiscoveryEventUtils.PopulateDomainTabsEvent populateEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
domain = populateEvent.getDomain();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
resetTabsStatus();
|
||||
selectTab();
|
||||
runDomainWorker();
|
||||
|
@ -70,7 +70,6 @@ final class FileDetailsPanel extends javax.swing.JPanel {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
instancesList.setSelectedIndex(instancesList.locationToIndex(e.getPoint()));
|
||||
Set<AbstractFile> files = new HashSet<>();
|
||||
files.add(instancesList.getSelectedValue());
|
||||
@ -83,7 +82,6 @@ final class FileDetailsPanel extends javax.swing.JPanel {
|
||||
menu.add(DeleteFileContentTagAction.getInstance().getMenuForFiles(files));
|
||||
menu.add(AddContentToHashDbAction.getInstance().getMenuForFiles(files));
|
||||
menu.show(instancesList, e.getPoint().x, e.getPoint().y);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -91,14 +89,12 @@ final class FileDetailsPanel extends javax.swing.JPanel {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (!e.getValueIsAdjusting()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
AbstractFile file = getSelectedFile();
|
||||
if (file != null) {
|
||||
dataContentPanel.setNode(new TableFilterNode(new FileNode(file), false));
|
||||
} else {
|
||||
dataContentPanel.setNode(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -127,8 +123,8 @@ final class FileDetailsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handlePopulateInstancesListEvent(DiscoveryEventUtils.PopulateInstancesListEvent populateEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
List<AbstractFile> files = populateEvent.getInstances();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (files.isEmpty()) {
|
||||
//if there are no files currently remove the current items without removing listener to cause content viewer to reset
|
||||
instancesListModel.removeAllElements();
|
||||
|
@ -69,10 +69,8 @@ final class GroupListPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
type = searchStartedEvent.getType();
|
||||
groupKeyList.setListData(new GroupKey[0]);
|
||||
});
|
||||
}
|
||||
|
||||
@Messages({"GroupsListPanel.noFileResults.message.text=No files were found for the selected filters.\n\n"
|
||||
@ -94,7 +92,6 @@ final class GroupListPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
groupMap = searchCompleteEvent.getGroupMap();
|
||||
searchfilters = searchCompleteEvent.getFilters();
|
||||
groupingAttribute = searchCompleteEvent.getGroupingAttr();
|
||||
@ -117,7 +114,6 @@ final class GroupListPanel extends javax.swing.JPanel {
|
||||
}
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,12 +182,12 @@ final class ResultsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handlePageRetrievedEvent(DiscoveryEventUtils.PageRetrievedEvent pageRetrievedEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
//send populateMesage
|
||||
if (pageRetrievedEvent.getType() != DOMAIN) {
|
||||
DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
|
||||
}
|
||||
currentPage = pageRetrievedEvent.getPageNumber();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
updateControls();
|
||||
resetResultViewer();
|
||||
if (null != pageRetrievedEvent.getType()) {
|
||||
@ -214,20 +214,17 @@ final class ResultsPanel extends javax.swing.JPanel {
|
||||
}
|
||||
resultsViewerPanel.revalidate();
|
||||
resultsViewerPanel.repaint();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
void handleCancelBackgroundTasksEvent(DiscoveryEventUtils.CancelBackgroundTasksEvent cancelEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
for (SwingWorker<Void, Void> thumbWorker : resultContentWorkers) {
|
||||
if (!thumbWorker.isDone()) {
|
||||
thumbWorker.cancel(true);
|
||||
}
|
||||
}
|
||||
resultContentWorkers.clear();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,7 +333,6 @@ final class ResultsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handleGroupSelectedEvent(DiscoveryEventUtils.GroupSelectedEvent groupSelectedEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
searchFilters = groupSelectedEvent.getFilters();
|
||||
groupingAttribute = groupSelectedEvent.getGroupingAttr();
|
||||
groupSort = groupSelectedEvent.getGroupSort();
|
||||
@ -344,6 +340,7 @@ final class ResultsPanel extends javax.swing.JPanel {
|
||||
selectedGroupKey = groupSelectedEvent.getGroupKey();
|
||||
resultType = groupSelectedEvent.getResultType();
|
||||
groupSize = groupSelectedEvent.getGroupSize();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
resetResultViewer();
|
||||
setPage(0);
|
||||
});
|
||||
@ -357,9 +354,9 @@ final class ResultsPanel extends javax.swing.JPanel {
|
||||
*/
|
||||
@Subscribe
|
||||
void handleNoResultsEvent(DiscoveryEventUtils.NoResultsEvent noResultsEvent) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
groupSize = 0;
|
||||
currentPage = 0;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
updateControls();
|
||||
videoThumbnailViewer.clearViewer();
|
||||
imageThumbnailViewer.clearViewer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user