mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Merge pull request #1442 from APriestman/caseEDT
Move event publishing and case open/close off EDT
This commit is contained in:
commit
08ae7fbff7
@ -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 {
|
||||||
catch (TskCoreException ex) {
|
Case.getCurrentCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
|
||||||
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
}
|
||||||
JOptionPane.showMessageDialog(null,
|
catch (TskCoreException ex) {
|
||||||
NbBundle.getMessage(this.getClass(),
|
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||||
"AddBlackboardArtifactTagAction.unableToTag.msg",
|
SwingUtilities.invokeLater(() -> {
|
||||||
artifact.getDisplayName()),
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"AddBlackboardArtifactTagAction.taggingErr"),
|
"AddBlackboardArtifactTagAction.unableToTag.msg",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
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.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("..")) {
|
||||||
JOptionPane.showMessageDialog(null,
|
Content parentFile = file.getParent();
|
||||||
NbBundle.getMessage(this.getClass(),
|
if (parentFile instanceof AbstractFile) {
|
||||||
"AddContentTagAction.unableToTag.msg",
|
parentFile = (AbstractFile)((AbstractFile)parentFile).getParent();
|
||||||
parentFile.getName()),
|
if (parentFile instanceof AbstractFile) {
|
||||||
NbBundle.getMessage(this.getClass(),
|
file = (AbstractFile)parentFile;
|
||||||
"AddContentTagAction.cannotApplyTagErr"),
|
}
|
||||||
JOptionPane.WARNING_MESSAGE);
|
else {
|
||||||
continue;
|
final Content parentFileCopy = parentFile;
|
||||||
}
|
SwingUtilities.invokeLater(() -> {
|
||||||
}
|
JOptionPane.showMessageDialog(null,
|
||||||
// check if the same tag is being added for the same abstract file.
|
NbBundle.getMessage(this.getClass(),
|
||||||
TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
|
"AddContentTagAction.unableToTag.msg",
|
||||||
List<ContentTag> contentTagList = tagsManager.getContentTagsByContent(file);
|
parentFileCopy.getName()),
|
||||||
for (ContentTag contentTag : contentTagList) {
|
NbBundle.getMessage(this.getClass(),
|
||||||
if (contentTag.getName().getDisplayName().equals(tagName.getDisplayName())) {
|
"AddContentTagAction.cannotApplyTagErr"),
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.WARNING_MESSAGE);
|
||||||
NbBundle.getMessage(this.getClass(),
|
});
|
||||||
"AddContentTagAction.tagExists",
|
continue;
|
||||||
file.getName(), tagName.getDisplayName()),
|
}
|
||||||
NbBundle.getMessage(this.getClass(),
|
}
|
||||||
"AddContentTagAction.cannotApplyTagErr"),
|
else {
|
||||||
JOptionPane.WARNING_MESSAGE);
|
final Content parentFileCopy = parentFile;
|
||||||
return;
|
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);
|
||||||
}
|
}
|
||||||
tagsManager.addContentTag(file, tagName, comment);
|
catch (TskCoreException ex) {
|
||||||
}
|
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||||
catch (TskCoreException ex) {
|
AbstractFile fileCopy = file;
|
||||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"AddContentTagAction.unableToTag.msg2",
|
"AddContentTagAction.unableToTag.msg2",
|
||||||
file.getName()),
|
fileCopy.getName()),
|
||||||
NbBundle.getMessage(this.getClass(), "AddContentTagAction.taggingErr"),
|
NbBundle.getMessage(this.getClass(), "AddContentTagAction.taggingErr"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
}
|
}
|
@ -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
|
catch (TskCoreException ex) {
|
||||||
JOptionPane.showMessageDialog(null,
|
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||||
NbBundle.getMessage(this.getClass(),
|
SwingUtilities.invokeLater(() -> {
|
||||||
"DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
|
JOptionPane.showMessageDialog(null,
|
||||||
tag.getName()),
|
NbBundle.getMessage(this.getClass(),
|
||||||
NbBundle.getMessage(this.getClass(),
|
"DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
|
||||||
"DeleteBlackboardArtifactTagAction.tagDelErr"),
|
tag.getName()),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
NbBundle.getMessage(this.getClass(),
|
||||||
}
|
"DeleteBlackboardArtifactTagAction.tagDelErr"),
|
||||||
}
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
catch (TskCoreException ex) {
|
||||||
JOptionPane.showMessageDialog(null,
|
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||||
NbBundle.getMessage(this.getClass(),
|
SwingUtilities.invokeLater(() -> {
|
||||||
"DeleteContentTagAction.unableToDelTag.msg",
|
JOptionPane.showMessageDialog(null,
|
||||||
tag.getName()),
|
NbBundle.getMessage(this.getClass(),
|
||||||
NbBundle.getMessage(this.getClass(), "DeleteContentTagAction.tagDelErr"),
|
"DeleteContentTagAction.unableToDelTag.msg",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
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
|
// 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
|
||||||
|
@ -44,6 +44,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
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.actions.CallableSystemAction;
|
import org.openide.util.actions.CallableSystemAction;
|
||||||
import org.openide.util.actions.SystemAction;
|
import org.openide.util.actions.SystemAction;
|
||||||
@ -328,7 +329,9 @@ public class Case {
|
|||||||
currentCase = newCase;
|
currentCase = newCase;
|
||||||
Logger.setLogDirectory(currentCase.getLogDirectoryPath());
|
Logger.setLogDirectory(currentCase.getLogDirectoryPath());
|
||||||
doCaseChange(currentCase);
|
doCaseChange(currentCase);
|
||||||
RecentCases.getInstance().addRecentCase(currentCase.name, currentCase.configFilePath); // update the recent cases
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
RecentCases.getInstance().addRecentCase(currentCase.name, currentCase.configFilePath); // update the recent cases
|
||||||
|
});
|
||||||
if (CaseType.MULTI_USER_CASE == newCase.getCaseType()) {
|
if (CaseType.MULTI_USER_CASE == newCase.getCaseType()) {
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
@ -523,20 +526,24 @@ public class Case {
|
|||||||
String dbPath = caseDir + File.separator + "autopsy.db"; //NON-NLS
|
String dbPath = caseDir + File.separator + "autopsy.db"; //NON-NLS
|
||||||
db = SleuthkitCase.openCase(dbPath);
|
db = SleuthkitCase.openCase(dbPath);
|
||||||
if (null != db.getBackupDatabasePath()) {
|
if (null != db.getBackupDatabasePath()) {
|
||||||
JOptionPane.showMessageDialog(null,
|
SwingUtilities.invokeLater(() -> {
|
||||||
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
|
JOptionPane.showMessageDialog(null,
|
||||||
db.getBackupDatabasePath()),
|
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
|
||||||
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
|
db.getBackupDatabasePath()),
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
|
||||||
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo(), caseDir);
|
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo(), caseDir);
|
||||||
if (null != db.getBackupDatabasePath()) {
|
if (null != db.getBackupDatabasePath()) {
|
||||||
JOptionPane.showMessageDialog(null,
|
SwingUtilities.invokeLater(() -> {
|
||||||
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
|
JOptionPane.showMessageDialog(null,
|
||||||
db.getBackupDatabasePath()),
|
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
|
||||||
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
|
db.getBackupDatabasePath()),
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.title"),
|
||||||
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,6 +652,8 @@ public class Case {
|
|||||||
/**
|
/**
|
||||||
* Notifies case event subscribers (property change listeners) that a data
|
* Notifies case event subscribers (property change listeners) that a data
|
||||||
* source is being added to the case database.
|
* source is being added to the case database.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param dataSourceId A unique identifier for the data source. This UUID
|
* @param dataSourceId A unique identifier for the data source. This UUID
|
||||||
* should be used to call notifyNewDataSource() after the
|
* should be used to call notifyNewDataSource() after the
|
||||||
@ -657,6 +666,8 @@ public class Case {
|
|||||||
/**
|
/**
|
||||||
* Notifies case event subscribers (property change listeners) that a data
|
* Notifies case event subscribers (property change listeners) that a data
|
||||||
* source failed to be added to the case database.
|
* source failed to be added to the case database.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param dataSourceId A unique identifier for the data source.
|
* @param dataSourceId A unique identifier for the data source.
|
||||||
*/
|
*/
|
||||||
@ -667,6 +678,8 @@ public class Case {
|
|||||||
/**
|
/**
|
||||||
* Notifies case event subscribers (property change listeners) that a data
|
* Notifies case event subscribers (property change listeners) that a data
|
||||||
* source is being added to the case database.
|
* source is being added to the case database.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param newDataSource New data source added.
|
* @param newDataSource New data source added.
|
||||||
* @param dataSourceId A unique identifier for the data source. Should be
|
* @param dataSourceId A unique identifier for the data source. Should be
|
||||||
@ -679,6 +692,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the UI that a new ContentTag has been added.
|
* Notifies the UI that a new ContentTag has been added.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param newTag new ContentTag added
|
* @param newTag new ContentTag added
|
||||||
*/
|
*/
|
||||||
@ -688,6 +703,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the UI that a ContentTag has been deleted.
|
* Notifies the UI that a ContentTag has been deleted.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param deletedTag ContentTag deleted
|
* @param deletedTag ContentTag deleted
|
||||||
*/
|
*/
|
||||||
@ -697,6 +714,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the UI that a new BlackboardArtifactTag has been added.
|
* Notifies the UI that a new BlackboardArtifactTag has been added.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param newTag new BlackboardArtifactTag added
|
* @param newTag new BlackboardArtifactTag added
|
||||||
*/
|
*/
|
||||||
@ -705,7 +724,9 @@ public class Case {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the UI that a BlackboardArtifactTag has been.
|
* Notifies the UI that a BlackboardArtifactTag has been deleted.
|
||||||
|
*
|
||||||
|
* This should not be called from the event dispatch thread (EDT)
|
||||||
*
|
*
|
||||||
* @param deletedTag BlackboardArtifactTag deleted
|
* @param deletedTag BlackboardArtifactTag deleted
|
||||||
*/
|
*/
|
||||||
@ -774,6 +795,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the case name.
|
* Updates the case name.
|
||||||
|
*
|
||||||
|
* This should not be called from the EDT.
|
||||||
*
|
*
|
||||||
* @param oldCaseName the old case name that wants to be updated
|
* @param oldCaseName the old case name that wants to be updated
|
||||||
* @param oldPath the old path that wants to be updated
|
* @param oldPath the old path that wants to be updated
|
||||||
@ -784,9 +807,15 @@ public class Case {
|
|||||||
try {
|
try {
|
||||||
xmlcm.setCaseName(newCaseName); // set the case
|
xmlcm.setCaseName(newCaseName); // set the case
|
||||||
name = newCaseName; // change the local value
|
name = newCaseName; // change the local value
|
||||||
RecentCases.getInstance().updateRecentCase(oldCaseName, oldPath, newCaseName, newPath); // update the recent case
|
|
||||||
eventPublisher.publish(new AutopsyEvent(Events.NAME.toString(), oldCaseName, newCaseName));
|
eventPublisher.publish(new AutopsyEvent(Events.NAME.toString(), oldCaseName, newCaseName));
|
||||||
updateMainWindowTitle(newCaseName);
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
try{
|
||||||
|
RecentCases.getInstance().updateRecentCase(oldCaseName, oldPath, newCaseName, newPath); // update the recent case
|
||||||
|
updateMainWindowTitle(newCaseName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(CasePropertiesForm.class.getName()).log(Level.WARNING, "Error: problem updating case name.", e); //NON-NLS
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CaseActionException(NbBundle.getMessage(this.getClass(), "Case.updateCaseName.exception.msg"), e);
|
throw new CaseActionException(NbBundle.getMessage(this.getClass(), "Case.updateCaseName.exception.msg"), e);
|
||||||
}
|
}
|
||||||
@ -794,6 +823,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the case examiner
|
* Updates the case examiner
|
||||||
|
*
|
||||||
|
* This should not be called from the EDT.
|
||||||
*
|
*
|
||||||
* @param oldExaminer the old examiner
|
* @param oldExaminer the old examiner
|
||||||
* @param newExaminer the new examiner
|
* @param newExaminer the new examiner
|
||||||
@ -810,6 +841,8 @@ public class Case {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the case number
|
* Updates the case number
|
||||||
|
*
|
||||||
|
* This should not be called from the EDT.
|
||||||
*
|
*
|
||||||
* @param oldCaseNumber the old case number
|
* @param oldCaseNumber the old case number
|
||||||
* @param newCaseNumber the new case number
|
* @param newCaseNumber the new case number
|
||||||
@ -1467,44 +1500,61 @@ public class Case {
|
|||||||
|
|
||||||
if (IngestManager.getInstance().isRunningInteractively()) {
|
if (IngestManager.getInstance().isRunningInteractively()) {
|
||||||
// enable these menus
|
// enable these menus
|
||||||
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
|
SwingUtilities.invokeLater(() -> {
|
||||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
|
||||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
|
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
|
||||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
|
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
|
||||||
|
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true); // Delete Case menu
|
||||||
|
});
|
||||||
|
|
||||||
if (toChangeTo.hasData()) {
|
if (toChangeTo.hasData()) {
|
||||||
// open all top components
|
// open all top components
|
||||||
CoreComponentControl.openCoreWindows();
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
CoreComponentControl.openCoreWindows();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// close all top components
|
// close all top components
|
||||||
CoreComponentControl.closeCoreWindows();
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
CoreComponentControl.closeCoreWindows();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IngestManager.getInstance().isRunningInteractively()) {
|
if (IngestManager.getInstance().isRunningInteractively()) {
|
||||||
updateMainWindowTitle(currentCase.name);
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
updateMainWindowTitle(currentCase.name);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Frame f = WindowManager.getDefault().getMainWindow();
|
SwingUtilities.invokeLater(() -> {
|
||||||
f.setTitle(Case.getAppName()); // set the window name to just application name
|
Frame f = WindowManager.getDefault().getMainWindow();
|
||||||
|
f.setTitle(Case.getAppName()); // set the window name to just application name
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // case is closed
|
} else { // case is closed
|
||||||
if (IngestManager.getInstance().isRunningInteractively()) {
|
if (IngestManager.getInstance().isRunningInteractively()) {
|
||||||
// close all top components first
|
|
||||||
CoreComponentControl.closeCoreWindows();
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
// close all top components first
|
||||||
// disable these menus
|
CoreComponentControl.closeCoreWindows();
|
||||||
CallableSystemAction.get(AddImageAction.class).setEnabled(false); // Add Image menu
|
|
||||||
CallableSystemAction.get(CaseCloseAction.class).setEnabled(false); // Case Close menu
|
// disable these menus
|
||||||
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false); // Case Properties menu
|
CallableSystemAction.get(AddImageAction.class).setEnabled(false); // Add Image menu
|
||||||
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false); // Delete Case menu
|
CallableSystemAction.get(CaseCloseAction.class).setEnabled(false); // Case Close menu
|
||||||
|
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(false); // Case Properties menu
|
||||||
|
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(false); // Delete Case menu
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear pending notifications
|
//clear pending notifications
|
||||||
MessageNotifyUtil.Notify.clear();
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
MessageNotifyUtil.Notify.clear();
|
||||||
|
});
|
||||||
|
|
||||||
Frame f = WindowManager.getDefault().getMainWindow();
|
SwingUtilities.invokeLater(() -> {
|
||||||
f.setTitle(Case.getAppName()); // set the window name to just application name
|
Frame f = WindowManager.getDefault().getMainWindow();
|
||||||
|
f.setTitle(Case.getAppName()); // set the window name to just application name
|
||||||
|
});
|
||||||
|
|
||||||
//try to force gc to happen
|
//try to force gc to happen
|
||||||
System.gc();
|
System.gc();
|
||||||
|
@ -27,6 +27,7 @@ import java.util.logging.Level;import org.sleuthkit.autopsy.coreutils.Logger;
|
|||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import org.openide.util.HelpCtx;
|
import org.openide.util.HelpCtx;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.actions.CallableSystemAction;
|
import org.openide.util.actions.CallableSystemAction;
|
||||||
@ -70,19 +71,24 @@ import org.openide.util.actions.Presenter;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Case result = Case.getCurrentCase();
|
new SwingWorker<Void, Void>() {
|
||||||
try {
|
|
||||||
result.closeCase();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Logger.getLogger(CaseCloseAction.class.getName()).log(Level.SEVERE, "Error closing case.", ex); //NON-NLS
|
|
||||||
}
|
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
protected Void doInBackground() throws Exception {
|
||||||
|
try{
|
||||||
|
Case result = Case.getCurrentCase();
|
||||||
|
result.closeCase();
|
||||||
|
} catch (CaseActionException | IllegalStateException ex){
|
||||||
|
Logger.getLogger(CaseCloseAction.class.getName()).log(Level.SEVERE, "Error closing case.", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
StartupWindowProvider.getInstance().open();
|
StartupWindowProvider.getInstance().open();
|
||||||
}
|
}
|
||||||
});
|
}.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,9 +23,12 @@ import java.awt.Window;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
@ -76,7 +79,7 @@ public final class CaseOpenAction implements ActionListener {
|
|||||||
int retval = fc.showOpenDialog(WindowManager.getDefault().getMainWindow());
|
int retval = fc.showOpenDialog(WindowManager.getDefault().getMainWindow());
|
||||||
|
|
||||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||||
String path = fc.getSelectedFile().getPath();
|
final String path = fc.getSelectedFile().getPath();
|
||||||
String dirPath = fc.getSelectedFile().getParent();
|
String dirPath = fc.getSelectedFile().getParent();
|
||||||
ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_BASECASE, dirPath.substring(0, dirPath.lastIndexOf(File.separator)));
|
ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_BASECASE, dirPath.substring(0, dirPath.lastIndexOf(File.separator)));
|
||||||
// check if the file exists
|
// check if the file exists
|
||||||
@ -96,20 +99,27 @@ public final class CaseOpenAction implements ActionListener {
|
|||||||
// no need to show the error message to the user.
|
// no need to show the error message to the user.
|
||||||
logger.log(Level.WARNING, "Error closing startup window.", ex); //NON-NLS
|
logger.log(Level.WARNING, "Error closing startup window.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
Case.open(path); // open the case
|
new Thread(() -> {
|
||||||
} catch (CaseActionException ex) {
|
// Create case.
|
||||||
JOptionPane.showMessageDialog(null,
|
try{
|
||||||
NbBundle.getMessage(this.getClass(),
|
Case.open(path);
|
||||||
"CaseOpenAction.msgDlg.cantOpenCase.msg", path,
|
} catch (CaseActionException ex) {
|
||||||
ex.getMessage()),
|
SwingUtilities.invokeLater(() -> {
|
||||||
NbBundle.getMessage(this.getClass(),
|
JOptionPane.showMessageDialog(null,
|
||||||
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
NbBundle.getMessage(this.getClass(),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
"CaseOpenAction.msgDlg.cantOpenCase.msg", path,
|
||||||
logger.log(Level.WARNING, "Error opening case in folder " + path, ex); //NON-NLS
|
ex.getMessage()),
|
||||||
|
NbBundle.getMessage(this.getClass(),
|
||||||
|
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
||||||
StartupWindowProvider.getInstance().open();
|
|
||||||
}
|
StartupWindowProvider.getInstance().open();
|
||||||
|
});
|
||||||
|
logger.log(Level.WARNING, "Error opening case in folder " + path, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,10 @@ import java.awt.Dialog;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import org.openide.DialogDescriptor;
|
import org.openide.DialogDescriptor;
|
||||||
import org.openide.DialogDisplayer;
|
import org.openide.DialogDisplayer;
|
||||||
import org.openide.NotifyDescriptor;
|
import org.openide.NotifyDescriptor;
|
||||||
@ -81,7 +84,7 @@ import org.sleuthkit.datamodel.TskData.DbType;
|
|||||||
* The method to perform new case creation
|
* The method to perform new case creation
|
||||||
*/
|
*/
|
||||||
private void newCaseAction() {
|
private void newCaseAction() {
|
||||||
WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
|
final WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
|
||||||
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
|
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
|
||||||
wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
|
wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
|
||||||
wizardDescriptor.setTitle(NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.newCase.windowTitle.text"));
|
wizardDescriptor.setTitle(NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.newCase.windowTitle.text"));
|
||||||
@ -89,44 +92,71 @@ import org.sleuthkit.datamodel.TskData.DbType;
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
dialog.toFront();
|
dialog.toFront();
|
||||||
|
|
||||||
|
if(wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION){
|
||||||
|
new SwingWorker<Void, Void>() {
|
||||||
|
|
||||||
boolean finished = wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION; // check if it finishes (it's not cancelled)
|
@Override
|
||||||
boolean isCancelled = wizardDescriptor.getValue() == WizardDescriptor.CANCEL_OPTION; // check if the "Cancel" button is pressed
|
protected Void doInBackground() throws Exception {
|
||||||
|
// Create case.
|
||||||
|
|
||||||
|
String caseNumber = (String) wizardDescriptor.getProperty("caseNumber"); //NON-NLS
|
||||||
|
String examiner = (String) wizardDescriptor.getProperty("caseExaminer"); //NON-NLS
|
||||||
|
final String caseName = (String) wizardDescriptor.getProperty("caseName"); //NON-NLS
|
||||||
|
String createdDirectory = (String) wizardDescriptor.getProperty("createdDirectory"); //NON-NLS
|
||||||
|
CaseType caseType = CaseType.values()[(int)wizardDescriptor.getProperty("caseType")]; //NON-NLS
|
||||||
|
|
||||||
// if the finish button is pressed (not cancelled)
|
Case.create(createdDirectory, caseName, caseNumber, examiner, caseType);
|
||||||
if (finished) {
|
return null;
|
||||||
// now start the 'Add Image' wizard
|
}
|
||||||
//TODO fix for local
|
|
||||||
CaseType currentCaseType = CaseType.fromString(ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, ModuleSettings.CURRENT_CASE_TYPE));
|
@Override
|
||||||
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
|
protected void done() {
|
||||||
if ((currentCaseType==CaseType.SINGLE_USER_CASE) || ((info.getDbType() != DbType.SQLITE) && info.canConnect())) {
|
try {
|
||||||
AddImageAction addImageAction = SystemAction.get(AddImageAction.class);
|
get();
|
||||||
addImageAction.actionPerformed(null);
|
CaseType currentCaseType = CaseType.values()[(int)wizardDescriptor.getProperty("caseType")]; //NON-NLS
|
||||||
} else {
|
CaseDbConnectionInfo info = UserPreferences.getDatabaseConnectionInfo();
|
||||||
JOptionPane.showMessageDialog(null,
|
if ((currentCaseType==CaseType.SINGLE_USER_CASE) || ((info.getDbType() != DbType.SQLITE) && info.canConnect())) {
|
||||||
NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.databaseProblem1.text"),
|
AddImageAction addImageAction = SystemAction.get(AddImageAction.class);
|
||||||
NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.databaseProblem2.text"),
|
addImageAction.actionPerformed(null);
|
||||||
JOptionPane.ERROR_MESSAGE);
|
} else {
|
||||||
isCancelled = true;
|
JOptionPane.showMessageDialog(null,
|
||||||
}
|
NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.databaseProblem1.text"),
|
||||||
|
NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.databaseProblem2.text"),
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
doFailedCaseCleanup(wizardDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
final String caseName = (String) wizardDescriptor.getProperty("caseName"); //NON-NLS
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
|
||||||
|
"CaseCreateAction.msgDlg.cantCreateCase.msg")+" "+caseName,
|
||||||
|
NbBundle.getMessage(this.getClass(),
|
||||||
|
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
});
|
||||||
|
doFailedCaseCleanup(wizardDescriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
new Thread(() -> {
|
||||||
|
doFailedCaseCleanup(wizardDescriptor);
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if Cancel button is pressed
|
|
||||||
if (isCancelled) {
|
|
||||||
String createdDirectory = (String) wizardDescriptor.getProperty("createdDirectory"); //NON-NLS
|
|
||||||
// if there's case opened, close the case
|
|
||||||
if (Case.existsCurrentCase()) {
|
|
||||||
// close the previous case if there's any
|
|
||||||
CaseCloseAction closeCase = SystemAction.get(CaseCloseAction.class);
|
|
||||||
closeCase.actionPerformed(null);
|
|
||||||
}
|
|
||||||
if (createdDirectory != null) {
|
|
||||||
logger.log(Level.INFO, "Deleting a created case directory due to isCancelled set, dir: " + createdDirectory); //NON-NLS
|
|
||||||
Case.deleteCaseDirectory(new File(createdDirectory));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
panels = null; // reset the panel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doFailedCaseCleanup(WizardDescriptor wizardDescriptor){
|
||||||
|
String createdDirectory = (String) wizardDescriptor.getProperty("createdDirectory"); //NON-NLS
|
||||||
|
|
||||||
|
if (createdDirectory != null) {
|
||||||
|
logger.log(Level.INFO, "Deleting a created case directory due to an error, dir: " + createdDirectory); //NON-NLS
|
||||||
|
Case.deleteCaseDirectory(new File(createdDirectory));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize panels representing individual wizard's steps and sets
|
* Initialize panels representing individual wizard's steps and sets
|
||||||
|
@ -171,33 +171,12 @@ class NewCaseWizardPanel2 implements WizardDescriptor.ValidatingPanel<WizardDesc
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void storeSettings(WizardDescriptor settings) {
|
public void storeSettings(WizardDescriptor settings) {
|
||||||
|
NewCaseVisualPanel2 currentComponent = getComponent();
|
||||||
|
settings.putProperty("caseNumber", currentComponent.getCaseNumber());
|
||||||
|
settings.putProperty("caseExaminer", currentComponent.getExaminer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws WizardValidationException {
|
public void validate() throws WizardValidationException {
|
||||||
|
|
||||||
NewCaseVisualPanel2 currentComponent = getComponent();
|
|
||||||
final String caseNumber = currentComponent.getCaseNumber();
|
|
||||||
final String examiner = currentComponent.getExaminer();
|
|
||||||
try {
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Case.create(createdDirectory, caseName, caseNumber, examiner, caseType);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(),
|
|
||||||
"CaseCreateAction.msgDlg.cantCreateCase.msg")+" "+caseName,
|
|
||||||
NbBundle.getMessage(this.getClass(),
|
|
||||||
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new WizardValidationException(this.getComponent(),
|
|
||||||
NbBundle.getMessage(this.getClass(), "NewCaseWizardPanel2.validate.errCreateCase.msg"), null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,12 @@ import java.awt.EventQueue;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
@ -187,8 +190,8 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
|||||||
logger.log(Level.INFO, "No Case paths exist, cannot open the case"); //NON-NLS
|
logger.log(Level.INFO, "No Case paths exist, cannot open the case"); //NON-NLS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String casePath = casePaths[imagesTable.getSelectedRow()];
|
final String casePath = casePaths[imagesTable.getSelectedRow()];
|
||||||
String caseName = caseNames[imagesTable.getSelectedRow()];
|
final String caseName = caseNames[imagesTable.getSelectedRow()];
|
||||||
if (!casePath.equals("")) {
|
if (!casePath.equals("")) {
|
||||||
// Close the startup menu
|
// Close the startup menu
|
||||||
try {
|
try {
|
||||||
@ -198,34 +201,39 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
|
|||||||
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
|
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
|
||||||
}
|
}
|
||||||
// Open the recent cases
|
// Open the recent cases
|
||||||
try {
|
if (caseName.equals("") || casePath.equals("") || (!new File(casePath).exists())) {
|
||||||
if (caseName.equals("") || casePath.equals("") || (!new File(casePath).exists())) {
|
|
||||||
JOptionPane.showMessageDialog(null,
|
|
||||||
NbBundle.getMessage(this.getClass(),
|
|
||||||
"OpenRecentCasePanel.openCase.msgDlg.caseDoesntExist.msg",
|
|
||||||
caseName),
|
|
||||||
NbBundle.getMessage(this.getClass(),
|
|
||||||
"OpenRecentCasePanel.openCase.msgDlg.err"),
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
RecentCases.getInstance().removeRecentCase(caseName, casePath); // remove the recent case if it doesn't exist anymore
|
|
||||||
|
|
||||||
//if case is not opened, open the start window
|
|
||||||
if (Case.isCaseOpen() == false) {
|
|
||||||
StartupWindowProvider.getInstance().open();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Case.open(casePath); // open the case
|
|
||||||
}
|
|
||||||
} catch (CaseActionException ex) {
|
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
|
"OpenRecentCasePanel.openCase.msgDlg.caseDoesntExist.msg",
|
||||||
|
caseName),
|
||||||
|
NbBundle.getMessage(this.getClass(),
|
||||||
|
"OpenRecentCasePanel.openCase.msgDlg.err"),
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
RecentCases.getInstance().removeRecentCase(caseName, casePath); // remove the recent case if it doesn't exist anymore
|
||||||
|
|
||||||
|
//if case is not opened, open the start window
|
||||||
|
if (Case.isCaseOpen() == false) {
|
||||||
|
StartupWindowProvider.getInstance().open();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
new Thread(() -> {
|
||||||
|
// Create case.
|
||||||
|
try{
|
||||||
|
Case.open(casePath);
|
||||||
|
} catch (CaseActionException ex) {
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
JOptionPane.showMessageDialog(null,
|
||||||
|
NbBundle.getMessage(this.getClass(),
|
||||||
"CaseOpenAction.msgDlg.cantOpenCase.msg", caseName,
|
"CaseOpenAction.msgDlg.cantOpenCase.msg", caseName,
|
||||||
ex.getMessage()),
|
ex.getMessage()),
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
"CaseOpenAction.msgDlg.cantOpenCase.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
|
});
|
||||||
|
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,12 @@ import java.awt.EventQueue;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
|
||||||
@ -35,8 +38,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
|||||||
*/
|
*/
|
||||||
class RecentItems implements ActionListener {
|
class RecentItems implements ActionListener {
|
||||||
|
|
||||||
String caseName;
|
final String caseName;
|
||||||
String casePath;
|
final String casePath;
|
||||||
private JPanel caller; // for error handling
|
private JPanel caller; // for error handling
|
||||||
|
|
||||||
/** the constructor */
|
/** the constructor */
|
||||||
@ -76,15 +79,20 @@ class RecentItems implements ActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
new Thread(() -> {
|
||||||
Case.open(casePath); // open the case
|
// Create case.
|
||||||
} catch (CaseActionException ex) {
|
try{
|
||||||
JOptionPane.showMessageDialog(null,
|
Case.open(casePath);
|
||||||
|
} catch (CaseActionException ex) {
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.msg", casePath,
|
NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.msg", casePath,
|
||||||
ex.getMessage()), NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"),
|
ex.getMessage()), NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS
|
});
|
||||||
}
|
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,12 @@ import java.util.Collection;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.UIManager.LookAndFeelInfo;
|
import javax.swing.UIManager.LookAndFeelInfo;
|
||||||
import javax.swing.UnsupportedLookAndFeelException;
|
import javax.swing.UnsupportedLookAndFeelException;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
import org.netbeans.spi.sendopts.OptionProcessor;
|
import org.netbeans.spi.sendopts.OptionProcessor;
|
||||||
import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI;
|
import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI;
|
||||||
import org.openide.modules.ModuleInstall;
|
import org.openide.modules.ModuleInstall;
|
||||||
@ -74,13 +76,18 @@ public class Installer extends ModuleInstall {
|
|||||||
for (OptionProcessor processor : processors) {
|
for (OptionProcessor processor : processors) {
|
||||||
if (processor instanceof OpenFromArguments) {
|
if (processor instanceof OpenFromArguments) {
|
||||||
OpenFromArguments argsProcessor = (OpenFromArguments) processor;
|
OpenFromArguments argsProcessor = (OpenFromArguments) processor;
|
||||||
String caseFile = argsProcessor.getDefaultArg();
|
final String caseFile = argsProcessor.getDefaultArg();
|
||||||
if (caseFile != null && !caseFile.equals("") && caseFile.endsWith(".aut") && new File(caseFile).exists()) { //NON-NLS
|
if (caseFile != null && !caseFile.equals("") && caseFile.endsWith(".aut") && new File(caseFile).exists()) { //NON-NLS
|
||||||
try {
|
|
||||||
Case.open(caseFile);
|
new Thread(() -> {
|
||||||
return;
|
// Create case.
|
||||||
} catch (Exception e) {
|
try{
|
||||||
}
|
Case.open(caseFile);
|
||||||
|
} catch(Exception ex){
|
||||||
|
logger.log(Level.WARNING, "Error opening case. ", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,13 +106,15 @@ public class Installer extends ModuleInstall {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
new Thread(() -> {
|
||||||
if (Case.isCaseOpen())
|
try {
|
||||||
Case.getCurrentCase().closeCase();
|
if (Case.isCaseOpen())
|
||||||
}
|
Case.getCurrentCase().closeCase();
|
||||||
catch (CaseActionException ex) {
|
}
|
||||||
logger.log(Level.WARNING, "Error closing case. ", ex); //NON-NLS
|
catch (CaseActionException | IllegalStateException ex) {
|
||||||
}
|
logger.log(Level.WARNING, "Error closing case. ", ex); //NON-NLS
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupLAF() {
|
private void setupLAF() {
|
||||||
|
@ -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