Mercurial > hg > release > thermostat-2.0
changeset 2316:40a4877bd19f
Send a message to user if profiling cannot start
Previously if profiling failed to start, thermostat wouldn't provide the user
with any message and would simply disable profiling. This patch fixes that.
Reviewed-by: aazores, jkang, neugens
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-May/018952.html
author | Joshua Matsuoka <jmatsuok@redhat.com> |
---|---|
date | Thu, 26 May 2016 14:49:48 -0400 |
parents | 0f94f0744d94 |
children | bdf4f37e105a |
files | vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/LocaleResources.java vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/SwingVmProfileView.java vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileController.java vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileView.java vm-profiler/client-swing/src/main/resources/com/redhat/thermostat/vm/profiler/client/swing/internal/strings.properties |
diffstat | 5 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/LocaleResources.java Thu May 26 13:28:49 2016 -0400 +++ b/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/LocaleResources.java Thu May 26 14:49:48 2016 -0400 @@ -61,6 +61,8 @@ PROFILER_RESULTS_TIME, PROFILER_NO_RESULTS, + PROFILER_ERROR, + ERROR_HEADER ; static final String RESOURCE_BUNDLE = "com.redhat.thermostat.vm.profiler.client.swing.internal.strings";
--- a/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/SwingVmProfileView.java Thu May 26 13:28:49 2016 -0400 +++ b/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/SwingVmProfileView.java Thu May 26 14:49:48 2016 -0400 @@ -54,6 +54,7 @@ import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; +import javax.swing.JOptionPane; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; @@ -457,6 +458,11 @@ }); } + public void displayErrorMessage(final LocalizedString message) { + JOptionPane.showMessageDialog(this.getUiComponent(), message.getContents(), + translator.localize(LocaleResources.ERROR_HEADER).getContents(), JOptionPane.ERROR_MESSAGE); + } + @Override public void addTabToTabbedPane(final LocalizedString title, final Component component) { SwingUtilities.invokeLater(new Runnable() {
--- a/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileController.java Thu May 26 13:28:49 2016 -0400 +++ b/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileController.java Thu May 26 14:49:48 2016 -0400 @@ -273,8 +273,7 @@ updateViewWithCurrentProfilingStatus(); break; default: - // FIXME show message to user - + view.displayErrorMessage(translator.localize(LocaleResources.PROFILER_ERROR)); hideProgressNotificationIfVisible(); profilingStartOrStopRequested = false; profilingState = ProfilingState.DISABLED;
--- a/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileView.java Thu May 26 13:28:49 2016 -0400 +++ b/vm-profiler/client-swing/src/main/java/com/redhat/thermostat/vm/profiler/client/swing/internal/VmProfileView.java Thu May 26 14:49:48 2016 -0400 @@ -149,4 +149,6 @@ public abstract void addTabToTabbedPane(final LocalizedString title, final Component component); + public abstract void displayErrorMessage(final LocalizedString message); + }
--- a/vm-profiler/client-swing/src/main/resources/com/redhat/thermostat/vm/profiler/client/swing/internal/strings.properties Thu May 26 13:28:49 2016 -0400 +++ b/vm-profiler/client-swing/src/main/resources/com/redhat/thermostat/vm/profiler/client/swing/internal/strings.properties Thu May 26 14:49:48 2016 -0400 @@ -21,3 +21,5 @@ PROFILER_RESULTS_TIME = Total Time ({0}) PROFILER_NO_RESULTS = No profiling data available +PROFILER_ERROR = Cannot start profiling. Check that this is a valid VM and that you are not already profiling this VM. +ERROR_HEADER = Error