mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Moving event publishing off the EDT
This commit is contained in:
parent
b4ee3471eb
commit
b9db444e6d
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.actions;
|
||||
import java.util.Collection;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.Utilities;
|
||||
@ -61,21 +62,26 @@ public class AddBlackboardArtifactTagAction extends AddTagAction {
|
||||
|
||||
@Override
|
||||
protected void addTag(TagName tagName, String comment) {
|
||||
Collection<? extends BlackboardArtifact> selectedArtifacts = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class);
|
||||
for (BlackboardArtifact artifact : selectedArtifacts) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
|
||||
final Collection<? extends BlackboardArtifact> selectedArtifacts = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class);
|
||||
|
||||
new Thread(() -> {
|
||||
for (BlackboardArtifact artifact : selectedArtifacts) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddBlackboardArtifactTagAction.unableToTag.msg",
|
||||
artifact.getDisplayName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddBlackboardArtifactTagAction.taggingErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddBlackboardArtifactTagAction.unableToTag.msg",
|
||||
artifact.getDisplayName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddBlackboardArtifactTagAction.taggingErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.Utilities;
|
||||
@ -64,81 +65,98 @@ public class AddContentTagAction extends AddTagAction {
|
||||
|
||||
@Override
|
||||
protected void addTag(TagName tagName, String comment) {
|
||||
Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
|
||||
for (AbstractFile file : selectedFiles) {
|
||||
try {
|
||||
// Handle the special cases of current (".") and parent ("..") directory entries.
|
||||
if (file.getName().equals(".")) {
|
||||
Content parentFile = file.getParent();
|
||||
if (parentFile instanceof AbstractFile) {
|
||||
file = (AbstractFile)parentFile;
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFile.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (file.getName().equals("..")) {
|
||||
Content parentFile = file.getParent();
|
||||
if (parentFile instanceof AbstractFile) {
|
||||
parentFile = (AbstractFile)((AbstractFile)parentFile).getParent();
|
||||
final Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
|
||||
|
||||
new Thread(() -> {
|
||||
for (AbstractFile file : selectedFiles) {
|
||||
try {
|
||||
// Handle the special cases of current (".") and parent ("..") directory entries.
|
||||
if (file.getName().equals(".")) {
|
||||
Content parentFile = file.getParent();
|
||||
if (parentFile instanceof AbstractFile) {
|
||||
file = (AbstractFile)parentFile;
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFile.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFile.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (file.getName().equals("..")) {
|
||||
Content parentFile = file.getParent();
|
||||
if (parentFile instanceof AbstractFile) {
|
||||
parentFile = (AbstractFile)((AbstractFile)parentFile).getParent();
|
||||
if (parentFile instanceof AbstractFile) {
|
||||
file = (AbstractFile)parentFile;
|
||||
}
|
||||
else {
|
||||
final Content parentFileCopy = parentFile;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFileCopy.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
final Content parentFileCopy = parentFile;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFileCopy.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// check if the same tag is being added for the same abstract file.
|
||||
TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
|
||||
List<ContentTag> contentTagList = tagsManager.getContentTagsByContent(file);
|
||||
for (ContentTag contentTag : contentTagList) {
|
||||
if (contentTag.getName().getDisplayName().equals(tagName.getDisplayName())) {
|
||||
AbstractFile fileCopy = file;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.tagExists",
|
||||
fileCopy.getName(), tagName.getDisplayName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
tagsManager.addContentTag(file, tagName, comment);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
AbstractFile fileCopy = file;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg",
|
||||
parentFile.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
continue;
|
||||
}
|
||||
"AddContentTagAction.unableToTag.msg2",
|
||||
fileCopy.getName()),
|
||||
NbBundle.getMessage(this.getClass(), "AddContentTagAction.taggingErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
});
|
||||
}
|
||||
// check if the same tag is being added for the same abstract file.
|
||||
TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
|
||||
List<ContentTag> contentTagList = tagsManager.getContentTagsByContent(file);
|
||||
for (ContentTag contentTag : contentTagList) {
|
||||
if (contentTag.getName().getDisplayName().equals(tagName.getDisplayName())) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.tagExists",
|
||||
file.getName(), tagName.getDisplayName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.cannotApplyTagErr"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
tagsManager.addContentTag(file, tagName, comment);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg2",
|
||||
file.getName()),
|
||||
NbBundle.getMessage(this.getClass(), "AddContentTagAction.taggingErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.Utilities;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ -55,22 +56,26 @@ public class DeleteBlackboardArtifactTagAction extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Collection<? extends BlackboardArtifactTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class);
|
||||
for (BlackboardArtifactTag tag : selectedTags) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag);
|
||||
final Collection<? extends BlackboardArtifactTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifactTag.class);
|
||||
new Thread(() -> {
|
||||
for (BlackboardArtifactTag tag : selectedTags) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
|
||||
tag.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteBlackboardArtifactTagAction.tagDelErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
|
||||
tag.getName()),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteBlackboardArtifactTagAction.tagDelErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.Utilities;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ -55,20 +56,24 @@ public class DeleteContentTagAction extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Collection<? extends ContentTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class);
|
||||
for (ContentTag tag : selectedTags) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(tag);
|
||||
final Collection<? extends ContentTag> selectedTags = Utilities.actionsGlobalContext().lookupAll(ContentTag.class);
|
||||
new Thread(() -> {
|
||||
for (ContentTag tag : selectedTags) {
|
||||
try {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(tag);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteContentTagAction.unableToDelTag.msg",
|
||||
tag.getName()),
|
||||
NbBundle.getMessage(this.getClass(), "DeleteContentTagAction.tagDelErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteContentTagAction.unableToDelTag.msg",
|
||||
tag.getName()),
|
||||
NbBundle.getMessage(this.getClass(), "DeleteContentTagAction.tagDelErr"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,9 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
|
||||
// get the selected DSProcessor
|
||||
dsProcessor = dataSourcePanel.getComponent().getCurrentDSProcessor();
|
||||
|
||||
Case.getCurrentCase().notifyAddingNewDataSource(dataSourceId);
|
||||
new Thread(() -> {
|
||||
Case.getCurrentCase().notifyAddingNewDataSource(dataSourceId);
|
||||
}).start();
|
||||
DataSourceProcessorCallback cbObj = new DataSourceProcessorCallback () {
|
||||
@Override
|
||||
public void doneEDT(DataSourceProcessorCallback.DataSourceProcessorResult result, List<String> errList, List<Content> contents) {
|
||||
@ -258,8 +260,10 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
|
||||
* Cancels the data source processing - in case the users presses 'Cancel'
|
||||
*/
|
||||
private void cancelDataSourceProcessing(UUID dataSourceId) {
|
||||
Case.getCurrentCase().notifyFailedAddingNewDataSource(dataSourceId);
|
||||
dsProcessor.cancel();
|
||||
new Thread(() -> {
|
||||
Case.getCurrentCase().notifyFailedAddingNewDataSource(dataSourceId);
|
||||
}).start();
|
||||
dsProcessor.cancel();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -307,11 +311,13 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel<WizardDe
|
||||
newContents.addAll(contents);
|
||||
|
||||
//notify the UI of the new content added to the case
|
||||
if (!newContents.isEmpty()) {
|
||||
Case.getCurrentCase().notifyNewDataSource(newContents.get(0), dataSourceId);
|
||||
} else {
|
||||
Case.getCurrentCase().notifyFailedAddingNewDataSource(dataSourceId);
|
||||
}
|
||||
new Thread(() -> {
|
||||
if (!newContents.isEmpty()) {
|
||||
Case.getCurrentCase().notifyNewDataSource(newContents.get(0), dataSourceId);
|
||||
} else {
|
||||
Case.getCurrentCase().notifyFailedAddingNewDataSource(dataSourceId);
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
// Start ingest if we can
|
||||
|
@ -567,8 +567,10 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
||||
*/
|
||||
try {
|
||||
Case.getCurrentCase();
|
||||
CoreComponentControl.openCoreWindows();
|
||||
SwingUtilities.invokeLater(this::componentOpened);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
CoreComponentControl.openCoreWindows();
|
||||
componentOpened();
|
||||
});
|
||||
} catch (IllegalStateException notUsed) {
|
||||
/**
|
||||
* Case is closed, do nothing.
|
||||
|
@ -169,7 +169,9 @@ final class RemoteEventPublisher {
|
||||
if (object instanceof AutopsyEvent) {
|
||||
AutopsyEvent event = (AutopsyEvent) object;
|
||||
event.setSourceType(AutopsyEvent.SourceType.REMOTE);
|
||||
localPublisher.publish(event);
|
||||
new Thread(() -> {
|
||||
localPublisher.publish(event);
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user