Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincent lorenzo2015-01-23 10:30:35 -0500
committerGerrit Code Review @ Eclipse.org2015-01-23 10:30:35 -0500
commite35d4ec66478b5ad8e8f2502f6940f990bab7827 (patch)
treeb237680b2ac8475d7c38fde806e8f04c7b0c9d9f /plugins
parentf8a778bc39a076cc91675dd30a6c4309c5d6dd74 (diff)
parent11e2c7bff4331d84f9d52d4843b1438aaf16e99f (diff)
downloadorg.eclipse.papyrus-e35d4ec66478b5ad8e8f2502f6940f990bab7827.tar.gz
org.eclipse.papyrus-e35d4ec66478b5ad8e8f2502f6940f990bab7827.tar.xz
org.eclipse.papyrus-e35d4ec66478b5ad8e8f2502f6940f990bab7827.zip
Merge "455783: [Table] Editing problem for real numbers https://bugs.eclipse.org/bugs/show_bug.cgi?id=455783"
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java25
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/validator/RealDataValidator.java83
2 files changed, 66 insertions, 42 deletions
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
index cca150afe35..2ed4577eafa 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
@@ -9,10 +9,15 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 402525
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 455783
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
+import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.isNotNull;
+
+import java.math.BigDecimal;
+
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -427,7 +432,25 @@ public class UMLFeatureCellEditorConfig extends EStructuralFeatureEditorConfig {
IDisplayConverter converter = null;
switch (editorKind) {
case SINGLE_REAL:
- converter = new DefaultDoubleDisplayConverter();
+ converter = new DefaultDoubleDisplayConverter(){
+
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ // Bug 455783 :
+ // Redefine this method to manage the display of double number with dot and not with comma
+ if (isNotNull(canonicalValue)) {
+ return canonicalValue;
+ }
+ return null;
+ }
+
+ @Override
+ protected Object convertToNumericValue(String value) {
+ // Bug 455783 :
+ // Redefine this method to manage the conversion to double value with the dot and not the comma
+ return new BigDecimal(value).doubleValue();
+ }
+ };
break;
case SINGLE_UML_REFERENCE:
converter = new DisplayConverter() {
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/validator/RealDataValidator.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/validator/RealDataValidator.java
index 074fbd0076d..dfc8b3b2dbf 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/validator/RealDataValidator.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/validator/RealDataValidator.java
@@ -1,41 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.nattable.validator;
-
-import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
-import org.eclipse.papyrus.infra.widgets.validator.RealInputValidator;
-
-/**
- *
- * Validator for Real values
- *
- */
-public class RealDataValidator extends DataValidator {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.validate.DataValidator#validate(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- * @return
- */
- @Override
- public boolean validate(int columnIndex, int rowIndex, Object newValue) {
- final RealInputValidator validator = new RealInputValidator();
- return validator.isValid(newValue.toString()) == null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 455783
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.validator;
+
+import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
+import org.eclipse.papyrus.infra.widgets.validator.RealInputValidator;
+
+/**
+ *
+ * Validator for Real values
+ *
+ */
+public class RealDataValidator extends DataValidator {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.validate.DataValidator#validate(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ * @return
+ */
+ @Override
+ public boolean validate(int columnIndex, int rowIndex, Object newValue) {
+ final RealInputValidator validator = new RealInputValidator();
+ return newValue != null ? validator.isValid(newValue.toString()) == null : false;
+ }
+
+}

Back to the top