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