Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Activator.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java55
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Messages.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java87
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java82
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java148
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java113
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java76
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java107
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java27
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java117
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java110
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java110
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java110
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java180
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java203
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/messages.properties11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java108
38 files changed, 2559 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Activator.java
new file mode 100644
index 00000000000..1251d247755
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Activator.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java
new file mode 100644
index 00000000000..0811c91ff07
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import java.math.BigDecimal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BigDecimalComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for BigDecimal */
+public class EBigDecimalCellEditor implements IModelCellEditor {
+
+ private BigDecimalComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new BigDecimalComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof BigDecimal) {
+ this.composite.setValue((BigDecimal) originalValue);
+ } else {
+ Logger.logError("An instance of BigDecimal was expected", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java
new file mode 100644
index 00000000000..cf2b19e563d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import java.math.BigInteger;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BigIntegerComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for BigInteger */
+public class EBigIntegerCellEditor implements IModelCellEditor {
+
+ private BigIntegerComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new BigIntegerComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof BigInteger) {
+ this.composite.setValue((BigInteger) originalValue);
+ } else {
+ Logger.logError("An instance of BigInteger was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java
new file mode 100644
index 00000000000..4238b629d1b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BooleanComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Boolean */
+public class EBooleanCellEditor implements IModelCellEditor {
+
+ private BooleanComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new BooleanComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Boolean) {
+ this.composite.setValue((Boolean) originalValue);
+ } else {
+ Logger.logError("An instance of Boolean was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java
new file mode 100644
index 00000000000..7fdee4c7f6b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.ByteComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Byte */
+public class EByteCellEditor implements IModelCellEditor {
+
+ private ByteComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new ByteComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Byte) {
+ this.composite.setValue((Byte) originalValue);
+ } else {
+ Logger.logError("An instance of Byte was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java
new file mode 100644
index 00000000000..71d30a0f3fe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.CharComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Character */
+public class ECharCellEditor implements IModelCellEditor {
+
+ private CharComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new CharComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Character) {
+ this.composite.setValue((Character) originalValue);
+ } else {
+ Logger.logError("An instance of Character was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java
new file mode 100644
index 00000000000..2d22b91219a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.DoubleComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Double */
+public class EDoubleCellEditor implements IModelCellEditor {
+
+ private DoubleComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new DoubleComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Double) {
+ this.composite.setValue((Double) originalValue);
+ } else {
+ Logger.logError("An instance of Double was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java
new file mode 100644
index 00000000000..f910ef57860
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.FloatComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Float */
+public class EFloatCellEditor implements IModelCellEditor {
+
+ private FloatComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new FloatComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Float) {
+ this.composite.setValue((Float) originalValue);
+ } else {
+ Logger.logError("An instance of Float was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java
new file mode 100644
index 00000000000..3f5a1b28a7f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.IntComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Integer */
+public class EIntCellEditor implements IModelCellEditor {
+
+ private IntComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new IntComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Integer) {
+ this.composite.setValue((Integer) originalValue);
+ } else {
+ Logger.logError("An instance of Integer was expected", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java
new file mode 100644
index 00000000000..c4ae183e597
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.LongComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Long */
+public class ELongCellEditor implements IModelCellEditor {
+
+ private LongComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new LongComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Long) {
+ this.composite.setValue((Long) originalValue);
+ } else {
+ Logger.logError("An instance of Long was expected", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java
new file mode 100644
index 00000000000..4e8b0055db6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.ShortComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for Short */
+public class EShortCellEditor implements IModelCellEditor {
+
+ private ShortComposite composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new ShortComposite(parent);
+ if (originalValue != null) {
+ if (originalValue instanceof Short) {
+ this.composite.setValue((Short) originalValue);
+ } else {
+ Logger.logError("An instance of Short was expected", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java
new file mode 100644
index 00000000000..426f497260b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.widgets.celleditors.IListener;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler;
+import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.StringMultiComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** A cell editor for multiple line Strings */
+public class EStringMultiCellEditor implements IModelCellEditor {
+
+ private StringMultiComposite<String> composite = null;
+
+ public Control activateCell(final Composite parent, final Object originalValue,
+ final IModelCellEditHandler editHandler, final EStructuralFeature feature,
+ final EObject source) {
+ this.composite = new StringMultiComposite<String>(parent, originalValue);
+
+ this.composite.addCommitListener(new IListener() {
+ public void handleEvent() {
+ editHandler.commit();
+ }
+ });
+ return this.composite;
+ }
+
+ public Object getValue() {
+ return this.composite.getValue();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Messages.java
new file mode 100644
index 00000000000..5bb79901598
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/Messages.java
@@ -0,0 +1,26 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.widgets.celleditors.ecore.messages"; //$NON-NLS-1$
+ public static String MultiLineDialog_enterAValue;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java
new file mode 100644
index 00000000000..c4f7744ae13
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import java.math.BigDecimal;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class BigDecimalComposite extends StringComposite<BigDecimal> {
+
+ public BigDecimalComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public BigDecimalComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+ public void handleEvent(final Event event) {
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch == '.') {
+ if (BigDecimalComposite.this.getTextField().getText().indexOf('.') != -1) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+
+ }
+ });
+ }
+
+ @Override
+ public IConverter<BigDecimal> initConverter() {
+ return new IConverter<BigDecimal>() {
+ public BigDecimal toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new BigDecimal(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final BigDecimal object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ // The instantiation of the BigDecimal is only used to validate this string
+ @SuppressWarnings("unused")
+ BigDecimal bigDecimal = new BigDecimal(string);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java
new file mode 100644
index 00000000000..1ab1cb63eda
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import java.math.BigDecimal;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class BigDecimalCompositeFactory implements ICompositeEditorFactory<BigDecimal> {
+
+ public AbstractCellEditorComposite<BigDecimal> createCompositeEditor(final Composite parent, final int style) {
+ return new BigDecimalComposite(parent, style);
+ }
+
+ public Class<BigDecimal> getHandledType() {
+ return BigDecimal.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java
new file mode 100644
index 00000000000..7b1a94e6d2b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import java.math.BigInteger;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class BigIntegerComposite extends StringComposite<BigInteger> {
+
+ public BigIntegerComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public BigIntegerComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public IConverter<BigInteger> initConverter() {
+ return new IConverter<BigInteger>() {
+
+ public BigInteger toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new BigInteger(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final BigInteger object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ @SuppressWarnings("unused")
+ // The instantiation of the BigInteger is only used to validate this string
+ public IStatus validate(final String string) {
+ try {
+ new BigInteger(string);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java
new file mode 100644
index 00000000000..adeaafe20b0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import java.math.BigInteger;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class BigIntegerCompositeFactory implements ICompositeEditorFactory<BigInteger> {
+
+ public AbstractCellEditorComposite<BigInteger> createCompositeEditor(final Composite parent, final int style) {
+ return new BigIntegerComposite(parent, style);
+ }
+
+ public Class<BigInteger> getHandledType() {
+ return BigInteger.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java
new file mode 100644
index 00000000000..3ac6ad01908
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class BooleanComposite extends AbstractCellEditorComposite<Boolean> {
+
+ private Combo combo = null;
+ private boolean enableSelectionListener = true;
+ private Control parentControl = null;
+
+ public BooleanComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public BooleanComposite(final Composite parent, final int style) {
+ super(parent, style);
+ this.parentControl = parent;
+ GridLayout gd = new GridLayout(1, false);
+ gd.marginHeight = 0;
+ gd.marginWidth = 0;
+ gd.horizontalSpacing = 0;
+ setLayout(gd);
+
+ this.combo = new Combo(this, SWT.READ_ONLY);
+ this.combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ this.combo.setItems(new String[] { "true", "false" }); //$NON-NLS-1$ //$NON-NLS-2$
+ this.combo.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(final KeyEvent event) {
+
+ if ((event.keyCode == SWT.CR && event.stateMask == 0)) {
+ // Enter key pressed
+ commit();
+ } else if (event.keyCode == SWT.ESC && event.stateMask == 0
+ || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) {
+ // Escape key pressed
+ close();
+ }
+ BooleanComposite.this.setEnableSelectionListener(false);
+ }
+ });
+
+ this.combo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ if (BooleanComposite.this.getEnableSelectionListener()) {
+ fireChanged();
+ commit();
+ super.widgetSelected(e);
+ }
+ BooleanComposite.this.setEnableSelectionListener(true);
+ }
+ });
+
+ // commit the cell editor when the mouse is clicked
+ // anywhere outside the text field
+ final Listener clickListener = new Listener() {
+ public void handleEvent(final Event event) {
+ if (event.widget instanceof Control) {
+ Control control = (Control) event.widget;
+ if (control.getShell() == BooleanComposite.this.getParentControl().getShell()) {
+ if (event.widget != BooleanComposite.this.getCombo()) {
+ commit();
+ }
+ }
+ }
+ }
+ };
+ Display.getDefault().addFilter(SWT.MouseDown, clickListener);
+
+ // this listener is only here to remove
+ // the other listener from the Display
+ getCombo().addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(final DisposeEvent e) {
+ Display.getDefault().removeFilter(SWT.MouseDown, clickListener);
+ }
+ });
+
+ this.combo.forceFocus();
+ }
+
+ protected void commit() {
+ fireCommit();
+ }
+
+ public Boolean getValue() {
+ if (this.combo.getSelectionIndex() == 0) {
+ return Boolean.TRUE;
+ }
+ return Boolean.FALSE;
+
+ }
+
+ public void setValue(final Boolean value) {
+ if (value != null) {
+ if (value.booleanValue()) {
+ this.combo.select(0);
+ } else {
+ this.combo.select(1);
+ }
+ }
+ }
+
+ protected Combo getCombo() {
+ return this.combo;
+ }
+
+ protected boolean getEnableSelectionListener() {
+ return this.enableSelectionListener;
+ }
+
+ protected void setEnableSelectionListener(final boolean value) {
+ this.enableSelectionListener = value;
+ }
+
+ protected Control getParentControl() {
+ return this.parentControl;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java
new file mode 100644
index 00000000000..8eef8cf0ead
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class BooleanCompositeFactory implements ICompositeEditorFactory<Boolean> {
+
+ public AbstractCellEditorComposite<Boolean> createCompositeEditor(final Composite parent, final int style) {
+ return new BooleanComposite(parent, style);
+ }
+
+ public Class<Boolean> getHandledType() {
+ return Boolean.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java
new file mode 100644
index 00000000000..fff4e483670
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class ByteComposite extends StringComposite<Byte> {
+
+ public ByteComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public ByteComposite(final Composite parent, final int style) {
+ super(parent, style);
+
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (ByteComposite.this.getTextField().getText().indexOf('-') != -1) {
+ event.doit = false;
+ return;
+ }
+ // If the '-' caracter is not type at the beginning of
+ // the String
+ if (event.start != 0) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Byte.MIN_VALUE <= getValue().byteValue()
+ && getValue().byteValue() <= Byte.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Byte> initConverter() {
+ return new IConverter<Byte>() {
+
+ public Byte toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Byte(string);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+ return null;
+ }
+
+ public String toString(final Byte object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Byte.parseByte(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java
new file mode 100644
index 00000000000..ea2de0415c2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class ByteCompositeFactory implements ICompositeEditorFactory<Byte> {
+
+ public AbstractCellEditorComposite<Byte> createCompositeEditor(final Composite parent, final int style) {
+ return new ByteComposite(parent, style);
+ }
+
+ public Class<Byte> getHandledType() {
+ return Byte.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java
new file mode 100644
index 00000000000..87689fdd19c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 343655 - CharComposite : magic numbers
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class CharComposite extends StringComposite<Character> {
+
+ public CharComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public CharComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+ if (event.keyCode != SWT.BS && event.keyCode != SWT.DEL) {
+ if (CharComposite.this.getTextField().getSelectionCount() < 1) {
+ if (CharComposite.this.getTextField().getText().length() >= 1) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public IConverter<Character> initConverter() {
+ return new IConverter<Character>() {
+
+ public Character toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Character(string.charAt(0));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final Character object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ if (string.length() == 1) {
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java
new file mode 100644
index 00000000000..1f45b5c35ff
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class CharCompositeFactory implements ICompositeEditorFactory<Character> {
+
+ public AbstractCellEditorComposite<Character> createCompositeEditor(final Composite parent, final int style) {
+ return new CharComposite(parent, style);
+ }
+
+ public Class<Character> getHandledType() {
+ return Character.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java
new file mode 100644
index 00000000000..16a30902a62
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class DoubleComposite extends StringComposite<Double> {
+
+ public DoubleComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public DoubleComposite(final Composite parent, final int style) {
+ super(parent, style);
+
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (ch == '.') {
+ if (DoubleComposite.this.getTextField().getText().indexOf('.') != -1) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Double.MIN_VALUE <= getValue().doubleValue()
+ && getValue().doubleValue() <= Double.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Double> initConverter() {
+ return new IConverter<Double>() {
+
+ public Double toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Double(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final Double object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Double.parseDouble(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java
new file mode 100644
index 00000000000..51b4f59fef7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class DoubleCompositeFactory implements ICompositeEditorFactory<Double> {
+ public AbstractCellEditorComposite<Double> createCompositeEditor(final Composite parent, final int style) {
+ return new DoubleComposite(parent, style);
+ }
+
+ public Class<Double> getHandledType() {
+ return Double.class;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java
new file mode 100644
index 00000000000..d6f9d438693
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class FloatComposite extends StringComposite<Float> {
+
+ public FloatComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public FloatComposite(final Composite parent, final int style) {
+ super(parent, style);
+
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (ch == '.') {
+ if (FloatComposite.this.getTextField().getText().indexOf('.') != -1) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+ } else {
+ if (FloatComposite.this.getTextField().getText().indexOf('-') != -1) {
+ event.doit = false;
+ return;
+ }
+ // If the '-' caracter is not type at the beginning of
+ // the String
+ if (event.start != 0) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Float.MIN_VALUE <= getValue().floatValue()
+ && getValue().floatValue() <= Float.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Float> initConverter() {
+ return new IConverter<Float>() {
+
+ public Float toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Float(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final Float object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Float.parseFloat(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java
new file mode 100644
index 00000000000..534bd4d8347
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class FloatCompositeFactory implements ICompositeEditorFactory<Float> {
+
+ public AbstractCellEditorComposite<Float> createCompositeEditor(final Composite parent, final int style) {
+ return new FloatComposite(parent, style);
+ }
+
+ public Class<Float> getHandledType() {
+ return Float.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java
new file mode 100644
index 00000000000..529add5253b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class IntComposite extends StringComposite<Integer> {
+
+ public IntComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public IntComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (IntComposite.this.getTextField().getText().indexOf('-') != -1) {
+ event.doit = false;
+ return;
+ }
+ // If the '-' caracter is not type at the beginning of
+ // the String
+ if (event.start != 0) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Integer.MIN_VALUE <= getValue().intValue()
+ && getValue().intValue() <= Integer.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Integer> initConverter() {
+ return new IConverter<Integer>() {
+
+ public Integer toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Integer(string);
+ } catch (Exception e) {
+ return null;
+ }
+
+ }
+ return null;
+ }
+
+ public String toString(final Integer object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Integer.parseInt(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java
new file mode 100644
index 00000000000..261718e84c5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class IntCompositeFactory implements ICompositeEditorFactory<Integer> {
+
+ public AbstractCellEditorComposite<Integer> createCompositeEditor(final Composite parent, final int style) {
+ return new IntComposite(parent, style);
+ }
+
+ public Class<Integer> getHandledType() {
+ return Integer.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java
new file mode 100644
index 00000000000..1c30c836edd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class LongComposite extends StringComposite<Long> {
+
+ public LongComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ public LongComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (LongComposite.this.getTextField().getText().indexOf('-') != -1) {
+ event.doit = false;
+ return;
+ }
+ // If the '-' caracter is not type at the beginning of
+ // the String
+ if (event.start != 0) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Long.MIN_VALUE <= getValue().longValue()
+ && getValue().longValue() <= Long.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Long> initConverter() {
+ return new IConverter<Long>() {
+
+ public Long toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Long(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final Long object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Long.parseLong(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java
new file mode 100644
index 00000000000..ecd202c0b97
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class LongCompositeFactory implements ICompositeEditorFactory<Long> {
+
+ public AbstractCellEditorComposite<Long> createCompositeEditor(final Composite parent,
+ final int style) {
+ return new LongComposite(parent, style);
+ }
+
+ public Class<Long> getHandledType() {
+ return Long.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java
new file mode 100644
index 00000000000..13f8798e18d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.widgets.celleditors.IValidator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public class ShortComposite extends StringComposite<Short> {
+
+ public ShortComposite(final Composite parent, final int style) {
+ super(parent, style);
+ getTextField().addListener(SWT.Verify, new Listener() {
+
+ public void handleEvent(final Event event) {
+
+ String input = event.text;
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch != '-') {
+ if (!('0' <= ch && ch <= '9')) {
+ event.doit = false;
+ return;
+ }
+ } else {
+ if (ShortComposite.this.getTextField().getText().indexOf('-') != -1) {
+ event.doit = false;
+ return;
+ }
+ // If the '-' caracter is not type at the beginning of
+ // the String
+ if (event.start != 0) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+ }
+
+ });
+ }
+
+ public ShortComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ @Override
+ public IValidator getValidator() {
+ return new IValidator() {
+ public IStatus validate(final Object object) {
+ if (getValue() != null) {
+ if (Short.MIN_VALUE <= getValue().shortValue()
+ && getValue().shortValue() <= Short.MAX_VALUE) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public IConverter<Short> initConverter() {
+ return new IConverter<Short>() {
+
+ public Short toObject(final String string) {
+ if (string != null && string.length() > 0) {
+ try {
+ return new Short(string);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public String toString(final Short object) {
+ return object.toString();
+ }
+ };
+ }
+
+ @Override
+ public IStatus validate(final String string) {
+ try {
+ if (string.length() > 0) {
+ Short.parseShort(string);
+ }
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java
new file mode 100644
index 00000000000..ed83592d5e8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class ShortCompositeFactory implements ICompositeEditorFactory<Short> {
+
+ public AbstractCellEditorComposite<Short> createCompositeEditor(final Composite parent, final int style) {
+ return new ShortComposite(parent, style);
+ }
+
+ public Class<Short> getHandledType() {
+ return Short.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java
new file mode 100644
index 00000000000..2c766f47189
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java
@@ -0,0 +1,180 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ * Nicolas Guyomar (Mia-Software) - Bug 349574 - EMF Facet Ecore String composite textField cannot be disabled
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public abstract class StringComposite<T> extends AbstractCellEditorComposite<T> {
+
+ /** the control that is used to edit the contents of the cell */
+ private Text textField = null;
+
+ private final Composite parentControl;
+
+ /** the original value of the cell **/
+ private IConverter<T> converter;
+
+ protected static final Color RED = new Color(Display.getCurrent(), 255, 192, 192);
+ protected static final Color WHITE = Display.getCurrent().getSystemColor(
+ SWT.COLOR_LIST_BACKGROUND);
+
+ public StringComposite(final Composite parent, final int style) {
+ super(parent);
+ setLayout(new FillLayout());
+ this.parentControl = parent;
+ this.textField = new Text(this, style);
+
+ this.textField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(final KeyEvent event) {
+ // Enter key pressed
+ if ((event.keyCode == SWT.CR && event.stateMask == 0)
+ || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) {
+ if (StringComposite.this.getTextField().getEditable()) {
+ StringComposite.this.commit();
+ }
+ } else if (event.keyCode == SWT.ESC && event.stateMask == 0) {
+ // Escape key pressed
+ close();
+ }
+ }
+
+ @Override
+ public void keyReleased(final KeyEvent e) {
+ if (!StringComposite.this.validate(StringComposite.this.getTextField().getText())
+ .isOK()) {
+ StringComposite.this.getTextField().setBackground(StringComposite.RED);
+ } else {
+
+ StringComposite.this.getTextField().setBackground(StringComposite.WHITE);
+ }
+ super.keyReleased(e);
+ }
+
+ });
+ final Listener clickListener = new Listener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
+ */
+ public void handleEvent(final Event event) {
+ if (event.widget instanceof Control) {
+ Control control = (Control) event.widget;
+ if (control.getShell() == StringComposite.this.getParentControl().getShell()) {
+ if (event.widget != StringComposite.this.getTextField()) {
+ StringComposite.this.commit();
+ }
+ }
+ }
+ }
+ };
+ Display.getDefault().addFilter(SWT.MouseDown, clickListener);
+ // this listener is only here to remove
+ // the other listener from the Display
+ addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(final DisposeEvent e) {
+ Display.getDefault().removeFilter(SWT.MouseDown, clickListener);
+ }
+ });
+
+ this.textField.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent e) {
+ fireChanged();
+ }
+ });
+
+ this.textField.forceFocus();
+ }
+
+ public StringComposite(final Composite parent) {
+ this(parent, SWT.NONE);
+ }
+
+ protected void commit() {
+ if (getValidator().validate(getValue()).isOK()) {
+ fireCommit();
+ }
+ }
+
+ @Override
+ public void setEnabled(final boolean enabled) {
+ this.textField.setEnabled(enabled);
+ super.setEnabled(enabled);
+ }
+
+ public boolean getEditable() {
+ return this.textField.getEditable();
+ }
+
+ public void setValue(final T value) {
+ if (value == null) {
+ this.textField.setText(""); //$NON-NLS-1$
+ } else {
+ String strValue = getConverter().toString(value);
+ this.textField.setText(strValue);
+ this.textField.setSelection(0, strValue.length());
+ }
+ }
+
+ public String getText() {
+ return this.textField.getText();
+ }
+
+ protected Text getTextField() {
+ return this.textField;
+ }
+
+ protected Composite getParentControl() {
+ return this.parentControl;
+ }
+
+ public T getValue() {
+ return this.getConverter().toObject(this.getText());
+ }
+
+ private IConverter<T> getConverter() {
+ if (this.converter == null) {
+ this.converter = this.initConverter();
+ }
+ return this.converter;
+ }
+
+ public abstract IConverter<T> initConverter();
+
+ public interface IConverter<T> {
+ public T toObject(String string);
+
+ public String toString(T object);
+ }
+
+ public abstract IStatus validate(String string);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java
new file mode 100644
index 00000000000..8f7d1ad1f54
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java
@@ -0,0 +1,203 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.ui.MultiLineDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/** A cell editor for Strings */
+public class StringMultiComposite<T> extends AbstractCellEditorComposite<String> {
+
+ /** the control that is used to edit the contents of the cell */
+ private final Button button;
+ private Text text = null;
+
+ private final Composite parentControl;
+
+ /** the original value of the cell */
+ private String originalFieldValue;
+
+ public StringMultiComposite(final Composite parent, final Object originalValue, final int style) {
+ super(parent);
+ this.parentControl = parent;
+
+ GridLayout gd = new GridLayout(2, false);
+ gd.marginHeight = 0;
+ gd.marginWidth = 0;
+ gd.horizontalSpacing = 0;
+ setLayout(gd);
+
+ this.text = new Text(this, style);
+ this.text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ this.button = new Button(this, SWT.PUSH);
+ this.button.setText("..."); //$NON-NLS-1$
+ GridData data = new GridData(SWT.FILL, SWT.FILL, false, true);
+ this.button.setLayoutData(data);
+
+ if (originalValue != null) {
+ if (originalValue instanceof String) {
+ this.setValue((String) originalValue);
+ this.text.setSelection(0, ((String) originalValue).length());
+ } else {
+ Logger.logError("An instance of String was expected", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ this.button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ MultiLineDialog dialog = new MultiLineDialog(StringMultiComposite.this
+ .getParentControl().getShell(), StringMultiComposite.this.getValue()) {
+
+ @Override
+ protected void okPressed() {
+ StringMultiComposite.this.originalFieldValue = getTextArea().getText();
+ StringMultiComposite.this.getText().setText(getTextArea().getText());
+ StringMultiComposite.this.commit();
+ super.okPressed();
+ }
+ };
+ dialog.open();
+ }
+ });
+
+ // commit the cell editor when the mouse is clicked
+ // anywhere outside the text field
+ final Listener clickListener = new Listener() {
+ public void handleEvent(final Event event) {
+ if (event.widget instanceof Control) {
+ Control control = (Control) event.widget;
+ if (control.getShell() == StringMultiComposite.this.getParentControl()
+ .getShell()) {
+ if (event.widget != StringMultiComposite.this.getButton()) {
+ if (event.widget != StringMultiComposite.this.getText()) {
+ if (StringMultiComposite.this.getText().getEditable()) {
+ StringMultiComposite.this.commit();
+ } else {
+ StringMultiComposite.this.close();
+ }
+ }
+ }
+ }
+ }
+ }
+ };
+ Display.getDefault().addFilter(SWT.MouseDown, clickListener);
+
+ // this listener is only here to remove
+ // the other listener from the Display
+ this.text.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(final DisposeEvent e) {
+ Display.getDefault().removeFilter(SWT.MouseDown, clickListener);
+ }
+ });
+
+ this.text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(final KeyEvent event) {
+ // Enter key pressed
+ if ((event.keyCode == SWT.CR && event.stateMask == 0)
+ || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) {
+ if (StringMultiComposite.this.getText().getEditable()) {
+ StringMultiComposite.this.commit();
+ }
+ } else if (event.keyCode == SWT.ESC && event.stateMask == 0) {
+ // Escape key pressed
+ close();
+ }
+ }
+ });
+
+ this.text.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent e) {
+ fireChanged();
+ }
+ });
+
+ this.text.forceFocus();
+ }
+
+ public StringMultiComposite(final Composite parent, final int style) {
+ this(parent, null, style);
+ }
+
+ public StringMultiComposite(final Composite parent, final Object originalValue) {
+ this(parent, originalValue, SWT.NONE);
+ }
+
+ protected void commit() {
+ fireCommit();
+ }
+
+ public void setValue(final String value) {
+ this.originalFieldValue = value;
+ if (value == null) {
+ this.text.setText(""); //$NON-NLS-1$
+ } else {
+ // If the text contains a newline then edition is not possible, the user
+ // has to use the Dialog Editor
+ if (value.indexOf('\n') != -1) {
+ String truncatedValue = value.substring(0, value.indexOf('\n') - 1).concat("..."); //$NON-NLS-1$
+ this.text.setText(truncatedValue);
+ this.text.setEditable(false);
+ } else {
+ this.text.setText(value);
+ this.text.setSelection(0, value.length());
+ }
+ }
+ }
+
+ public String getValue() {
+ if (this.text.getEditable()) {
+ return this.text.getText();
+ }
+ return getOriginalFieldValue();
+ }
+
+ public Button getButton() {
+ return this.button;
+ }
+
+ public Composite getParentControl() {
+ return this.parentControl;
+ }
+
+ public String getOriginalFieldValue() {
+ return this.originalFieldValue;
+ }
+
+ protected Text getText() {
+ return this.text;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java
new file mode 100644
index 00000000000..c8890e04d12
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field
+ * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types
+ *******************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.composite;
+
+import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite;
+import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory;
+import org.eclipse.swt.widgets.Composite;
+
+public class StringMultiCompositeFactory implements ICompositeEditorFactory<String> {
+
+ public AbstractCellEditorComposite<String> createCompositeEditor(final Composite parent, final int style) {
+ return new StringMultiComposite<String>(parent, style);
+ }
+
+ public Class<String> getHandledType() {
+ return String.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/messages.properties
new file mode 100644
index 00000000000..8e1f7fbae5c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/messages.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2010 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:
+# Nicolas Bros (Mia-Software) - initial API and implementation
+###############################################################################
+MultiLineDialog_enterAValue=Enter a value
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java
new file mode 100644
index 00000000000..94bedf018d7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.widgets.celleditors.ecore/src/org/eclipse/papyrus/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Nicolas Guyomar (Mia-Software) - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.emf.facet.widgets.celleditors.ecore.ui;
+
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator;
+import org.eclipse.emf.facet.widgets.celleditors.ecore.Messages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class MultiLineDialog extends Dialog {
+
+ private static final int DIALOG_WIDTH = 300;
+ private static final int DIALOG_HEIGHT = 200;
+ private String originalValue;
+ private Text textArea;
+
+ public MultiLineDialog(final Shell parent, final Object originalValue) {
+ super(parent);
+ if (originalValue instanceof String) {
+ this.originalValue = (String) originalValue;
+ }
+
+ }
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ this.textArea = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ if (this.originalValue != null) {
+ this.textArea.setText(this.originalValue);
+ }
+ this.textArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ this.textArea.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(final KeyEvent e) {
+ if (e.keyCode == SWT.CR && e.stateMask == SWT.CTRL) {
+ okPressed();
+ }
+ super.keyPressed(e);
+ }
+ });
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ @Override
+ protected void okPressed() {
+ super.okPressed();
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+ @Override
+ protected void configureShell(final Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.MultiLineDialog_enterAValue);
+ }
+
+ protected Text getTextArea() {
+ return this.textArea;
+ }
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$
+ IDialogSettings settings = Activator.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(sectionName);
+ if (section == null) {
+ section = settings.addNewSection(sectionName);
+ // cf Dialog#DIALOG_WIDTH
+ section.put("DIALOG_WIDTH", MultiLineDialog.DIALOG_WIDTH); //$NON-NLS-1$
+ section.put("DIALOG_HEIGHT", MultiLineDialog.DIALOG_HEIGHT); //$NON-NLS-1$
+ }
+ return section;
+ }
+}

Back to the top