diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/IngestJobInfoPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/IngestJobInfoPanel.java index e729265a19..37e4a8fb02 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/IngestJobInfoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/IngestJobInfoPanel.java @@ -82,7 +82,7 @@ public final class IngestJobInfoPanel extends javax.swing.JPanel { this.repaint(); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Failed to load ingest jobs.", ex); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(this), Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE); } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java index 0abc0091f1..4a3a508920 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/LocalFilesPanel.java @@ -31,7 +31,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import java.util.logging.Level; import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; import org.sleuthkit.autopsy.casemodule.Case.CaseType; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PathValidator; @@ -280,7 +279,7 @@ final class LocalFilesPanel extends JPanel { }//GEN-LAST:event_clearButtonActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - String displayName = JOptionPane.showInputDialog(SwingUtilities.getWindowAncestor(this), "New Display Name: "); + String displayName = JOptionPane.showInputDialog(this, "New Display Name: "); if (displayName != null && !displayName.equals("")) { this.displayName = displayName; this.displayNameLabel.setText("Display Name: " + this.displayName); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java index d8765ecaa7..276be583c1 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java @@ -29,6 +29,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; import org.sleuthkit.datamodel.TskData; @Messages({"TagNameDialog.descriptionLabel.text=Description:", @@ -76,10 +77,7 @@ final class TagNameDialog extends javax.swing.JDialog { /* * Center the dialog */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - int width = this.getSize().width; - int height = this.getSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); /* * Add a handler for when the dialog window is closed directly. diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java index 679f177161..11d6495a39 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java @@ -328,7 +328,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { updatePanel(); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); } else { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(this), + JOptionPane.showMessageDialog(this, NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.TagNameDialog.tagNameAlreadyExists.message"), NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.TagNameDialog.tagNameAlreadyExists.title"), JOptionPane.INFORMATION_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java index 5fae3b30b1..0015dbaf81 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java @@ -95,7 +95,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i boolean result = EamDbUtil.upgradeDatabase(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); if(! result){ - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(this), + JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(), "GlobalSettingsPanel.updateFailed.message"), NbBundle.getMessage(this.getClass(), diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java index 3ed7edb260..ccf98bd858 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageOrganizationsDialog.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,8 +19,6 @@ package org.sleuthkit.autopsy.centralrepository.optionspanel; import java.awt.Component; -import java.awt.Dimension; -import java.awt.Toolkit; import java.util.List; import java.util.logging.Level; import javax.swing.DefaultListCellRenderer; @@ -46,7 +44,7 @@ public final class ManageOrganizationsDialog extends JDialog { private EamDb dbManager; private EamOrganization newOrg; private final DefaultListModel rulesListModel = new DefaultListModel<>(); - private final static Logger LOGGER = Logger.getLogger(ManageOrganizationsDialog.class.getName()); + private final static Logger logger = Logger.getLogger(ManageOrganizationsDialog.class.getName()); @Messages({"ManageOrganizationsDialog.title.text=Manage Organizations"}) /** @@ -352,7 +350,7 @@ public final class ManageOrganizationsDialog extends JDialog { } catch (EamDbException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), Bundle.ManageOrganizationsDialog_unableToDeleteOrg_title(), JOptionPane.WARNING_MESSAGE); - LOGGER.log(Level.INFO, "Was unable to delete organization from central repository", ex); + logger.log(Level.INFO, "Was unable to delete organization from central repository", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRuleDialog.java b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRuleDialog.java index 108c7fc963..073f7b4eee 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRuleDialog.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRuleDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.directorytree; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -31,6 +30,7 @@ import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; /** * A dialog for adding or editing an external viewer rule @@ -78,10 +78,7 @@ class AddExternalViewerRuleDialog extends JDialog { /** * Center the dialog. */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - int width = this.getSize().width; - int height = this.getSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); add(this.addRulePanel, BorderLayout.PAGE_START); diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java index 2481be7774..75ae1a4aed 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/AddExternalViewerRulePanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -134,7 +134,7 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel { ExternalViewerRule getRule() { String exePath = exePathTextField.getText(); if (exePath.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidExePath.message"), NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidExePath.title"), JOptionPane.ERROR_MESSAGE); @@ -151,7 +151,7 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel { return null; } if (name.isEmpty() || !detector.isDetectable(name)) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidMime.message"), NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidMime.title"), JOptionPane.ERROR_MESSAGE); @@ -160,7 +160,7 @@ class AddExternalViewerRulePanel extends javax.swing.JPanel { return new ExternalViewerRule(name, exePath, ExternalViewerRule.RuleType.MIME); } else if (extRadioButton.isSelected()) { if (name.isEmpty() || !name.matches("^\\.?\\w+$")) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidExt.message"), NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.invalidExt.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java index e79840fd20..bd88f359ab 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +27,7 @@ import javax.swing.AbstractAction; import javax.swing.JOptionPane; import org.openide.nodes.Node; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.ContentUtils; @@ -129,32 +130,32 @@ public class ExternalViewerAction extends AbstractAction { runtime.exec(s); } catch (IOException ex) { logger.log(Level.WARNING, "Could not open the specified viewer for the given file: " + file.getName(), ex); //NON-NLS - JOptionPane.showMessageDialog(null, Bundle.ExternalViewerAction_actionPerformed_failure_IO_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExternalViewerAction_actionPerformed_failure_IO_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); } } else { try { Desktop.getDesktop().open(file); } catch (IOException ex) { logger.log(Level.WARNING, "Could not find a viewer for the given file: " + file.getName(), ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExternalViewerAction_actionPerformed_failure_IO_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); } catch (UnsupportedOperationException ex) { logger.log(Level.WARNING, "Platform cannot open " + file.getName() + " in the defined editor.", ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExternalViewerAction_actionPerformed_failure_support_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); } catch (IllegalArgumentException ex) { logger.log(Level.WARNING, "Could not find the given file: " + file.getName(), ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExternalViewerAction_actionPerformed_failure_missingFile_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); } catch (SecurityException ex) { logger.log(Level.WARNING, "Could not get permission to open the given file: " + file.getName(), ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExternalViewerAction_actionPerformed_failure_permission_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java index f87c6b4e33..574747281d 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerGlobalSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,7 +36,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; */ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel implements OptionsPanel { - private static final Logger LOGGER = Logger.getLogger(ExternalViewerGlobalSettingsPanel.class.getName()); + private static final Logger logger = Logger.getLogger(ExternalViewerGlobalSettingsPanel.class.getName()); private DefaultListModel rulesListModel; private java.util.List rules; @@ -253,7 +253,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme ExternalViewerRule newRule = dialog.getRule(); // Only allow one association for each MIME type or extension. if (rules.contains(newRule)) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.ruleAlreadyExists.message"), NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.ruleAlreadyExists.title"), JOptionPane.ERROR_MESSAGE); @@ -277,7 +277,7 @@ final class ExternalViewerGlobalSettingsPanel extends javax.swing.JPanel impleme ExternalViewerRule newRule = dialog.getRule(); // Only allow one association for each MIME type or extension. if (rules.contains(newRule)) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.ruleAlreadyExists.message"), NbBundle.getMessage(ExternalViewerGlobalSettingsPanel.class, "ExternalViewerGlobalSettingsPanel.JOptionPane.ruleAlreadyExists.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java index b8d5b7e359..568e410de6 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-2017 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ import javax.swing.JOptionPane; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.Cancellable; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.NetworkUtils; @@ -551,7 +552,7 @@ final class DataSourceIngestJob { // data source ingest module or the entire ingest job. DataSourceIngestCancellationPanel panel = new DataSourceIngestCancellationPanel(); String dialogTitle = NbBundle.getMessage(DataSourceIngestJob.this.getClass(), "IngestJob.cancellationDialog.title"); - JOptionPane.showConfirmDialog(null, panel, dialogTitle, JOptionPane.OK_OPTION, JOptionPane.PLAIN_MESSAGE); + JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), panel, dialogTitle, JOptionPane.OK_OPTION, JOptionPane.PLAIN_MESSAGE); if (panel.cancelAllDataSourceIngestModules()) { DataSourceIngestJob.this.cancel(IngestJob.CancellationReason.USER_CANCELLED); } else { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index e61f8d61f7..089ebfc53e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,6 +48,7 @@ import javax.swing.JOptionPane; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.Cancellable; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.ServicesMonitor; @@ -107,7 +108,7 @@ import org.sleuthkit.datamodel.Content; @ThreadSafe public class IngestManager { - private final static Logger LOGGER = Logger.getLogger(IngestManager.class.getName()); + private final static Logger logger = Logger.getLogger(IngestManager.class.getName()); private final static String INGEST_JOB_EVENT_CHANNEL_NAME = "%s-Ingest-Job-Events"; //NON-NLS private final static Set INGEST_JOB_EVENT_NAMES = Stream.of(IngestJobEvent.values()).map(IngestJobEvent::toString).collect(Collectors.toSet()); private final static String INGEST_MODULE_EVENT_CHANNEL_NAME = "%s-Ingest-Module-Events"; //NON-NLS @@ -197,12 +198,12 @@ public class IngestManager { } String serviceDisplayName = ServicesMonitor.Service.valueOf(evt.getPropertyName()).getDisplayName(); - LOGGER.log(Level.SEVERE, "Service {0} is down, cancelling all running ingest jobs", serviceDisplayName); //NON-NLS + logger.log(Level.SEVERE, "Service {0} is down, cancelling all running ingest jobs", serviceDisplayName); //NON-NLS if (isIngestRunning() && RuntimeProperties.runningWithGUI()) { EventQueue.invokeLater(new Runnable() { @Override public void run() { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "IngestManager.cancellingIngest.msgDlg.text"), NbBundle.getMessage(this.getClass(), "IngestManager.serviceIsDown.msgDlg.text", serviceDisplayName), JOptionPane.ERROR_MESSAGE); @@ -257,7 +258,7 @@ public class IngestManager { moduleEventPublisher.openRemoteEventChannel(String.format(INGEST_MODULE_EVENT_CHANNEL_NAME, channelPrefix)); } } catch (IllegalStateException | AutopsyEventException ex) { - LOGGER.log(Level.SEVERE, "Failed to open remote events channel", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to open remote events channel", ex); //NON-NLS MessageNotifyUtil.Notify.error(NbBundle.getMessage(IngestManager.class, "IngestManager.OpenEventChannel.Fail.Title"), NbBundle.getMessage(IngestManager.class, "IngestManager.OpenEventChannel.Fail.ErrMsg")); } @@ -355,7 +356,7 @@ public class IngestManager { @Override public void run() { String serviceDisplayName = ServicesMonitor.Service.REMOTE_CASE_DATABASE.getDisplayName(); - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "IngestManager.cancellingIngest.msgDlg.text"), NbBundle.getMessage(this.getClass(), "IngestManager.serviceIsDown.msgDlg.text", serviceDisplayName), JOptionPane.ERROR_MESSAGE); @@ -377,13 +378,13 @@ public class IngestManager { errors = job.start(); if (errors.isEmpty()) { this.fireIngestJobStarted(job.getId()); - IngestManager.LOGGER.log(Level.INFO, "Ingest job {0} started", job.getId()); //NON-NLS + IngestManager.logger.log(Level.INFO, "Ingest job {0} started", job.getId()); //NON-NLS } else { this.ingestJobsById.remove(job.getId()); for (IngestModuleError error : errors) { - LOGGER.log(Level.SEVERE, String.format("Error starting %s ingest module for job %d", error.getModuleDisplayName(), job.getId()), error.getThrowable()); //NON-NLS + logger.log(Level.SEVERE, String.format("Error starting %s ingest module for job %d", error.getModuleDisplayName(), job.getId()), error.getThrowable()); //NON-NLS } - IngestManager.LOGGER.log(Level.SEVERE, "Ingest job {0} could not be started", job.getId()); //NON-NLS + IngestManager.logger.log(Level.SEVERE, "Ingest job {0} could not be started", job.getId()); //NON-NLS if (RuntimeProperties.runningWithGUI()) { final StringBuilder message = new StringBuilder(1024); message.append(Bundle.IngestManager_startupErr_dlgMsg()).append("\n"); //NON-NLS @@ -396,7 +397,7 @@ public class IngestManager { } message.append("\n\n"); EventQueue.invokeLater(() -> { - JOptionPane.showMessageDialog(null, message, Bundle.IngestManager_startupErr_dlgTitle(), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), message, Bundle.IngestManager_startupErr_dlgTitle(), JOptionPane.ERROR_MESSAGE); }); } return new IngestJobStartResult(null, new IngestManagerException("Errors occurred while starting ingest"), errors); //NON-NLS @@ -415,10 +416,10 @@ public class IngestManager { long jobId = job.getId(); ingestJobsById.remove(jobId); if (!job.isCancelled()) { - IngestManager.LOGGER.log(Level.INFO, "Ingest job {0} completed", jobId); //NON-NLS + IngestManager.logger.log(Level.INFO, "Ingest job {0} completed", jobId); //NON-NLS fireIngestJobCompleted(jobId); } else { - IngestManager.LOGGER.log(Level.INFO, "Ingest job {0} cancelled", jobId); //NON-NLS + IngestManager.logger.log(Level.INFO, "Ingest job {0} cancelled", jobId); //NON-NLS fireIngestJobCancelled(jobId); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index e97ec1e6ed..f728cbee23 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,7 +64,7 @@ public final class RunIngestModulesAction extends AbstractAction { for (String warning : warnings) { warningMessage.append(warning).append("\n"); } - JOptionPane.showMessageDialog(null, warningMessage.toString()); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), warningMessage.toString()); } } private final List dataSources = new ArrayList<>(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/AddFileExtensionAction.java b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/AddFileExtensionAction.java index 7c43f14182..63e853ecf0 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/AddFileExtensionAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/AddFileExtensionAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import javax.swing.AbstractAction; import javax.swing.JOptionPane; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -59,7 +60,7 @@ class AddFileExtensionAction extends AbstractAction { FileExtMismatchSettings.writeSettings(new FileExtMismatchSettings(editableMap)); } catch (FileExtMismatchSettings.FileExtMismatchSettingsException ex) { //error - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.AddFileExtensionAction_writeError_message(), NbBundle.getMessage(this.getClass(), "AddFileExtensionAction.msgDlg.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchContextMenuActionsProvider.java b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchContextMenuActionsProvider.java index 877a92e6e6..3bdc315b76 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchContextMenuActionsProvider.java +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchContextMenuActionsProvider.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import javax.swing.JOptionPane; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.lookup.ServiceProvider; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.corecomponentinterfaces.ContextMenuActionsProvider; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; @@ -98,7 +99,7 @@ public class FileExtMismatchContextMenuActionsProvider implements ContextMenuAct actions.get(0).setEnabled(false); } } catch (FileExtMismatchSettings.FileExtMismatchSettingsException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "AddFileExtensionAction.msgDlg.msg2"), NbBundle.getMessage(this.getClass(), "AddFileExtensionAction.msgDlg.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java index 85cf916f2c..85de3cbdb3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/fileextmismatch/FileExtMismatchSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -319,28 +319,28 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel // Add a user-provided filename extension string to the selecte mimetype private void newExtButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newExtButtonActionPerformed - String newExt = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.message"), + String newExt = (String) JOptionPane.showInputDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.title"), JOptionPane.PLAIN_MESSAGE, null, null, ""); if (newExt == null) { return; } if (newExt.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.empty.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.empty.title"), JOptionPane.ERROR_MESSAGE); return; } if (selectedMime.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.noMimeType.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.noMimeType.title"), JOptionPane.ERROR_MESSAGE); return; } if (currentExtensions.contains(newExt)) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.extExists.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newExtPrompt.extExists.title"), JOptionPane.ERROR_MESSAGE); @@ -361,7 +361,7 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel private void removeExtButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeExtButtonActionPerformed if (selectedExt.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeExtButton.noneSelected.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeExtButton.noneSelected.title"), JOptionPane.ERROR_MESSAGE); @@ -369,7 +369,7 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel } if (selectedMime.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeExtButton.noMimeTypeSelected.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeExtButton.noMimeTypeSelected.title"), JOptionPane.ERROR_MESSAGE); @@ -391,7 +391,7 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel private void removeTypeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeTypeButtonActionPerformed if (selectedMime.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeTypeButton.noneSelected.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.removeTypeButton.noneSelected.title"), JOptionPane.ERROR_MESSAGE); @@ -407,28 +407,28 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel }//GEN-LAST:event_removeTypeButtonActionPerformed private void newTypeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newTypeButtonActionPerformed - String newMime = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.message"), + String newMime = (String) JOptionPane.showInputDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.title"), JOptionPane.PLAIN_MESSAGE, null, null, ""); if (newMime == null) { return; } if (newMime.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.emptyMime.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.emptyMime.title"), JOptionPane.ERROR_MESSAGE); return; } if (newMime.equals("application/octet-stream")) { //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeNotSupported.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeNotSupported.title"), JOptionPane.ERROR_MESSAGE); return; } if (mimeList.contains(newMime)) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeExists.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeExists.title"), JOptionPane.ERROR_MESSAGE); @@ -444,7 +444,7 @@ final class FileExtMismatchSettingsPanel extends IngestModuleGlobalSettingsPanel } boolean mimeTypeDetectable = (null != detector) ? detector.isDetectable(newMime) : false; if (!mimeTypeDetectable) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeNotDetectable.message"), NbBundle.getMessage(FileExtMismatchSettingsPanel.class, "FileExtMismatchSettingsPanel.newMimePrompt.mimeTypeNotDetectable.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeDialog.java index 62cfc1030c..5095f4948e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeDialog.java @@ -34,6 +34,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; /** * Dialog used for editing or adding file types. @@ -92,10 +93,7 @@ class AddFileTypeDialog extends JDialog { /** * Center the dialog. */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - int width = this.getSize().width; - int height = this.getSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); /** * Get the default or saved ingest job settings for this context and use diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypePanel.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypePanel.java index 71a745396c..7008f76ef9 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypePanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -105,7 +105,7 @@ class AddFileTypePanel extends javax.swing.JPanel { //if typeName does not equal sanitized typeName display message saying this name will be used instead if (typeName.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidMIMEType.message"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidMIMEType.title"), JOptionPane.ERROR_MESSAGE); @@ -114,7 +114,7 @@ class AddFileTypePanel extends javax.swing.JPanel { //if we need to remove more characters could use matches instead of contains and regex "[^\\w\s\\-\\/] to remove everything that isnt a letter, number, underscore, whitespace, dash, or forward slash. if (typeName.contains("\'")) { //remove single apostraphes as they are an easy way to accidently screw up PostgreSQL typeName = typeName.replaceAll("[\\']", ""); - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.containsIllegalCharacter.message", typeName), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.containsIllegalCharacter.title"), JOptionPane.WARNING_MESSAGE); @@ -125,7 +125,7 @@ class AddFileTypePanel extends javax.swing.JPanel { //if the MIME type has more than 2 parts the first part will be used as a media type and the remainder of the string as the sub-type String[] splitName = typeName.split("/"); if (splitName.length < 2 || splitName[0].isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.nonStandardMIMEType.message", typeName), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.nonStandardMIMEType.title"), JOptionPane.WARNING_MESSAGE); @@ -137,7 +137,7 @@ class AddFileTypePanel extends javax.swing.JPanel { //suggests a mime_type that will be the same after it is split appart and rejoined if (!StringUtils.join(ArrayUtils.subarray(splitName, 0, splitName.length), "/").equals(typeName)) { String rejoinedMimeType = StringUtils.join(ArrayUtils.subarray(splitName, 0, splitName.length), "/"); - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.nonStandardMIMEType.message", rejoinedMimeType), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "AddFileTypePanel.nonStandardMIMEType.title"), JOptionPane.WARNING_MESSAGE); @@ -145,7 +145,7 @@ class AddFileTypePanel extends javax.swing.JPanel { return null; } if (this.signaturesListModel.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, Bundle.AddMimeTypePanel_emptySigList_message(), Bundle.AddMimeTypePanel_emptySigList_title(), JOptionPane.ERROR_MESSAGE); @@ -159,7 +159,7 @@ class AddFileTypePanel extends javax.swing.JPanel { String setName = ""; if (this.postHitCheckBox.isSelected()) { if (this.setNameTextField.getText().isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, Bundle.AddMimeTypePanel_emptySetName_message(), Bundle.AddMimeTypePanel_emptySetName_title(), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java index 3d63742c2e..372c62769a 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java @@ -32,6 +32,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature; @@ -109,10 +110,7 @@ final class AddFileTypeSignatureDialog extends JDialog { /** * Center the dialog. */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - int width = this.getSize().width; - int height = this.getSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); /** * Get the default or saved ingest job settings for this context and use diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java index b38b04207e..69a6c8ffcc 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignaturePanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -106,7 +106,7 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { try { this.signatureTextField.setText(new String(toEdit.getSignatureBytes(), "UTF-8")); } catch (UnsupportedEncodingException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(), Bundle.AddFileTypeSignaturePanel_signatureStringFail_text(), JOptionPane.ERROR_MESSAGE); @@ -134,7 +134,7 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { String sigString = signatureTextField.getText(); if (sigString.isEmpty()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignature.message"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignature.title"), JOptionPane.ERROR_MESSAGE); @@ -147,7 +147,7 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { sigString = sigString.replaceAll("\\s", ""); //NON-NLS signatureBytes = DatatypeConverter.parseHexBinary(sigString); } catch (IllegalArgumentException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidRawSignatureBytes.message"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignatureBytes.title"), JOptionPane.ERROR_MESSAGE); @@ -166,14 +166,14 @@ class AddFileTypeSignaturePanel extends javax.swing.JPanel { try { offset = Long.parseUnsignedLong(offsetTextField.getText()); if (!isRelativeToStart && signatureBytes.length > offset + 1) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.length"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.title"), JOptionPane.ERROR_MESSAGE); return null; } } catch (NumberFormatException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.message"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileType.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileType.java index e0645bff40..281740d560 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileType.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileType.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-2015 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import java.util.Objects; import java.util.logging.Level; import javax.swing.JOptionPane; import javax.xml.bind.DatatypeConverter; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskCoreException; @@ -384,7 +385,7 @@ class FileType implements Serializable { try { signatureBytesString = new String(this.getSignatureBytes(), "UTF-8"); } catch (UnsupportedEncodingException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), ex.getLocalizedMessage(), Bundle.AddFileTypeSignaturePanel_signatureStringFail_text(), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java index 506e6ee33a..285482fb17 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdGlobalSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -207,7 +207,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane } } catch (CustomFileTypesException ex) { logger.log(Level.SEVERE, "Failed to get custom file types", ex); - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.loadFileTypes.errorMessage"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.loadFailed.title"), JOptionPane.ERROR_MESSAGE); @@ -263,7 +263,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane CustomFileTypesManager.getInstance().setUserDefinedFileTypes(fileTypes); } catch (CustomFileTypesManager.CustomFileTypesException ex) { logger.log(Level.SEVERE, "Failed to set custom file types", ex); - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.saveFileTypes.errorMessage"), NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.storeFailed.title"), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java index 5ec70ce3b9..e5e6a6e0ff 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import javax.swing.JOptionPane; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.util.actions.Presenter; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestManager; import static org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; @@ -150,7 +151,7 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter // don't let them add the hash for an empty file to the DB if (HashUtility.isNoDataMd5(md5Hash)) { //NON-NLS Logger.getLogger(AddContentToHashDbAction.class.getName()).log(Level.INFO, "Not adding " + file.getName() + " to database (empty content)"); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "AddContentToHashDbAction.addFilesToHashSet.unableToAddFileEmptyMsg", file.getName()), @@ -163,7 +164,7 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter hashSet.addHashes(file); } catch (TskCoreException ex) { Logger.getLogger(AddContentToHashDbAction.class.getName()).log(Level.SEVERE, "Error adding to hash database", ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "AddContentToHashDbAction.addFilesToHashSet.unableToAddFileMsg", file.getName()), @@ -172,7 +173,7 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter JOptionPane.ERROR_MESSAGE); } } else { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "AddContentToHashDbAction.addFilesToHashSet.unableToAddFileSzMsg", files.size() > 1 ? NbBundle diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java index 8087144d65..132bfb4d66 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,8 +18,6 @@ */ package org.sleuthkit.autopsy.modules.hashdatabase; -import java.awt.Dimension; -import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -59,8 +57,7 @@ public class AddHashValuesToDatabaseDialog extends javax.swing.JDialog { } private void display() { - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); setVisible(true); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java index f712a965fd..522e958530 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseProgressDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,8 +19,8 @@ package org.sleuthkit.autopsy.modules.hashdatabase; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; -import java.awt.Toolkit; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -61,7 +61,7 @@ public class AddHashValuesToDatabaseProgressDialog extends javax.swing.JDialog { AddHashValuesToDatabaseProgressDialog(AddHashValuesToDatabaseDialog parent, HashDb hashDb, String text) { super(parent); initComponents(); - display(); + display(parent); this.hashes = new ArrayList<>(); this.invalidHashes = new ArrayList<>(); this.md5Pattern = Pattern.compile("^[a-fA-F0-9]{32}$"); // NON-NLS @@ -70,9 +70,8 @@ public class AddHashValuesToDatabaseProgressDialog extends javax.swing.JDialog { this.text = text; } - private void display() { - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2); + private void display(Component parent) { + setLocationRelativeTo(parent); setVisible(true); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java index 701b2995a8..c06778cc44 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,8 +18,6 @@ */ package org.sleuthkit.autopsy.modules.hashdatabase; -import java.awt.Dimension; -import java.awt.Toolkit; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -121,8 +119,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog { } private void display() { - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); setVisible(true); } @@ -165,7 +162,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog { selectedOrg = orgs.get(0); } } catch (EamDbException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message()); + JOptionPane.showMessageDialog(this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message()); Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java index 0c5d94277b..c24e58c326 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 - 2013 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,8 +18,6 @@ */ package org.sleuthkit.autopsy.modules.hashdatabase; -import java.awt.Dimension; -import java.awt.Toolkit; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -93,8 +91,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { } private void display() { - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2); + setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); setVisible(true); } @@ -145,7 +142,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog { selectedOrg = orgs.get(0); } } catch (EamDbException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashDbImportDatabaseDialog_populateOrgsError_message()); + JOptionPane.showMessageDialog(this, Bundle.HashDbImportDatabaseDialog_populateOrgsError_message()); Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java index c032bdc83e..4fbf3f0c40 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 - 2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,6 +38,7 @@ import org.apache.commons.io.FilenameUtils; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; @@ -579,7 +580,7 @@ public class HashDbManager implements PropertyChangeListener { } } catch (TskCoreException ex) { Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error opening hash database", ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbManager.unableToOpenHashDbMsg", hashDbInfo.getHashSetName()), NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"), @@ -594,7 +595,7 @@ public class HashDbManager implements PropertyChangeListener { } catch (TskCoreException ex){ Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error opening hash database", ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.HashDbManager_centralRepoLoadError_message(), NbBundle.getMessage(this.getClass(), "HashDbManager.openHashDbErr"), JOptionPane.ERROR_MESSAGE); @@ -653,7 +654,7 @@ public class HashDbManager implements PropertyChangeListener { // Give the user an opportunity to find the desired file. String newPath = null; if (RuntimeProperties.runningWithGUI() && - JOptionPane.showConfirmDialog(null, + JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbManager.dlgMsg.dbNotFoundAtLoc", hashSetName, configuredPath), NbBundle.getMessage(this.getClass(), "HashDbManager.dlgTitle.MissingDb"), @@ -1415,7 +1416,7 @@ public class HashDbManager implements PropertyChangeListener { SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.getHandle()); } catch (TskCoreException ex) { Logger.getLogger(HashDbIndexer.class.getName()).log(Level.SEVERE, "Error indexing hash set " + hashDb.getHashSetName(), ex); //NON-NLS - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbManager.dlgMsg.errorIndexingHashSet", hashDb.getHashSetName()), diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java index ceecbe1d22..61c2fe699e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.datamodel.ContentUtils; import org.sleuthkit.autopsy.directorytree.HashSearchProvider; import org.sleuthkit.datamodel.AbstractFile; @@ -122,7 +123,7 @@ public class HashDbSearchAction extends CallableSystemAction implements HashSear if (file != null && HashDbSearcher.countFilesMd5Hashed() > 0) { doSearch(); } else { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbSearchAction.dlgMsg.noFilesHaveMD5Calculated"), NbBundle.getMessage(this.getClass(), "HashDbSearchAction.dlgMsg.title"), diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchManager.java index 00e8a9cc1b..2fb543c849 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchManager.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +28,7 @@ import org.openide.nodes.Children; import org.openide.nodes.Node; import org.openide.util.NbBundle; import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent; import org.sleuthkit.datamodel.AbstractFile; @@ -90,7 +91,7 @@ class HashDbSearchManager { searchResultWin.requestActive(); } else { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbSearchManager.noResultsFoundMsg")); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java index d02b05cd45..9f7642c69f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -297,7 +297,7 @@ class HashDbSearchPanel extends javax.swing.JPanel implements ActionListener { if (HashDbSearcher.countFilesMd5Hashed() > 0) { return doSearch(); } else { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(), "HashDbSearchPanel.noFilesHaveMD5HashMsg"), NbBundle.getMessage(this.getClass(), "HashDbSearchPanel.dlgMsg.title"), diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchThread.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchThread.java index 22af35d4cd..e356caf6d3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchThread.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbSearchThread.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +28,7 @@ import javax.swing.SwingWorker; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.Cancellable; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; @@ -101,7 +102,7 @@ class HashDbSearchThread extends SwingWorker { } } if (quit) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(this.getClass(), "HashDbSearchThread.noMoreFilesWithMD5Msg")); return; diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java index 948f18451d..b38820ee8b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettings.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 - 2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ import org.apache.commons.io.FileUtils; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; @@ -185,7 +186,7 @@ final class HashLookupSettings implements Serializable { } while (hashSetNames.contains(newHashSetName)); logger.log(Level.INFO, "Duplicate hash set name " + hashSetName + " found. Replacing with " + newHashSetName + "."); if (RuntimeProperties.runningWithGUI()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashLookupSettings.class, "HashDbManager.replacingDuplicateHashsetNameMsg", hashSetName, newHashSetName), @@ -251,7 +252,7 @@ final class HashLookupSettings implements Serializable { FileUtils.copyFile(new File(configFilePath), new File(backupFilePath)); logger.log(Level.INFO, "Updated the schema, backup saved at: " + backupFilePath); if (RuntimeProperties.runningWithGUI()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashLookupSettings.class, "HashDbManager.savedBackupOfOldConfigMsg", baseMessage, backupFilePath), @@ -260,7 +261,7 @@ final class HashLookupSettings implements Serializable { } } catch (IOException ex) { logger.log(Level.WARNING, "Failed to save backup of old format configuration file to " + backupFilePath, ex); //NON-NLS - JOptionPane.showMessageDialog(null, baseMessage, messageBoxTitle, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), baseMessage, messageBoxTitle, JOptionPane.INFORMATION_MESSAGE); } HashLookupSettings settings; settings = new HashLookupSettings(hashDbInfoList); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java index 1adb75594d..478e1550b6 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 - 2015 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -340,7 +340,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan hashSetManager.save(); } catch (HashDbManager.HashDbManagerException ex) { SwingUtilities.invokeLater(() -> { - JOptionPane.showMessageDialog(null, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE); }); } } @@ -388,7 +388,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan try { hashSetManager.removeHashDatabaseNoSave(hashDb); } catch (HashDbManager.HashDbManagerException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); + JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); } } hashSetTableModel.refreshModel(); @@ -432,7 +432,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan try { hashSetManager.save(); } catch (HashDbManager.HashDbManagerException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE); } } @@ -1000,7 +1000,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan @Messages({}) private void deleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDatabaseButtonActionPerformed - if (JOptionPane.showConfirmDialog(null, + if (JOptionPane.showConfirmDialog(this, NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.deleteDbActionConfirmMsg"), NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.deleteDbActionMsg"), @@ -1011,7 +1011,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan try { hashSetManager.removeHashDatabaseNoSave(hashDb); } catch (HashDbManager.HashDbManagerException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); + JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); } hashSetTableModel.refreshModel(); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); @@ -1026,7 +1026,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan try { hashSetManager.removeHashDatabaseNoSave(hashDb); } catch (HashDbManager.HashDbManagerException ex) { - JOptionPane.showMessageDialog(null, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); + JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName())); } hashSetTableModel.refreshModel(); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index c67051be97..45782f3730 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -411,7 +411,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, filterDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); + option = JOptionPane.showConfirmDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, filterDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition()); // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap. @@ -461,7 +461,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); + option = JOptionPane.showOptionDialog(this, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); @@ -1233,7 +1233,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp //if the file already exists ask the user how to proceed final String FILE_EXISTS_MESSAGE = NbBundle.getMessage(this.getClass(), "FilesSetDefsPanel.exportButtonActionPerformed.fileExistPrompt", selFile.getName()); - boolean shouldWrite = JOptionPane.showConfirmDialog(null, FILE_EXISTS_MESSAGE, FEATURE_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION; + boolean shouldWrite = JOptionPane.showConfirmDialog(this, FILE_EXISTS_MESSAGE, FEATURE_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION; if (!shouldWrite) { return; } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java index 0064b14f69..d08acea3a6 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerationPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -112,7 +112,7 @@ class ReportGenerationPanel extends javax.swing.JPanel { if (closeable) { actionListener.actionPerformed(null); } else { - int result = JOptionPane.showConfirmDialog(null, + int result = JOptionPane.showConfirmDialog(this, NbBundle.getMessage(this.getClass(), "ReportGenerationPanel.confDlg.sureToClose.msg"), NbBundle.getMessage(this.getClass(), @@ -215,7 +215,7 @@ class ReportGenerationPanel extends javax.swing.JPanel { private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed if (progressPanel.getStatus() == ReportStatus.QUEUING || progressPanel.getStatus() == ReportStatus.RUNNING) { - int result = JOptionPane.showConfirmDialog(null, NbBundle.getMessage(this.getClass(), + int result = JOptionPane.showConfirmDialog(this, NbBundle.getMessage(this.getClass(), "ReportGenerationPanel.confDlg.cancelReport.msg"), NbBundle.getMessage(this.getClass(), "ReportGenerationPanel.cancelButton.text"), diff --git a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java index 1de1db7eaa..70a0d79b11 100644 --- a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java +++ b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDb.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import javax.swing.JOptionPane; import javax.swing.JPanel; import org.openide.util.lookup.ServiceProvider; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb; @@ -96,14 +97,14 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule { failedExports.add(tag.getContent().getName()); } } else { - JOptionPane.showMessageDialog(null, "Unable to add the " + (tags.size() > 1 ? "files" : "file") + " to the hash database. Hashes have not been calculated. Please configure and run an appropriate ingest module.", "Add to Hash Database Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Unable to add the " + (tags.size() > 1 ? "files" : "file") + " to the hash database. Hashes have not been calculated. Please configure and run an appropriate ingest module.", "Add to Hash Database Error", JOptionPane.ERROR_MESSAGE); break; } } } } catch (TskCoreException ex) { Logger.getLogger(AddTaggedHashesToHashDb.class.getName()).log(Level.SEVERE, "Error adding to hash database", ex); - JOptionPane.showMessageDialog(null, "Error getting selected tags for case.", "Hash Export Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Error getting selected tags for case.", "Hash Export Error", JOptionPane.ERROR_MESSAGE); } } if (!failedExports.isEmpty()) { @@ -117,7 +118,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule { errorMessage.append("."); } } - JOptionPane.showMessageDialog(null, errorMessage.toString(), "Hash Export Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), errorMessage.toString(), "Hash Export Error", JOptionPane.ERROR_MESSAGE); } } progressPanel.setIndeterminate(false); diff --git a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java index 4dd665b890..be89b1ea96 100644 --- a/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/taggedhashes/AddTaggedHashesToHashDbConfigPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -70,7 +70,7 @@ class AddTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel { tagNames = Case.getCurrentCase().getServices().getTagsManager().getTagNamesInUse(); } catch (TskCoreException ex) { Logger.getLogger(AddTaggedHashesToHashDbConfigPanel.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); - JOptionPane.showMessageDialog(null, "Error getting tag names for case.", "Tag Names Not Found", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, "Error getting tag names for case.", "Tag Names Not Found", JOptionPane.ERROR_MESSAGE); } // Mark the tag names as unselected. Note that tagNameSelections is a @@ -299,7 +299,7 @@ class AddTaggedHashesToHashDbConfigPanel extends javax.swing.JPanel { private void configureHashDatabasesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configureHashDatabasesButtonActionPerformed HashLookupSettingsPanel configPanel = new HashLookupSettingsPanel(); configPanel.load(); - if (JOptionPane.showConfirmDialog(null, configPanel, "Hash Set Configuration", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { + if (JOptionPane.showConfirmDialog(this, configPanel, "Hash Set Configuration", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { configPanel.store(); populateHashSetComponents(); } else { diff --git a/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java b/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java index 04117963c7..d9226b587a 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/actions/SaveSnapshotAsReport.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014-16 Basis Technology Corp. + * Copyright 2014-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,6 +45,7 @@ import org.controlsfx.validation.ValidationResult; import org.controlsfx.validation.ValidationSupport; import org.controlsfx.validation.Validator; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.FileUtil; import org.sleuthkit.autopsy.coreutils.Logger; @@ -192,22 +193,22 @@ public class SaveSnapshotAsReport extends Action { try { Desktop.getDesktop().open(reportHTMLFIle.toFile()); } catch (IOException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.OpenReportAction_NoAssociatedEditorMessage(), Bundle.OpenReportAction_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (UnsupportedOperationException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.OpenReportAction_NoOpenInEditorSupportMessage(), Bundle.OpenReportAction_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (IllegalArgumentException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.OpenReportAction_MissingReportFileMessage(), Bundle.OpenReportAction_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); } catch (SecurityException ex) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.OpenReportAction_ReportFileOpenPermissionDeniedMessage(), Bundle.OpenReportAction_MessageBoxTitle(), JOptionPane.ERROR_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/db/EventsRepository.java b/Core/src/org/sleuthkit/autopsy/timeline/db/EventsRepository.java index 75c64fc5ef..78b15fc2af 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/db/EventsRepository.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/db/EventsRepository.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,6 +51,7 @@ import org.apache.commons.lang3.StringUtils; import org.joda.time.Interval; import org.netbeans.api.progress.ProgressHandle; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; @@ -95,7 +96,7 @@ import org.sleuthkit.datamodel.TskData; */ public class EventsRepository { - private final static Logger LOGGER = Logger.getLogger(EventsRepository.class.getName()); + private final static Logger logger = Logger.getLogger(EventsRepository.class.getName()); private final Executor workerExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("eventrepository-worker-%d").build()); //NON-NLS private DBPopulationWorker dbWorker; @@ -194,7 +195,7 @@ public class EventsRepository { try { return eventStripeCache.get(params); } catch (ExecutionException ex) { - LOGGER.log(Level.SEVERE, "Failed to load Event Stripes from cache for " + params.toString(), ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to load Event Stripes from cache for " + params.toString(), ex); //NON-NLS return Collections.emptyList(); } } @@ -302,7 +303,7 @@ public class EventsRepository { try { datasourcesMap.putIfAbsent(id, skCase.getContentById(id).getDataSource().getName()); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to get datasource by ID.", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to get datasource by ID.", ex); //NON-NLS } } @@ -310,7 +311,7 @@ public class EventsRepository { //should this only be tags applied to files or event bearing artifacts? tagNames.setAll(skCase.getTagNamesInUse()); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS } } @@ -337,7 +338,7 @@ public class EventsRepository { try { tagNames.setAll(autoCase.getSleuthkitCase().getTagNamesInUse()); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to get tag names in use.", ex); //NON-NLS } } @@ -407,7 +408,7 @@ public class EventsRepository { */ @ThreadConfined(type = ThreadConfined.ThreadType.JFX) private CancellationProgressTask rebuildRepository(final DBPopulationMode mode, Consumer onStateChange) { - LOGGER.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS + logger.log(Level.INFO, "(re)starting {0} db population task", mode); //NON-NLS if (dbWorker != null) { dbWorker.cancel(); } @@ -512,7 +513,7 @@ public class EventsRepository { if (dbPopulationMode == DBPopulationMode.FULL) { //drop old db, and add back MAC and artifact events - LOGGER.log(Level.INFO, "Beginning population of timeline db."); // NON-NLS + logger.log(Level.INFO, "Beginning population of timeline db."); // NON-NLS restartProgressHandle(Bundle.progressWindow_msg_gatheringData(), "", -1D, 1, true); //reset database //TODO: can we do more incremental updates? -jm eventDB.reInitializeDB(); @@ -529,23 +530,23 @@ public class EventsRepository { //tags if (dbPopulationMode == DBPopulationMode.TAGS_ONLY) { trans = eventDB.beginTransaction(); - LOGGER.log(Level.INFO, "dropping old tags"); // NON-NLS + logger.log(Level.INFO, "dropping old tags"); // NON-NLS eventDB.reInitializeTags(); } - LOGGER.log(Level.INFO, "updating content tags"); // NON-NLS + logger.log(Level.INFO, "updating content tags"); // NON-NLS List contentTags = tagsManager.getAllContentTags(); int currentWorkTotal = contentTags.size(); restartProgressHandle(Bundle.progressWindow_msg_refreshingFileTags(), "", 0D, currentWorkTotal, true); insertContentTags(currentWorkTotal, contentTags, trans); - LOGGER.log(Level.INFO, "updating artifact tags"); // NON-NLS + logger.log(Level.INFO, "updating artifact tags"); // NON-NLS List artifactTags = tagsManager.getAllBlackboardArtifactTags(); currentWorkTotal = artifactTags.size(); restartProgressHandle(Bundle.progressWindow_msg_refreshingResultTags(), "", 0D, currentWorkTotal, true); insertArtifactTags(currentWorkTotal, artifactTags, trans); - LOGGER.log(Level.INFO, "committing db"); // NON-NLS + logger.log(Level.INFO, "committing db"); // NON-NLS Platform.runLater(() -> cancellable.set(false)); restartProgressHandle(Bundle.progressWindow_msg_commitingDb(), "", -1D, 1, false); eventDB.commitTransaction(trans); @@ -609,14 +610,14 @@ public class EventsRepository { AbstractFile f = skCase.getAbstractFileById(fID); if (isNull(f)) { - LOGGER.log(Level.WARNING, "Failed to get data for file : {0}", fID); // NON-NLS + logger.log(Level.WARNING, "Failed to get data for file : {0}", fID); // NON-NLS } else { insertEventsForFile(f, trans); updateProgress(i, numFiles); updateMessage(f.getName()); } } catch (TskCoreException tskCoreException) { - LOGGER.log(Level.SEVERE, "Failed to insert MAC time events for file : " + fID, tskCoreException); // NON-NLS + logger.log(Level.SEVERE, "Failed to insert MAC time events for file : " + fID, tskCoreException); // NON-NLS } } } @@ -669,11 +670,11 @@ public class EventsRepository { try { get(); } catch (CancellationException ex) { - LOGGER.log(Level.WARNING, "Timeline database population was cancelled by the user. " //NON-NLS + logger.log(Level.WARNING, "Timeline database population was cancelled by the user. " //NON-NLS + " Not all events may be present or accurate."); // NON-NLS } catch (Exception ex) { - LOGGER.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS - JOptionPane.showMessageDialog(null, Bundle.msgdlg_problem_text()); + logger.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.msgdlg_problem_text()); } } @@ -696,11 +697,11 @@ public class EventsRepository { insertEventForArtifact(type, blackboardArtifacts.get(i), trans); updateProgress(i, numArtifacts); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "There was a problem inserting event for artifact: " + blackboardArtifacts.get(i).getArtifactID(), ex); // NON-NLS + logger.log(Level.SEVERE, "There was a problem inserting event for artifact: " + blackboardArtifacts.get(i).getArtifactID(), ex); // NON-NLS } } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "There was a problem getting events with sub type " + type.toString() + ".", ex); // NON-NLS + logger.log(Level.SEVERE, "There was a problem getting events with sub type " + type.toString() + ".", ex); // NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/countsview/EventCountsChart.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/countsview/EventCountsChart.java index 57a451893c..c7ea778f24 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/countsview/EventCountsChart.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/countsview/EventCountsChart.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,6 +45,7 @@ import org.joda.time.DateTime; import org.joda.time.Interval; import org.joda.time.Seconds; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.ColorUtilities; import org.sleuthkit.autopsy.timeline.TimeLineController; import org.sleuthkit.autopsy.timeline.ViewMode; @@ -394,7 +395,7 @@ final class EventCountsChart extends StackedBarChart implements controller.pushTimeRange(interval); } else { - int showConfirmDialog = JOptionPane.showConfirmDialog(null, + int showConfirmDialog = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), Bundle.CountsViewPane_detailSwitchMessage(), Bundle.CountsViewPane_detailSwitchTitle(), JOptionPane.YES_NO_OPTION); if (showConfirmDialog == JOptionPane.YES_OPTION) { diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java index 4413d948f4..ab1b44702c 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1422,7 +1422,7 @@ public final class FileExporterSettingsPanel extends JPanel { } populateRuleTree(ruleName); } else { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.RuleNotSaved"), NbBundle.getMessage(FileExporterSettingsPanel.class, "FileExporterSettingsPanel.MalformedRule"), JOptionPane.OK_OPTION); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java index 94f7d0fc39..85737799e9 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/AutoIngestSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015-2017 Basis Technology Corp. + * Copyright 2015-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -226,7 +226,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { if (needsRestart) { SwingUtilities.invokeLater(() -> { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(this, NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"), NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"), JOptionPane.WARNING_MESSAGE); @@ -530,7 +530,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { add(ingestJobSettingsPanel, BorderLayout.PAGE_START); - if (JOptionPane.showConfirmDialog(null, ingestJobSettingsPanel, "Ingest Module Configuration", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { + if (JOptionPane.showConfirmDialog(this, ingestJobSettingsPanel, "Ingest Module Configuration", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { // store the updated settings ingestJobSettings = ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); @@ -547,7 +547,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { for (String warning : warnings) { warningMessage.append(warning).append("\n"); } - JOptionPane.showMessageDialog(null, warningMessage.toString()); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), warningMessage.toString()); } } @@ -1082,7 +1082,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { private void bnAdvancedSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnAdvancedSettingsActionPerformed AdvancedAutoIngestSettingsPanel advancedAutoIngestSettingsPanel = new AdvancedAutoIngestSettingsPanel(getModeFromRadioButtons()); - if (JOptionPane.showConfirmDialog(null, advancedAutoIngestSettingsPanel, + if (JOptionPane.showConfirmDialog(this, advancedAutoIngestSettingsPanel, NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.AdvancedAutoIngestSettingsPanel.Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { advancedAutoIngestSettingsPanel.store(); @@ -1175,7 +1175,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { if (uploadResult == SharedConfiguration.SharedConfigResult.LOCKED) { jLabelTaskDescription.setText("Transfer of shared configuration incomplete"); - JOptionPane.showMessageDialog(null, "Shared configuration folder is currently locked by another node - try again in a few minutes", "Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Shared configuration folder is currently locked by another node - try again in a few minutes", "Error", JOptionPane.ERROR_MESSAGE); } else if (errorMessage != null) { //MessageNotifyUtil.Message.info(errorMessage); jLabelTaskDescription.setText("Transfer of shared configuration incomplete"); @@ -1186,7 +1186,7 @@ public class AutoIngestSettingsPanel extends javax.swing.JPanel { // Check if anything requiring a reset has changed and update the UI if (isResetNeeded()) { - JOptionPane.showMessageDialog(null, + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.MustRestart"), NbBundle.getMessage(AutoIngestSettingsPanel.class, "AutoIngestSettingsPanel.restartRequiredLabel.text"), JOptionPane.WARNING_MESSAGE); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java index 3f8b3aecd0..14944dff09 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-16 Basis Technology Corp. + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,6 +38,7 @@ import javax.swing.JOptionPane; import org.controlsfx.control.action.Action; import org.controlsfx.control.action.ActionUtils; import org.openide.util.NbBundle; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.datamodel.DhsImageCategory; @@ -56,7 +57,7 @@ import org.sleuthkit.datamodel.TskCoreException; @NbBundle.Messages({"CategorizeAction.displayName=Categorize"}) public class CategorizeAction extends Action { - private static final Logger LOGGER = Logger.getLogger(CategorizeAction.class.getName()); + private static final Logger logger = Logger.getLogger(CategorizeAction.class.getName()); private final ImageGalleryController controller; private final UndoRedoManager undoManager; @@ -155,7 +156,7 @@ public class CategorizeAction extends Action { try { tagsManager.deleteContentTag(ct); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error removing old categories result", ex); //NON-NLS + logger.log(Level.SEVERE, "Error removing old categories result", ex); //NON-NLS } }); } else { @@ -168,8 +169,8 @@ public class CategorizeAction extends Action { } } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error categorizing result", ex); //NON-NLS - JOptionPane.showMessageDialog(null, + logger.log(Level.SEVERE, "Error categorizing result", ex); //NON-NLS + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.CategorizeTask_errorUnable_msg(fileID), Bundle.CategorizeTask_errorUnable_title(), JOptionPane.ERROR_MESSAGE); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java index 862635ad4a..c5701d7dad 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -103,7 +103,7 @@ final class GlobalListSettingsPanel extends javax.swing.JPanel implements Option keywords.addAll(currentKeywordList.getKeywords()); String listName = (String) JOptionPane.showInputDialog( - null, + this, NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"), FEATURE_NAME, JOptionPane.PLAIN_MESSAGE, diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java index 6aae71be33..403ba84929 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/GlobalListsManagementPanel.java @@ -113,7 +113,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa XmlKeywordSearchList writer = XmlKeywordSearchList.getCurrent(); String listName = ""; - listName = (String) JOptionPane.showInputDialog(null, NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"), + listName = (String) JOptionPane.showInputDialog(this, NbBundle.getMessage(this.getClass(), "KeywordSearch.newKwListTitle"), NbBundle.getMessage(this.getClass(), "KeywordSearch.newKeywordListMsg"), JOptionPane.PLAIN_MESSAGE, null, null, listName); if (listName == null || listName.trim().isEmpty()) { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java index cb272811b1..b976733dc5 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchUtil.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -120,7 +120,7 @@ class KeywordSearchUtil { } else { messageType = JOptionPane.INFORMATION_MESSAGE; } - if (JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION, messageType) == JOptionPane.YES_OPTION) { + if (JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), message, title, JOptionPane.YES_NO_OPTION, messageType) == JOptionPane.YES_OPTION) { return true; } else { return false;