aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-05-16 00:18:22 (EDT)
committerPatrick Tasse2013-05-16 10:50:58 (EDT)
commit65482f2b5046748acce364ecb16697aad06cbef1 (patch)
treea8c5d02265d20e19acbab10203345acd818f5d4b
parent45de65fcde619b3f8edb48eab6e49e5d87d22ba2 (diff)
downloadorg.eclipse.linuxtools-65482f2b5046748acce364ecb16697aad06cbef1.zip
org.eclipse.linuxtools-65482f2b5046748acce364ecb16697aad06cbef1.tar.gz
org.eclipse.linuxtools-65482f2b5046748acce364ecb16697aad06cbef1.tar.bz2
Fix IllegalArgumentException in Colors viewrefs/changes/56/12856/2
The return value of ColorDialog.getRGB can return null. Bug: 408074 Change-Id: I40277621ba3e63b610e1ad2e012263850c74f26e Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/12856 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java
index eabe4ff..436af2d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/colors/ColorsView.java
@@ -41,6 +41,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -443,9 +444,12 @@ public class ColorsView extends TmfView {
dialog.setRGB(colorSetting.getForegroundRGB());
dialog.setText(Messages.ColorsView_ForegroundDialogText);
dialog.open();
- colorSetting.setForegroundRGB(dialog.getRGB());
- ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
- label.setForeground(colorSetting.getForegroundColor());
+ RGB rgb = dialog.getRGB();
+ if (rgb != null) {
+ colorSetting.setForegroundRGB(rgb);
+ ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
+ label.setForeground(colorSetting.getForegroundColor());
+ }
}});
bgButton.addSelectionListener(new SelectionAdapter() {
@@ -457,10 +461,13 @@ public class ColorsView extends TmfView {
dialog.setRGB(colorSetting.getBackgroundRGB());
dialog.setText(Messages.ColorsView_BackgroundDialogText);
dialog.open();
- colorSetting.setBackgroundRGB(dialog.getRGB());
- ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
- labelComposite.setBackground(colorSetting.getBackgroundColor());
- label.setBackground(colorSetting.getBackgroundColor());
+ RGB rgb = dialog.getRGB();
+ if (rgb != null) {
+ colorSetting.setBackgroundRGB(rgb);
+ ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
+ labelComposite.setBackground(colorSetting.getBackgroundColor());
+ label.setBackground(colorSetting.getBackgroundColor());
+ }
}});
final Button tickButton = new Button(this, SWT.PUSH);
@@ -499,9 +506,12 @@ public class ColorsView extends TmfView {
dialog.setRGB(colorSetting.getTickColorRGB());
dialog.setText(Messages.TickColorDialog_TickColorDialogTitle);
dialog.open();
- colorSetting.setTickColorRGB(dialog.getRGB());
- ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
- refresh();
+ RGB rgb = dialog.getRGB();
+ if (rgb != null) {
+ colorSetting.setTickColorRGB(rgb);
+ ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
+ refresh();
+ }
}});
final Button filterButton = new Button(this, SWT.PUSH);