diff --git a/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties b/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties index 6ea7e7bdc7..1177561ad0 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties @@ -29,3 +29,4 @@ TimeLineTopComponent.filterTab.name=Filters OpenTimelineAction.title=Timeline OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources. TimeLineTopComponent.timeZonePanel.text=Display Times In\: +ProgressWindow.progressHeader.text=\ diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form index 8a56da573d..397abea1b4 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form +++ b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form @@ -53,8 +53,11 @@ - - + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java index 51af12e9e5..8f784263be 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java @@ -33,8 +33,7 @@ import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; -import static org.sleuthkit.autopsy.timeline.Bundle.Timeline_progressWindow_name; -import static org.sleuthkit.autopsy.timeline.Bundle.Timeline_progressWindow_title; +import org.sleuthkit.autopsy.coreutils.ThreadConfined; /** * Dialog with progress bar that pops up when timeline is being generated @@ -61,8 +60,8 @@ public class ProgressWindow extends JFrame { setIconImage(WindowManager.getDefault().getMainWindow().getIconImage()); }); - setName(Timeline_progressWindow_name()); - setTitle(Timeline_progressWindow_title()); + setName(Bundle.Timeline_progressWindow_name()); + setTitle(Bundle.Timeline_progressWindow_title()); // Close the dialog when Esc is pressed String cancelName = "cancel"; // NON-NLS InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); @@ -79,46 +78,6 @@ public class ProgressWindow extends JFrame { this.worker = worker; } - public void updateProgress(final int progress) { - SwingUtilities.invokeLater(() -> { - progressBar.setValue(progress); - }); - } - - public void updateProgress(final int progress, final String message) { - SwingUtilities.invokeLater(() -> { - progressBar.setValue(progress); - progressBar.setString(message); - }); - } - - public void updateProgress(final String message) { - SwingUtilities.invokeLater(() -> { - progressBar.setString(message); - }); - } - - public void setProgressTotal(final int total) { - SwingUtilities.invokeLater(() -> { - progressBar.setIndeterminate(false); - progressBar.setMaximum(total); - progressBar.setStringPainted(true); - }); - } - - public void updateHeaderMessage(final String headerMessage) { - SwingUtilities.invokeLater(() -> { - progressHeader.setText(headerMessage); - }); - } - - public void setIndeterminate() { - SwingUtilities.invokeLater(() -> { - progressBar.setIndeterminate(true); - progressBar.setStringPainted(true); - }); - } - /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -137,7 +96,8 @@ public class ProgressWindow extends JFrame { } }); - progressHeader.setPreferredSize(new java.awt.Dimension(0, 14)); + org.openide.awt.Mnemonics.setLocalizedText(progressHeader, NbBundle.getMessage(ProgressWindow.class, "ProgressWindow.progressHeader.text")); // NOI18N + progressHeader.setMinimumSize(new java.awt.Dimension(10, 14)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -200,14 +160,19 @@ public class ProgressWindow extends JFrame { private javax.swing.JLabel progressHeader; // End of variables declaration//GEN-END:variables + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) public void update(ProgressUpdate chunk) { - updateHeaderMessage(chunk.getHeaderMessage()); + progressHeader.setText(chunk.getHeaderMessage()); if (chunk.getTotal() >= 0) { - setProgressTotal(chunk.getTotal()); - updateProgress(chunk.getProgress(), chunk.getDetailMessage()); + progressBar.setIndeterminate(false); + progressBar.setMaximum(chunk.getTotal()); + progressBar.setStringPainted(true); + progressBar.setValue(chunk.getProgress()); + progressBar.setString(chunk.getDetailMessage()); } else { - setIndeterminate(); - updateProgress(chunk.getDetailMessage()); + progressBar.setIndeterminate(true); + progressBar.setStringPainted(true); + progressBar.setString(chunk.getDetailMessage()); } } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/events/db/Bundle.properties b/Core/src/org/sleuthkit/autopsy/timeline/events/db/Bundle.properties index b09aa42a5b..c354a6a7bd 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/events/db/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/timeline/events/db/Bundle.properties @@ -1,6 +1,5 @@ EventsRepository.progressWindow.msg.reinit_db=(re)initializing events database EventsRepository.progressWindow.msg.populateMacEventsFiles=populating mac events for files\: -EventsRepository.progressWindow.msg.populateMacEventsFiles2=populating mac events for files\: EventsRepository.progressWindow.msg.commitingDb=committing events db EventsRepository.msgdlg.problem.text=There was a problem populating the timeline. Not all events may be present or accurate. See the log for details. EventsRepository.progressWindow.populatingXevents=populating {0} events \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/timeline/events/db/EventsRepository.java b/Core/src/org/sleuthkit/autopsy/timeline/events/db/EventsRepository.java index 835c486c64..9118aca4b7 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/events/db/EventsRepository.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/events/db/EventsRepository.java @@ -244,7 +244,7 @@ public class EventsRepository { @Override protected Void doInBackground() throws Exception { - process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, -1, NbBundle.getMessage(this.getClass(), + process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, -1, NbBundle.getMessage(EventsRepository.class, "EventsRepository.progressWindow.msg.reinit_db"), ""))); //reset database //TODO: can we do more incremental updates? -jm @@ -256,8 +256,8 @@ public class EventsRepository { List files = skCase.findAllFileIdsWhere("name != '.' AND name != '..'"); final int numFiles = files.size(); - process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, numFiles, NbBundle.getMessage(this.getClass(), - "EventsRepository.progressWindow.msg.populateMacEventsFiles"), ""))); + publish(new ProgressWindow.ProgressUpdate(0, numFiles, NbBundle.getMessage(EventsRepository.class, + "EventsRepository.progressWindow.msg.populateMacEventsFiles"), "")); //insert file events into db int i = 1; @@ -298,8 +298,8 @@ public class EventsRepository { } process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numFiles, - NbBundle.getMessage(this.getClass(), - "EventsRepository.progressWindow.msg.populateMacEventsFiles2"), f.getName()))); + NbBundle.getMessage(EventsRepository.class, + "EventsRepository.progressWindow.msg.populateMacEventsFiles"), f.getName()))); } else { LOGGER.log(Level.WARNING, "failed to look up data for file : {0}", fID); // NON-NLS } @@ -322,7 +322,7 @@ public class EventsRepository { } } - process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, -1, NbBundle.getMessage(this.getClass(), + process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, -1, NbBundle.getMessage(EventsRepository.class, "EventsRepository.progressWindow.msg.commitingDb"), ""))); if (isCancelled()) { eventDB.rollBackTransaction(trans); @@ -359,11 +359,11 @@ public class EventsRepository { LOGGER.log(Level.INFO, "Database population was cancelled by the user. Not all events may be present or accurate. See the log for details.", ex); // NON-NLS } catch (InterruptedException | ExecutionException ex) { LOGGER.log(Level.WARNING, "Exception while populating database.", ex); // NON-NLS - JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), + JOptionPane.showMessageDialog(null, NbBundle.getMessage(EventsRepository.class, "EventsRepository.msgdlg.problem.text")); } catch (Exception ex) { LOGGER.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS - JOptionPane.showMessageDialog(null, NbBundle.getMessage(this.getClass(), + JOptionPane.showMessageDialog(null, NbBundle.getMessage(EventsRepository.class, "EventsRepository.msgdlg.problem.text")); } r.run(); //execute post db population operation @@ -383,7 +383,7 @@ public class EventsRepository { final int numArtifacts = blackboardArtifacts.size(); process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, numArtifacts, - NbBundle.getMessage(this.getClass(), + NbBundle.getMessage(EventsRepository.class, "EventsRepository.progressWindow.populatingXevents", type.toString()), ""))); @@ -403,7 +403,7 @@ public class EventsRepository { i++; process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numArtifacts, - NbBundle.getMessage(this.getClass(), + NbBundle.getMessage(EventsRepository.class, "EventsRepository.progressWindow.populatingXevents", type.toString()), ""))); }