Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-07-05 16:11:14 +0000
committercletavernie2013-07-05 16:11:14 +0000
commitc1fe18794ba1f3767f509828a7b3088fe3f406ad (patch)
treeabdd1f1de42667ad13938101d595c6b30940aa82 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences
parent0a0316b75687f185c7afba1a1b6afaf00ce35115 (diff)
downloadorg.eclipse.papyrus-c1fe18794ba1f3767f509828a7b3088fe3f406ad.tar.gz
org.eclipse.papyrus-c1fe18794ba1f3767f509828a7b3088fe3f406ad.tar.xz
org.eclipse.papyrus-c1fe18794ba1f3767f509828a7b3088fe3f406ad.zip
319956: [Palette] Problem when adding applied stereotype in an aspect action
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319956
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
index 82b6f449e48..51eed9f1653 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java
@@ -85,6 +85,7 @@ public class ColorFieldEditor extends FieldEditor {
colorButton.setLayoutData(new GridData());
colorButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
changeColors(colorButton);
}
@@ -114,10 +115,18 @@ public class ColorFieldEditor extends FieldEditor {
@Override
protected void doStore() {
if(colorSelector != null) {
- PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), colorSelector.getSelectedColor());
+ RGB color = colorSelector.getSelectedColor();
+ if(color == null) {
+ color = getDefaultColor();
+ }
+ PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), color);
}
}
+ private RGB getDefaultColor() {
+ return PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName());
+ }
+
@Override
public int getNumberOfControls() {
return 1;
@@ -134,7 +143,12 @@ public class ColorFieldEditor extends FieldEditor {
if(colorSelector.getSelectedColor() == null && !colorSelector.useDefaultColor()) {
return;
}
- updateButtonImage(colorSelector.getSelectedColor());
+
+ if(colorSelector.useDefaultColor()) {
+ updateButtonImage(getDefaultColor());
+ } else {
+ updateButtonImage(colorSelector.getSelectedColor());
+ }
}
@@ -173,6 +187,7 @@ public class ColorFieldEditor extends FieldEditor {
/**
* @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int)
*/
+ @Override
protected void drawCompositeImage(int width, int height) {
// draw the thin color bar underneath
@@ -190,6 +205,7 @@ public class ColorFieldEditor extends FieldEditor {
/**
* @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize()
*/
+ @Override
protected Point getSize() {
return ICON_SIZE;
}

Back to the top