Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java')
-rw-r--r--plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java
new file mode 100644
index 00000000000..914e703f4bb
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.editors/src/org/eclipse/papyrus/editors/selectors/IntegerSelector.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.editors.selectors;
+
+/**
+ * A Selector for Integer values
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class IntegerSelector extends StringSelector {
+
+ /**
+ * {@inheritDoc}
+ */
+ public IntegerSelector() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Integer[] getSelectedElements() {
+ Integer[] result;
+ try {
+ result = new Integer[]{ Integer.parseInt(text.getText()) };
+ text.setText(""); //$NON-NLS-1$
+ } catch (NumberFormatException ex) {
+ result = new Integer[]{};
+ }
+ return result;
+ }
+}

Back to the top