Skip to content
Snippets Groups Projects
Commit 572fc50b authored by jmillman's avatar jmillman
Browse files

move properties to NbBundle.messages annotation and out of Bundle.properties

parent b7ca5038
No related branches found
No related tags found
No related merge requests found
...@@ -29,3 +29,4 @@ TimeLineTopComponent.filterTab.name=Filters ...@@ -29,3 +29,4 @@ TimeLineTopComponent.filterTab.name=Filters
OpenTimelineAction.title=Timeline OpenTimelineAction.title=Timeline
OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources. OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources.
TimeLineTopComponent.timeZonePanel.text=Display Times In\: TimeLineTopComponent.timeZonePanel.text=Display Times In\:
ProgressWindow.progressHeader.text=\
...@@ -53,8 +53,11 @@ ...@@ -53,8 +53,11 @@
</Component> </Component>
<Component class="javax.swing.JLabel" name="progressHeader"> <Component class="javax.swing.JLabel" name="progressHeader">
<Properties> <Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<Dimension value="[0, 14]"/> <ResourceString bundle="org/sleuthkit/autopsy/timeline/Bundle.properties" key="ProgressWindow.progressHeader.text" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[10, 14]"/>
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
......
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import static org.sleuthkit.autopsy.timeline.Bundle.Timeline_progressWindow_name; import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import static org.sleuthkit.autopsy.timeline.Bundle.Timeline_progressWindow_title;
/** /**
* Dialog with progress bar that pops up when timeline is being generated * Dialog with progress bar that pops up when timeline is being generated
...@@ -61,8 +60,8 @@ public ProgressWindow(Component parent, boolean modal, SwingWorker<?, ?> worker) ...@@ -61,8 +60,8 @@ public ProgressWindow(Component parent, boolean modal, SwingWorker<?, ?> worker)
setIconImage(WindowManager.getDefault().getMainWindow().getIconImage()); setIconImage(WindowManager.getDefault().getMainWindow().getIconImage());
}); });
setName(Timeline_progressWindow_name()); setName(Bundle.Timeline_progressWindow_name());
setTitle(Timeline_progressWindow_title()); setTitle(Bundle.Timeline_progressWindow_title());
// Close the dialog when Esc is pressed // Close the dialog when Esc is pressed
String cancelName = "cancel"; // NON-NLS String cancelName = "cancel"; // NON-NLS
InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
...@@ -79,46 +78,6 @@ public void actionPerformed(ActionEvent e) { ...@@ -79,46 +78,6 @@ public void actionPerformed(ActionEvent e) {
this.worker = worker; 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. * 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 * 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) { ...@@ -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()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
...@@ -200,14 +160,19 @@ public void close() { ...@@ -200,14 +160,19 @@ public void close() {
private javax.swing.JLabel progressHeader; private javax.swing.JLabel progressHeader;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
public void update(ProgressUpdate chunk) { public void update(ProgressUpdate chunk) {
updateHeaderMessage(chunk.getHeaderMessage()); progressHeader.setText(chunk.getHeaderMessage());
if (chunk.getTotal() >= 0) { if (chunk.getTotal() >= 0) {
setProgressTotal(chunk.getTotal()); progressBar.setIndeterminate(false);
updateProgress(chunk.getProgress(), chunk.getDetailMessage()); progressBar.setMaximum(chunk.getTotal());
progressBar.setStringPainted(true);
progressBar.setValue(chunk.getProgress());
progressBar.setString(chunk.getDetailMessage());
} else { } else {
setIndeterminate(); progressBar.setIndeterminate(true);
updateProgress(chunk.getDetailMessage()); progressBar.setStringPainted(true);
progressBar.setString(chunk.getDetailMessage());
} }
} }
......
EventsRepository.progressWindow.msg.reinit_db=(re)initializing events database EventsRepository.progressWindow.msg.reinit_db=(re)initializing events database
EventsRepository.progressWindow.msg.populateMacEventsFiles=populating mac events for files\: 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.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.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 EventsRepository.progressWindow.populatingXevents=populating {0} events
\ No newline at end of file
...@@ -244,7 +244,7 @@ public DBPopulationWorker(Runnable r) { ...@@ -244,7 +244,7 @@ public DBPopulationWorker(Runnable r) {
@Override @Override
protected Void doInBackground() throws Exception { 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"), ""))); "EventsRepository.progressWindow.msg.reinit_db"), "")));
//reset database //reset database
//TODO: can we do more incremental updates? -jm //TODO: can we do more incremental updates? -jm
...@@ -256,8 +256,8 @@ protected Void doInBackground() throws Exception { ...@@ -256,8 +256,8 @@ protected Void doInBackground() throws Exception {
List<Long> files = skCase.findAllFileIdsWhere("name != '.' AND name != '..'"); List<Long> files = skCase.findAllFileIdsWhere("name != '.' AND name != '..'");
final int numFiles = files.size(); final int numFiles = files.size();
process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, numFiles, NbBundle.getMessage(this.getClass(), publish(new ProgressWindow.ProgressUpdate(0, numFiles, NbBundle.getMessage(EventsRepository.class,
"EventsRepository.progressWindow.msg.populateMacEventsFiles"), ""))); "EventsRepository.progressWindow.msg.populateMacEventsFiles"), ""));
//insert file events into db //insert file events into db
int i = 1; int i = 1;
...@@ -298,8 +298,8 @@ protected Void doInBackground() throws Exception { ...@@ -298,8 +298,8 @@ protected Void doInBackground() throws Exception {
} }
process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numFiles, process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numFiles,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(EventsRepository.class,
"EventsRepository.progressWindow.msg.populateMacEventsFiles2"), f.getName()))); "EventsRepository.progressWindow.msg.populateMacEventsFiles"), f.getName())));
} else { } else {
LOGGER.log(Level.WARNING, "failed to look up data for file : {0}", fID); // NON-NLS LOGGER.log(Level.WARNING, "failed to look up data for file : {0}", fID); // NON-NLS
} }
...@@ -322,7 +322,7 @@ protected Void doInBackground() throws Exception { ...@@ -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"), ""))); "EventsRepository.progressWindow.msg.commitingDb"), "")));
if (isCancelled()) { if (isCancelled()) {
eventDB.rollBackTransaction(trans); eventDB.rollBackTransaction(trans);
...@@ -359,11 +359,11 @@ protected void done() { ...@@ -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 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) { } catch (InterruptedException | ExecutionException ex) {
LOGGER.log(Level.WARNING, "Exception while populating database.", ex); // NON-NLS 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")); "EventsRepository.msgdlg.problem.text"));
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.log(Level.WARNING, "Unexpected exception while populating database.", ex); // NON-NLS 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")); "EventsRepository.msgdlg.problem.text"));
} }
r.run(); //execute post db population operation r.run(); //execute post db population operation
...@@ -383,7 +383,7 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa ...@@ -383,7 +383,7 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa
final int numArtifacts = blackboardArtifacts.size(); final int numArtifacts = blackboardArtifacts.size();
process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, numArtifacts, process(Arrays.asList(new ProgressWindow.ProgressUpdate(0, numArtifacts,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(EventsRepository.class,
"EventsRepository.progressWindow.populatingXevents", "EventsRepository.progressWindow.populatingXevents",
type.toString()), ""))); type.toString()), "")));
...@@ -403,7 +403,7 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa ...@@ -403,7 +403,7 @@ private void populateEventType(final ArtifactEventType type, EventDB.EventTransa
i++; i++;
process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numArtifacts, process(Arrays.asList(new ProgressWindow.ProgressUpdate(i, numArtifacts,
NbBundle.getMessage(this.getClass(), NbBundle.getMessage(EventsRepository.class,
"EventsRepository.progressWindow.populatingXevents", "EventsRepository.progressWindow.populatingXevents",
type.toString()), ""))); type.toString()), "")));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment