diff --git a/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties b/Core/src/org/sleuthkit/autopsy/timeline/Bundle.properties index 6ea7e7bdc76156088c10405906393a851ca838a0..1177561ad0032319f7de5145832ef551792fb8a0 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 8a56da573d4a1b7807f316046848b772e266dd47..397abea1b44f5d3593e814bc13e28246c949869d 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form +++ b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.form @@ -53,8 +53,11 @@ </Component> <Component class="javax.swing.JLabel" name="progressHeader"> <Properties> - <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="[0, 14]"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/sleuthkit/autopsy/timeline/Bundle.properties" key="ProgressWindow.progressHeader.text" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[10, 14]"/> </Property> </Properties> </Component> diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java b/Core/src/org/sleuthkit/autopsy/timeline/ProgressWindow.java index 51af12e9e5101237c1dfe5124c08048344579c99..8f784263bef65bf1f145447814cda803bfb4da3e 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.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 ProgressWindow(Component parent, boolean modal, SwingWorker<?, ?> worker) 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 void actionPerformed(ActionEvent e) { 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 void windowClosing(java.awt.event.WindowEvent evt) { } }); - 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 void close() { 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 b09aa42a5b9e04fdd91dbe9f3f9b577db2f2e577..c354a6a7bde44b8124d1b7213df546c7b093bb7b 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 835c486c64c96972ca54f7edcc7b8025d130ce0e..9118aca4b7a2a1842beb2997d64c9bf691931d21 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 DBPopulationWorker(Runnable r) { @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 @@ protected Void doInBackground() throws Exception { List<Long> 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 @@ protected Void doInBackground() throws Exception { } 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 @@ 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.commitingDb"), ""))); if (isCancelled()) { eventDB.rollBackTransaction(trans); @@ -359,11 +359,11 @@ protected void done() { 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 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa 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 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa i++; process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numArtifacts, - NbBundle.getMessage(this.getClass(), + NbBundle.getMessage(EventsRepository.class, "EventsRepository.progressWindow.populatingXevents", type.toString()), ""))); }