Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Gabel2016-07-06 07:49:36 +0000
committerGerrit Code Review @ Eclipse.org2016-07-06 09:27:22 +0000
commitf2ee67595fc73d09ac839f2ede726605832e76b9 (patch)
tree663eae89afccf9c29312f2aa3e8954d464ad9eef /plugins/infra/ui
parentbebefef7da3db7d05c0042778211be4e9320edd5 (diff)
downloadorg.eclipse.papyrus-f2ee67595fc73d09ac839f2ede726605832e76b9.tar.gz
org.eclipse.papyrus-f2ee67595fc73d09ac839f2ede726605832e76b9.tar.xz
org.eclipse.papyrus-f2ee67595fc73d09ac839f2ede726605832e76b9.zip
Bug 497361: [Properties] Possibility to customize labels of BooleanRadio
editors trueLabel and falseLabel attibutes can be added in XWT declaration to override the default (true, false) labels. Change-Id: I2ddb694c87961846cc34184d5293eef281edc080 Signed-off-by: Sebastien Gabel <sebastien.gabel@esterel-technologies.com>
Diffstat (limited to 'plugins/infra/ui')
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BooleanRadio.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BooleanRadio.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BooleanRadio.java
index 9b9ba41f4f9..4d41924d58c 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BooleanRadio.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BooleanRadio.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2016 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,8 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Thibault Le Ouay t.leouay@sherpa-eng.com - Add binding implementation
+ * Sebastien Gabel (Esterel Technologies SAS) - Bug 497361
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.widgets.editors;
@@ -84,10 +86,15 @@ public class BooleanRadio extends AbstractValueEditor {
setWidgetObservable(getObservable(), true);
controlDecoration = new ControlDecoration(trueRadio, SWT.TOP | SWT.LEFT);
- GridData gridData = new GridData();
- trueRadio.setLayoutData(gridData);
- falseRadio.setLayoutData(gridData);
- gridData.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+
+ // Use a dedicated grid data for each radio, otherwise one of the two labels may be truncated.
+ GridData trueGd = new GridData();
+ trueGd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ trueRadio.setLayoutData(trueGd);
+
+ GridData falseGd = new GridData();
+ falseGd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ falseRadio.setLayoutData(falseGd);
}
/**
@@ -141,4 +148,19 @@ public class BooleanRadio extends AbstractValueEditor {
super.setLabelToolTipText(text);
}
+ public void setTrueLabel(String label) {
+ trueRadio.setText(label);
+ }
+
+ public String getTrueLabel() {
+ return trueRadio.getText();
+ }
+
+ public void setFalseLabel(String label) {
+ falseRadio.setText(label);
+ }
+
+ public String getFalseLabel() {
+ return falseRadio.getText();
+ }
}

Back to the top