Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/uml/org.eclipse.papyrus.uml.textual.editors.example/model/UML/ui/PropertyExample.xwt3
-rwxr-xr-xplugins/doc/org.eclipse.papyrus.uml.textedit.doc/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/doc/org.eclipse.papyrus.uml.textedit.doc/site/mediawiki/textedit.mediawiki4
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedMode.pngbin0 -> 2848 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedModeXText.pngbin0 -> 2453 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonSwitch.pngbin0 -> 1919 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonsEdit.pngbin0 -> 1213 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/preferencesMultiplicityEditor.pngbin0 -> 26511 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleMode.pngbin0 -> 1477 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleModeDisabled.pngbin0 -> 1441 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view-main-toc.xml14
-rw-r--r--plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view.mediawiki692
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/icons/Switch_12x12.gifbin0 -> 304 bytes
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractReferenceDialog.java182
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/IReferenceValueEditor.java83
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultiplicityDialog.java605
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java1226
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextReferenceDialog.java47
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextStringEditor.java122
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java273
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties111
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/util/MultiplicityConstants.java45
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java20
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/model/environment.xmi5
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/MultiplicityXTextValueEditor.java142
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/UMLXtextReferenceValueEditor.java110
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/MultiplicityXTextDialog.java117
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF127
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/Environment.xmi5
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt37
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MultipleProperty.xwt66
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt106
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectorEnd.xwt47
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt106
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMultiplicityElement.xwt45
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt106
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt84
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt106
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt118
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt83
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt82
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt106
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt76
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/plugin.xml175
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/Messages.java114
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/messages.properties28
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java284
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferenceInitializer.java42
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferencePage.java91
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferences.java51
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/ExtendedMultiplicityDialog.java74
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/MultiplicityDialog.java147
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/plugin.xml26
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityLowerValueDirectEditorConstraint.java67
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityUpperValueDirectEditorConstraint.java67
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration.java51
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration.java51
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/ValueSpecificationXtextDirectEditorConfiguration.java4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/AbstractMultiplicityValueSpecificationSetCommand.java110
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityLowerValueSetCommand.java129
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityUpperValueSetCommand.java139
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java6
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtendedMultiplicityObservableValue.java85
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java453
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/AllTests.java4
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityLowerValueSpecificationGrammarTests.java81
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityUpperValueSpecificationGrammarTests.java81
67 files changed, 5118 insertions, 2345 deletions
diff --git a/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/model/UML/ui/PropertyExample.xwt b/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/model/UML/ui/PropertyExample.xwt
index afde1ae27a9..c9e45dd834a 100644
--- a/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/model/UML/ui/PropertyExample.xwt
+++ b/examples/uml/org.eclipse.papyrus.uml.textual.editors.example/model/UML/ui/PropertyExample.xwt
@@ -32,7 +32,8 @@
customLabel="defaultEditor"></ppe:ReferenceDialog>
<ppe:CompletionStyledTextReferenceDialog
input="{Binding}" property="UML:TypedElement:type" customLabel="newType"></ppe:CompletionStyledTextReferenceDialog>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
+ <xtexteditor:MultiplicityXTextDialog
+ property="Multiplicity:multiplicity" input="{Binding}"></xtexteditor:MultiplicityXTextDialog>
<ppe:ReferenceDialog input="{Binding}"
property="UML:Property:defaultValue"></ppe:ReferenceDialog>
<xtexteditor:UMLStyledTextReferenceDialog
diff --git a/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/META-INF/MANIFEST.MF b/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/META-INF/MANIFEST.MF
index 5947b07f4e5..9c633f57efc 100755
--- a/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/META-INF/MANIFEST.MF
+++ b/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.papyrus.uml.textedit.doc;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/site/mediawiki/textedit.mediawiki b/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/site/mediawiki/textedit.mediawiki
index 760b6841455..82509166c2b 100755
--- a/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/site/mediawiki/textedit.mediawiki
+++ b/plugins/doc/org.eclipse.papyrus.uml.textedit.doc/site/mediawiki/textedit.mediawiki
@@ -278,7 +278,7 @@ Developer documentation is available [[Papyrus_Developer_Guide/Papyrus_Embedded_
===Usage===
* This editors allows to find named element typing its name.
-* In case of several elements to found, the separator to use is the comma </code>'</code>
+* In case of several elements to found, the separator to use is the comma <code>'</code>
* If the name of the element contains a comma, you should prefix and suffix its name by a quote <code>'</code>.
* The value will not be set if the element can't be found is the model
@@ -307,5 +307,5 @@ If you have 3 Classes in your model, named <code>Class1</code>, <code>Class2</co
|-
| Clas,
| <Undefined>,...
-| interpreted as a list of value, the first value is </code>Clas</code>, and we have no information for the second one, for the completion it is an empty string
+| interpreted as a list of value, the first value is <code>Clas</code>, and we have no information for the second one, for the completion it is an empty string
|}
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedMode.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedMode.png
new file mode 100644
index 00000000000..a284dadf074
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedMode.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedModeXText.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedModeXText.png
new file mode 100644
index 00000000000..f2876c86320
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/advancedModeXText.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonSwitch.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonSwitch.png
new file mode 100644
index 00000000000..d1917c030ae
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonSwitch.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonsEdit.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonsEdit.png
new file mode 100644
index 00000000000..f5a0c22957b
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/buttonsEdit.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/preferencesMultiplicityEditor.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/preferencesMultiplicityEditor.png
new file mode 100644
index 00000000000..ad1f9309a4a
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/preferencesMultiplicityEditor.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleMode.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleMode.png
new file mode 100644
index 00000000000..2fe8d2847c0
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleMode.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleModeDisabled.png b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleModeDisabled.png
new file mode 100644
index 00000000000..13b6459c564
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/images/simpleModeDisabled.png
Binary files differ
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view-main-toc.xml b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view-main-toc.xml
index f026f340756..0add93e6d77 100644
--- a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view-main-toc.xml
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view-main-toc.xml
@@ -1,7 +1,7 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<toc label="Search" link_to="../org.eclipse.papyrus.infra.doc/toc.xml#PapyrusDocUser">
- <topic href="target/generated-eclipse-help/properties-view.html" label="Properties view customization">
- <link toc="target/generated-eclipse-help/properties-view-toc.xml"/>
- <anchor id="properties-view"/>
- </topic>
-</toc>
+<?xml version='1.0' encoding='utf-8' ?>
+<toc label="Search" link_to="../org.eclipse.papyrus.infra.doc/toc.xml#PapyrusDocUser">
+ <topic href="target/generated-eclipse-help/properties-view.html" label="Properties view">
+ <link toc="target/generated-eclipse-help/properties-view-toc.xml"/>
+ <anchor id="properties-view"/>
+ </topic>
+</toc>
diff --git a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view.mediawiki b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view.mediawiki
index e609186f061..a66b0ac94e6 100644
--- a/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view.mediawiki
+++ b/plugins/doc/org.eclipse.papyrus.views.properties.doc/resource/properties-view.mediawiki
@@ -1,307 +1,385 @@
-== INTRODUCTION ==
-In UML, the main information is represented in graphical diagrams. However, it is not always possible to represent graphically the whole semantic of UML, not talking of all the cosmetic properties. For example, it is pretty easy to represent and to edit a Class' name graphically. While we still can represent the 'is abstract' property graphically (By using the italic font for the Class' name), it is harder to edit this property directly from the diagram. Worse, the 'is leaf' property doesn't even have a graphical representation. Thus, we often need a different view for representing all the properties of a UML Element, without polluting the graphical view.
-
-
-As UML is highly extensible, through the mean of Profiles, it is also important to be able to represent and edit the profile's properties, without managing everything from the diagram view.
-
-
-Eclipse provides a standard view for these properties: the Properties Page. This view is a table representing all the properties available for the selected Element, including the ones that cannot be represented or edited graphically. This view is pretty useful, but is neither really user-friendly nor optimal, as it may require up to four clicks to simply edit a comment's body. Moreover, it can only be extended via Java code, which requires some technical skills and prevents a dynamic modification of the view, as the Java code needs to be recompiled after each modification.
-
-
-There is an extension of the base Property View framework, still in the standard Eclipse implementation, which fixes some of these problems. It is called the 'Eclipse Tabbed Properties View' framework. It provides a better look and feel for the property view, with more flexibility, and a better usability. However, it keeps being difficult to customize, as it still hard-coded in Java.
-
-
-Papyrus provides its own Property View framework, based on the Tabbed Property View framework. The Papyrus Property View can be extended in two ways:
-* Dynamically, for the layout of the property view: show/hide a property, reorder the properties, add/remove a tab'
-* Statically, through Java code, for advanced operations: create a new widget for editing the properties, add a custom Content Provider for selecting a reference value'
-This document aims at detailing all the features related to the property view customization, both dynamically and statically.
-
-== THE CUSTOMIZATION TOOL ==
-
-Most customizations can be done through the Property view customization Editor. It provides native support for EMF Models, UML models and profiles. It also provides a set of basic widgets and property editors.
-
-=== Edit a configuration ===
-
-Each property view configuration is defined in a different set of files. Each configuration can contain elements from different contexts, but we typically have one configuration per Ecore Metamodel or UML Profile (i.e. one configuration for UML, one for the Diagram Appearance tab, another one for the SysML profile')
-
-To see the list of available configurations, open the properties view (Window -> Show View -> Other' -> General/Properties). Click on the white arrow in the upper right corner of the Properties view, and select 'Customize property view'. You should see a dialog with the list of all available configurations.
-
-
-[[File:images/fig1.png|Open the property view customization menu]]
-
-As the standard configurations are read-only, you cannot edit them directly. You will first need to make a copy of the configuration. You will then be able to edit the copy.
-
-[[File:images/fig2.png|Copy an existing configuration to edit it]]
-
-
-The Property View Editor has three panes:
-* The Editor part
-* The Preview part
-* The Properties part
-The Editor presents the elements defined by this configuration. The Preview displays an overview of the selected View, as it will be displayed in the property view at runtime. The properties view displays the properties of the selected element
-
-[[File:images/fig3.png|The property view Editor]]
-
-
-=== The property view elements ===
-
-The editor contains a Tree, containing the following elements :
-* Context: it is a property view configuration. You will typically have one property view Context per Ecore Metamodel or UML Profile, but you can choose the granularity you want. A context has a list of tabs, and a list of views.
-* Tab: describes a tab in the property view. A tab has a label, an (optional) image, and can be indented. It also has a priority.
-* View: describes a property view associated to a selection. The view has a name, a constraint, a multiplicity and a list of sections. The constraint is used to determine for what kind of object the view should be displayed.
-* Constraint: a query that inputs a selection, and outputs a boolean (true if the constraint matches the input object, false otherwise). It is possible to implement your own constraint type (In Java).
-* Section: a section is a sub-part of a view. A view generally needs only one section, but there are cases where you need more than one section. A section is associated to a single tab, so, if you want to display more than one tab in a single view (For example, ' UML ' and ' Profile ' in the UML property view), you will need at least two sections in that view (One for each tab). Another (advanced) case is described in ' Dynamic sections '. A section has a name, a tab, and a Composite.
-* Composite: this is the actual presentation element. The composite is a widget which can contain other widgets. A composite has a type, and a list of widgets.
-* Layout: all composites need a layout. The default is ' PropertiesLayout ', which is a variant of the SWT standard GridLayout. A PropertiesLayout has a number of columns. The default is one column.
-* Property Editor: a property editor is a widget which is used to edit a single property of the selected object. You will typically have one Property editor for each property that you want to edit in the property view. The property editor has a property, and a widget to edit that property.
-* Standard Widget: a widget from the standard SWT Library. Few of them are currently available, because they are rarely needed.
-The Tree allows reordering or removing easily the elements (Through drag & drop, delete). The editor also supports the Undo/Redo commands.
-
-==== Preview ====
-
-The preview displays a real-time overview of the selected View. However, some widgets can only be computed at runtime, which prevents a pertinent preview. This is the case of the 'Enum Radio' widget, for example, as the enumerated values are only known at runtime.
-
-==== Property view ====
-
-The property view is used to edit the properties of the element selected in the tree. The property view uses the Papyrus Property View framework, thus can be customized just the same way you would customize any other property view.
-
-[[File:images/fig4.png| the three panes of the Property view editor]]
-
-=== Priorities between views ===
-When more than one view match a selection, a priority mechanism will determine which one(s) should be displayed. The priorities are defined at the level of the view's constraints, i.e. if the constraint for a View A overrides a constraint for the View B, the View B won't be displayed. For example, a UML Class from a Class Diagram will match many views (The list is not exhaustive):
-
-* SingleClass (From UML)
-* MultipleClass (As the -1 multiplicity actually means 'any number of elements')
-* SingleElement (And MultipleElement)
-* SingleClassifier (And MultipleClassifier)
-* *Style (From GMF Notation model)
-* StereotypeDisplay (From UML Notation model)
-
-The priorities are computed in two ways:
-
-* Automatic, according to the Java constraints implementations
-* Statically, according to the property view configuration
-
-When the 'isOverrideable' property is set to false for a Constraint (In the property view model), only the static rules will be taken into account.
-
-[[File:images/fig5.png|The constraint cannot be dynamically overridden]]
-
-The automatic rules are the following:
-
-* A constraint with a multiplicity of 1 always overrides the same constraint with a multiplicity of -1 (Or >1). Thus, 'MultipleClass' won't be displayed, because 'SingleClass' also matches our selection.
-* An EMF (Or UML) 'Instance of' constraint always overrides a constraint matching a supertype. Thus, 'SingleClassifier' won't be displayed, because a Class is more specific than a Classifier. However, 'SingleElement' *will be* displayed, because it is not overrideable (isOverrideable=false).
-* A stereotype constraint (HasStereotype) will *not* override its UML 'Instance of' constraint. However, a specific implementation of this constraint has been provided for Scade, which *will* override the UML metaclass (i.e., a Block will override a Class' property view, hiding the UML tab).
-* For CompositeConstraints: if a composite constraint is a superset of another constraint, it will override it (It is more specific). For example, a Composite Constraint 'isA and isB' will override a constraint 'isB', but will not override a constraint 'isB and isC'.
-
-Please note that each constraint has its own implementation of the overrides() method. See the advanced chapter for more information
-
-The static rule is simple: when a Constraint explicitly overrides another constraint, it will always override it. This is especially useful when you've marked a constraint as 'overrideable=false', but still want to override it in a specific case (Remember that overrideable=false only applies to *automatic* constraint resolution).
-
-[[File:images/fig6.png|Force this constraint to override another constraint]]
-
-
-Finally, in the previous example, the following views will be displayed:
-
-* SingleClass (Overrides MultipleClass, Single/MultipleClassifier ; UML Tab)
-* SingleElement (overrideable=false ; Profile tab)
-* FillStyle, FontStyle, LineStyle (Appearance tab)
-* StereotypeDisplay (overrideable=false ; Appearance tab)
-
-=== Preferences ===
-
-When you make a copy of a property view, it is not automatically activated. Thus, the modifications brought to the copy are not immediately visible on your property view. To activate a property view, you need to open the Papyrus preferences, from Window > Preferences.
-
-[[File:images/fig7.png|Preferences]]
-
-When making a copy of an existing configuration, you should uncheck the default one, and check the new one.
-
-== ADVANCED CUSTOMIZATION ==
-
-The customization tool only allows basic operations, such as adding, removing or reordering properties.
-
-The property view framework is much more powerful, but this requires some Java development. This chapter will focus on the advanced customization of the property view.
-
-=== The Environment model ===
-
-To associate Java implementations with the property view model, you need to declare an Environment model. You can create a new Environment model with the 'Environment Model' wizard in 'Example EMF Model Creation Wizards' category. Select 'Environment' as the Model Object.
-
-Once you've added your Java class declarations, you should register the environment model so that the property view knows about it. Add an extension to org.eclipse.papyrus.properties.environment, and select your model file.
-
-=== Create a new widget ===
-
-You can create new widgets for the property view. There are four kinds of graphical elements: CompositeWidget, Layout, StandardWidget and PropertyEditor.
-The widgets contain three common fields:
-
-* Label: The label displayed in the Customization editor when the user selects a widget type.
-* Namespace: The XWT namespace associated to the Widget.
-* WidgetClass: The simple name of the Java class implementing the Widget.
-
-The PropertyEditor contains two additional fields:
-
-* Multiplicity: The multiplicity of the properties it can handle (1 for single-valued properties, -1 for multivalued properties)
-* Type: The type of the properties it can handle.
-
-To implement a Composite, Layout or Standard widget, you should simply follow the SWT rules, i.e. extend either Composite, Canvas or Layout, and have a (Composite, int) constructor. To define a PropertyEditor, you have two options:
-
-* Extend Composite, have a (Composite, int) constructor, and implement the CustomizablePropertyEditor interface (From org.eclipse.papyrus.properties.widgets)
-* Extend directly AbstractPropertyEditor (From org.eclipse.papyrus.properties.widgets)
-
-=== Constraints ===
-
-Adding a Constraint is similar to creating a new Widget. You have two options to implement a new Constraint:
-
-* Implement the Constraint interface (From org.eclipse.papyrus.properties.constraints)
-* Extend the AbstractConstraint class (From org.eclipse.papyrus.properties.constraints)
-
-The important methods are the following (depending on whether you're implement Constraint or extending AbstractConstraint):
-
-* setDescriptor/setConstraintDescriptor:
-** Configures the constraint.
-* match(Object)/match(IStructuredSelection) : Boolean
-** Indicates whether this constraint matches the given given or not
-* overrides(Constraint) : Boolean
-** Indicates whether this constraint overrides another constraint or not. A constraint should override another constraint when it is more specific.
-* equivalent(Constraint) : Boolean
-** This is only used by AbstractConstraint. Two constraints are equivalent if they have the same parameters (ConstraintDescriptor). Two equivalent constraints can have different multiplicities.
-
-The equivalent() and overrides() methods are used to automatically resolve constraints conflicts (Two different constraints matching the same element).
-Once the Constraint is implemented, don't forget to register it in your environment model.
-
-===ModelElement===
-
-The ModelElement is the interface between the property view and your domain model. It is used to retrieve information about the object(s) being edited from the property. These informations will be used to configure the widget. AbstractModelElement provides a base implementation for this interface.
-
-All methods from this interface take a single parameter, which is the name of the property being edited.
-
-* getObservable(String) / doGetObservable(String) :
-
-This method returns an IObservable which will be used to read and write a single property from the represented object. It should return an IObservableValue for single-valued properties, and IObservableList for multi-valued properties.
-
-* getContentProvider(String) :
-
-This method is only used for reference and enumerated properties. It should return a list of values which can be set to the edited property. Unlike IStructuredContentProvider, this provider will not rely on a StructuredViewer to retrieve an input object: the method getElement() will be called without any parameter, so the implementation should be able to retrieve its own typically. This will typically be achieved by passing a context object in the provider's constructor.
-
-* getLabelProvider(String) :
-
-This method is used to display an element's label for a few widgets. Note that the same instance of label provider can be used by more than one Viewer for a given property. For example, the MultiReference widget will display three viewers, each using the same label provider. Each viewer will try to dispose the LabelProvider as soon as they are themselves disposed (For example, when closing the selection dialog from MultiReference). Thus, you should probably not implement the dispose() method, to avoid inconsistent providers.
-
-* getValidator(String) :
-
-This method returns an IValidator, if there's one which is set up for the current property.
-
-=== ModelElement Factory ===
-
-The ModelElements are associated to DataContextElements through a ModelElementFactory. The ModelElementFactory is defined on the DataContextRoot. All children of a DataContextRoot will share the same ModelElementFactory.
-
-To add a new ModelElement, you should also create a new ModelElementFactory, and register it in your Environment model. Then, you can set this factory to your DataContextRoot.
-
-Note: to display the Data contexts, you need to check the toggle button on top of the editor: [[File:images/fig8.png]]
-
-[[File:images/fig9.png|The UML DataContextRoots, with their own factories]]
-
-=== Content Providers and Widgets ===
-
-Note: The ContentProviders have been refactored in Papyrus 0.9, to be simplified. However, most of this chapter should remain true.
-
-The ContentProvider is a complex features, which often evolves in the Papyrus property view. The ModelElement has been designed to be compatible with many kinds of different widgets (Combo-box, Tree-based dialogs'). The problem is that these widgets typically use different kinds of JFace ContentProvider (IStructuredContentProvider for flat display, ITreeContentProvider for Tree display). In the Property view, we needed to unify these providers.
-
-Thus, it is recommended to use a IHierarchicContentProvider, which extends ITreeContentProvider, with an additional method: isValidValue(Object). In a Tree, we typically have two kinds of elements: the elements which can potentially be selected, and their containers, which often cannot. The isValidValue() method is used to distinguish between these values.
-
-When a flat widget (e.g. ReferenceCombo) is used, only the valid values will be displayed. When a tree-based widget (e.g. ReferenceDialog) is used, a sub-tree will be displayed, excluding the sub-trees which don't contain any valid value. Moreover, the invalid values won't be selectable (For example, in the ReferenceDialog, the 'ok' button will be grayed).
-
-[[File:images/fig10.png|IHierarchicContentProvider at runtime]]
-
-=== Dynamic sections ===
-
-Sometimes, the property view should not depend on a selection, but on a specific property of the selected element. In such a case, it is frequent that this specific property might be edited by the property view itself. However, the property view is only refreshed when the selection changes.
-
-To overcome this problem, Papyrus offers a 'Dynamic section' feature, which allows refreshing dynamically one or more sections of the property view. For example, when you're editing a View's constraint in the Property view Editor, the constraint's properties directly depend on the constraint's type. When you select an UML constraint, the constraint's parameter is the name of a UML Metaclass. When you select an EMF constraint, the constraint has two parameters: Namespace URI of the Metamodel, and the name of the Metaclass. Changing the constraint type should also change the constraint's parameters editors.
-
-[[File:images/fig11.png|A view with a static and a dynamic section]]
-
-This can be achieved with dynamic sections, i.e. a section with a constraint. The constraint will be executed once at the beginning, and once again each time a property from the property view changes. If the constraint is matched, the section will be displayed. Otherwise, it will be hidden.
-A view with dynamic sections will typically look like the following:
-
-* A single unconstrained section containing the common parameters
-* One dynamic (i.e. constrained) section for each specific case
-
-[[File:images/fig12.png|Dynamic sections configuration]]
-
-Please note that tabs cannot be added nor removed dynamically. For example, when you apply a stereotype on a UML Element, the tab associated to the stereotype's property view cannot be displayed until you select the element again.
-
-=== Property view Header ===
-The Eclipse Tabbed Property View offers an extension point to define the label provider for the property view header. However, this label provider will be specific to the editor. For generic editors, it is not always possible to provide a pertinent label provider: they will always be too generic, and won't be able to handle specific elements. For example, a generic EMF Model Editor with the customizable property view will only be able to display standard EMF labels and icons. To overcome this problem, Papyrus offers a configurable label provider for the header: org.eclipse.papyrus.properties.provider.SelectionLabelProvider
-
-This label provider uses the selected element to find the most appropriate label provider, then dispatches the getText and getIcon calls to it. This label provider can be configured through an extension point: org.eclipse.papyrus.properties.labelprovider
-
-This extension point takes an implementation of IFilteredLabelProvider and a priority. The IFilteredLabelProvider is a label provider with an additional method: boolean accept(IStructuredSelection). For each selection, the label provider accepting the selection, and having the highest priority will be used to display a header for it. It will then be possible to define a generic label provider for all java objects, with the lowest priority; another generic label provider for all EMF Objects, and a really specific label provider for a given metamodel (with the highest priority).
-In Papyrus, we have such an example for UML. The Papyrus UML Diagrams use the GMF model, which doesn't have icons. We wanted to have a different icon for each type of Diagram: this is not possible with a standard EMF label provider, which associates an icon to an EClass, independently of its instances' attributes.
-
-So, we registered the standard EMF Label Provider with a medium priority, which can handle any kind of EObject, and a UML Label Provider, which can only handle UML Elements and GMF Diagrams, with a higher priority.
-
-The lower the priority number, the higher the priority actually is:
-
-* 100: Lowest priority. The standard EMF Object label provider has a priority of 100, and is called iff no other label provider can accept an EObject.
-* 50: Medium priority. The Papyrus UML Label Provider has a priority of 50.
-* 10: High priority.
-* 0: Highest priority.
-
-If no label provider matches the selection, the default JFace LabelProvider is used.
-
-=== Binding and Validation ===
-
-View Properties support JFace Databinding, which connects our UI to our model. For the validation there are two kinds of validators:
-
-* Widget validators: they check that our input is the kind of data expected by our widget before synchronizing it ( e.g IntegerEditor must have a correct integer for input)
-
-* Model validators: they check that our input verifies our model constraint, they must be instantiate in UmlModelElement#getValidator();
-
-If there are errors during the binding a control decoration is shown next to the widget. It also supports three level of severity (Ok, Warning, Error).
-
-[[File:images/fig13.png|Example of binding with a model validator and warning severity result]]
-
-=== Field coloration ===
-
-Properties views have fields' coloration. If you modify a value the background of the field will be orange, when you validate a change the background will turn green for couple of seconds if the synchronization was successful, it will turn red otherwise.
-
-[[File:images/fig14.png|Example of a field being modified]]
-
-== GENERATION TOOL ==
-
-Editing an existing property view can be useful, but most of the time, you'll want a brand new configuration for your own profile or meta-model. Thus, the framework provides a tool to automatically generate the initial property view, which you can then customize using the customization tool.
-The generator can create a property view configuration from either a UML Profile or an Ecore Meta-model. The wizard is available in the Papyrus category: File -> New -> Other' -> Papyrus/Property view configuration.
-
-The wizard provides two default generators:
-
-* Generate a property view from a UML Profile
-* Generate a property view from an Ecore Meta-model
-
-The source file must be located in your workspace. A default target file named will be filled with the .ctx extension (This is the extension for a property view configuration).
-
-Press next: a combo asks you which strategy to use.
-
-A basic method: all the elements from the profile or meta-model will be extracted, with no dependencies to other models.
-
-Same CTX file: you are asked to choose which models you want to extract, and will be saved in the same file
-
-Different CTX file(s): you are asked to choose which models you want to extract and they will be saved in different files, (each profile name will be the name of the generated ctx file)
-
-Press next: a table with all the elements extracted from your profile or meta-model is displayed. This table contains four columns:
-
-* Field: the name of the element or property
-* Display single: whether this property should be displayed when a single instance of this element is selected
-* Display multiple: whether this property should be displayed when more than one instance of this element is selected
-* Description: the description of the property (Most of the time, it will be N/A, as the default generators cannot extract the documentation from the source model).
-
-Press finish: two files or more files according to the chosen strategy and a folder are generated:
-
-* The *.ctx file, corresponding to your property view configuration
-* The ui/ folder, containing a set of XWT files, which contain the graphical information of your property views
-* The *FieldSelection.xmi file, which reminds the choices you've made about displaying each property. This file is currently unused.
-
-You can now open the *.ctx file and customize your property view.
-
-
-== DEPLOYING A PROPERTY VIEW ==
-
-Papyrus provides a simple tool to deploy a property view locally (Right click on a CTX file -> Deploy/Undeploy) \ No newline at end of file
+==Properties view customization==
+===Introduction===
+In UML, the main information is represented in graphical diagrams. However, it is not always possible to represent graphically the whole semantic of UML, not talking of all the cosmetic properties. For example, it is pretty easy to represent and to edit a Class' name graphically. While we still can represent the 'is abstract' property graphically (By using the italic font for the Class' name), it is harder to edit this property directly from the diagram. Worse, the 'is leaf' property doesn't even have a graphical representation. Thus, we often need a different view for representing all the properties of a UML Element, without polluting the graphical view.
+
+
+As UML is highly extensible, through the mean of Profiles, it is also important to be able to represent and edit the profile's properties, without managing everything from the diagram view.
+
+
+Eclipse provides a standard view for these properties: the Properties Page. This view is a table representing all the properties available for the selected Element, including the ones that cannot be represented or edited graphically. This view is pretty useful, but is neither really user-friendly nor optimal, as it may require up to four clicks to simply edit a comment's body. Moreover, it can only be extended via Java code, which requires some technical skills and prevents a dynamic modification of the view, as the Java code needs to be recompiled after each modification.
+
+
+There is an extension of the base Property View framework, still in the standard Eclipse implementation, which fixes some of these problems. It is called the 'Eclipse Tabbed Properties View' framework. It provides a better look and feel for the property view, with more flexibility, and a better usability. However, it keeps being difficult to customize, as it still hard-coded in Java.
+
+
+Papyrus provides its own Property View framework, based on the Tabbed Property View framework. The Papyrus Property View can be extended in two ways:
+* Dynamically, for the layout of the property view: show/hide a property, reorder the properties, add/remove a tab'
+* Statically, through Java code, for advanced operations: create a new widget for editing the properties, add a custom Content Provider for selecting a reference value'
+This document aims at detailing all the features related to the property view customization, both dynamically and statically.
+
+===The customization tool===
+
+Most customizations can be done through the Property view customization Editor. It provides native support for EMF Models, UML models and profiles. It also provides a set of basic widgets and property editors.
+
+=== Edit a configuration ===
+
+Each property view configuration is defined in a different set of files. Each configuration can contain elements from different contexts, but we typically have one configuration per Ecore Metamodel or UML Profile (i.e. one configuration for UML, one for the Diagram Appearance tab, another one for the SysML profile')
+
+To see the list of available configurations, open the properties view (Window -> Show View -> Other' -> General/Properties). Click on the white arrow in the upper right corner of the Properties view, and select 'Customize property view'. You should see a dialog with the list of all available configurations.
+
+
+[[File:images/fig1.png|Open the property view customization menu]]
+
+As the standard configurations are read-only, you cannot edit them directly. You will first need to make a copy of the configuration. You will then be able to edit the copy.
+
+[[File:images/fig2.png|Copy an existing configuration to edit it]]
+
+
+The Property View Editor has three panes:
+* The Editor part
+* The Preview part
+* The Properties part
+The Editor presents the elements defined by this configuration. The Preview displays an overview of the selected View, as it will be displayed in the property view at runtime. The properties view displays the properties of the selected element
+
+[[File:images/fig3.png|The property view Editor]]
+
+
+====The property view elements====
+
+The editor contains a Tree, containing the following elements :
+* Context: it is a property view configuration. You will typically have one property view Context per Ecore Metamodel or UML Profile, but you can choose the granularity you want. A context has a list of tabs, and a list of views.
+* Tab: describes a tab in the property view. A tab has a label, an (optional) image, and can be indented. It also has a priority.
+* View: describes a property view associated to a selection. The view has a name, a constraint, a multiplicity and a list of sections. The constraint is used to determine for what kind of object the view should be displayed.
+* Constraint: a query that inputs a selection, and outputs a boolean (true if the constraint matches the input object, false otherwise). It is possible to implement your own constraint type (In Java).
+* Section: a section is a sub-part of a view. A view generally needs only one section, but there are cases where you need more than one section. A section is associated to a single tab, so, if you want to display more than one tab in a single view (For example, ' UML ' and ' Profile ' in the UML property view), you will need at least two sections in that view (One for each tab). Another (advanced) case is described in ' Dynamic sections '. A section has a name, a tab, and a Composite.
+* Composite: this is the actual presentation element. The composite is a widget which can contain other widgets. A composite has a type, and a list of widgets.
+* Layout: all composites need a layout. The default is ' PropertiesLayout ', which is a variant of the SWT standard GridLayout. A PropertiesLayout has a number of columns. The default is one column.
+* Property Editor: a property editor is a widget which is used to edit a single property of the selected object. You will typically have one Property editor for each property that you want to edit in the property view. The property editor has a property, and a widget to edit that property.
+* Standard Widget: a widget from the standard SWT Library. Few of them are currently available, because they are rarely needed.
+The Tree allows reordering or removing easily the elements (Through drag & drop, delete). The editor also supports the Undo/Redo commands.
+
+=====Preview=====
+
+The preview displays a real-time overview of the selected View. However, some widgets can only be computed at runtime, which prevents a pertinent preview. This is the case of the 'Enum Radio' widget, for example, as the enumerated values are only known at runtime.
+
+=====Property view=====
+
+The property view is used to edit the properties of the element selected in the tree. The property view uses the Papyrus Property View framework, thus can be customized just the same way you would customize any other property view.
+
+[[File:images/fig4.png| the three panes of the Property view editor]]
+
+=== Priorities between views ===
+When more than one view match a selection, a priority mechanism will determine which one(s) should be displayed. The priorities are defined at the level of the view's constraints, i.e. if the constraint for a View A overrides a constraint for the View B, the View B won't be displayed. For example, a UML Class from a Class Diagram will match many views (The list is not exhaustive):
+
+* SingleClass (From UML)
+* MultipleClass (As the -1 multiplicity actually means 'any number of elements')
+* SingleElement (And MultipleElement)
+* SingleClassifier (And MultipleClassifier)
+* *Style (From GMF Notation model)
+* StereotypeDisplay (From UML Notation model)
+
+The priorities are computed in two ways:
+
+* Automatic, according to the Java constraints implementations
+* Statically, according to the property view configuration
+
+When the 'isOverrideable' property is set to false for a Constraint (In the property view model), only the static rules will be taken into account.
+
+[[File:images/fig5.png|The constraint cannot be dynamically overridden]]
+
+The automatic rules are the following:
+
+* A constraint with a multiplicity of 1 always overrides the same constraint with a multiplicity of -1 (Or >1). Thus, 'MultipleClass' won't be displayed, because 'SingleClass' also matches our selection.
+* An EMF (Or UML) 'Instance of' constraint always overrides a constraint matching a supertype. Thus, 'SingleClassifier' won't be displayed, because a Class is more specific than a Classifier. However, 'SingleElement' *will be* displayed, because it is not overrideable (isOverrideable=false).
+* A stereotype constraint (HasStereotype) will *not* override its UML 'Instance of' constraint. However, a specific implementation of this constraint has been provided for Scade, which *will* override the UML metaclass (i.e., a Block will override a Class' property view, hiding the UML tab).
+* For CompositeConstraints: if a composite constraint is a superset of another constraint, it will override it (It is more specific). For example, a Composite Constraint 'isA and isB' will override a constraint 'isB', but will not override a constraint 'isB and isC'.
+
+Please note that each constraint has its own implementation of the overrides() method. See the advanced chapter for more information
+
+The static rule is simple: when a Constraint explicitly overrides another constraint, it will always override it. This is especially useful when you've marked a constraint as 'overrideable=false', but still want to override it in a specific case (Remember that overrideable=false only applies to *automatic* constraint resolution).
+
+[[File:images/fig6.png|Force this constraint to override another constraint]]
+
+
+Finally, in the previous example, the following views will be displayed:
+
+* SingleClass (Overrides MultipleClass, Single/MultipleClassifier ; UML Tab)
+* SingleElement (overrideable=false ; Profile tab)
+* FillStyle, FontStyle, LineStyle (Appearance tab)
+* StereotypeDisplay (overrideable=false ; Appearance tab)
+
+====Preferences====
+
+When you make a copy of a property view, it is not automatically activated. Thus, the modifications brought to the copy are not immediately visible on your property view. To activate a property view, you need to open the Papyrus preferences, from Window > Preferences.
+
+[[File:images/fig7.png|Preferences]]
+
+When making a copy of an existing configuration, you should uncheck the default one, and check the new one.
+
+===Advanced Customization===
+
+The customization tool only allows basic operations, such as adding, removing or reordering properties.
+
+The property view framework is much more powerful, but this requires some Java development. This chapter will focus on the advanced customization of the property view.
+
+====The Environment model====
+
+To associate Java implementations with the property view model, you need to declare an Environment model. You can create a new Environment model with the 'Environment Model' wizard in 'Example EMF Model Creation Wizards' category. Select 'Environment' as the Model Object.
+
+Once you've added your Java class declarations, you should register the environment model so that the property view knows about it. Add an extension to org.eclipse.papyrus.properties.environment, and select your model file.
+
+====Create a new widget====
+
+You can create new widgets for the property view. There are four kinds of graphical elements: CompositeWidget, Layout, StandardWidget and PropertyEditor.
+The widgets contain three common fields:
+
+* Label: The label displayed in the Customization editor when the user selects a widget type.
+* Namespace: The XWT namespace associated to the Widget.
+* WidgetClass: The simple name of the Java class implementing the Widget.
+
+The PropertyEditor contains two additional fields:
+
+* Multiplicity: The multiplicity of the properties it can handle (1 for single-valued properties, -1 for multivalued properties)
+* Type: The type of the properties it can handle.
+
+To implement a Composite, Layout or Standard widget, you should simply follow the SWT rules, i.e. extend either Composite, Canvas or Layout, and have a (Composite, int) constructor. To define a PropertyEditor, you have two options:
+
+* Extend Composite, have a (Composite, int) constructor, and implement the CustomizablePropertyEditor interface (From org.eclipse.papyrus.properties.widgets)
+* Extend directly AbstractPropertyEditor (From org.eclipse.papyrus.properties.widgets)
+
+====Constraints====
+
+Adding a Constraint is similar to creating a new Widget. You have two options to implement a new Constraint:
+
+* Implement the Constraint interface (From org.eclipse.papyrus.properties.constraints)
+* Extend the AbstractConstraint class (From org.eclipse.papyrus.properties.constraints)
+
+The important methods are the following (depending on whether you're implement Constraint or extending AbstractConstraint):
+
+* setDescriptor/setConstraintDescriptor:
+** Configures the constraint.
+* match(Object)/match(IStructuredSelection) : Boolean
+** Indicates whether this constraint matches the given given or not
+* overrides(Constraint) : Boolean
+** Indicates whether this constraint overrides another constraint or not. A constraint should override another constraint when it is more specific.
+* equivalent(Constraint) : Boolean
+** This is only used by AbstractConstraint. Two constraints are equivalent if they have the same parameters (ConstraintDescriptor). Two equivalent constraints can have different multiplicities.
+
+The equivalent() and overrides() methods are used to automatically resolve constraints conflicts (Two different constraints matching the same element).
+Once the Constraint is implemented, don't forget to register it in your environment model.
+
+====ModelElement====
+
+The ModelElement is the interface between the property view and your domain model. It is used to retrieve information about the object(s) being edited from the property. These informations will be used to configure the widget. AbstractModelElement provides a base implementation for this interface.
+
+All methods from this interface take a single parameter, which is the name of the property being edited.
+
+* getObservable(String) / doGetObservable(String) :
+
+This method returns an IObservable which will be used to read and write a single property from the represented object. It should return an IObservableValue for single-valued properties, and IObservableList for multi-valued properties.
+
+* getContentProvider(String) :
+
+This method is only used for reference and enumerated properties. It should return a list of values which can be set to the edited property. Unlike IStructuredContentProvider, this provider will not rely on a StructuredViewer to retrieve an input object: the method getElement() will be called without any parameter, so the implementation should be able to retrieve its own typically. This will typically be achieved by passing a context object in the provider's constructor.
+
+* getLabelProvider(String) :
+
+This method is used to display an element's label for a few widgets. Note that the same instance of label provider can be used by more than one Viewer for a given property. For example, the MultiReference widget will display three viewers, each using the same label provider. Each viewer will try to dispose the LabelProvider as soon as they are themselves disposed (For example, when closing the selection dialog from MultiReference). Thus, you should probably not implement the dispose() method, to avoid inconsistent providers.
+
+* getValidator(String) :
+
+This method returns an IValidator, if there's one which is set up for the current property.
+
+====ModelElement Factory====
+
+The ModelElements are associated to DataContextElements through a ModelElementFactory. The ModelElementFactory is defined on the DataContextRoot. All children of a DataContextRoot will share the same ModelElementFactory.
+
+To add a new ModelElement, you should also create a new ModelElementFactory, and register it in your Environment model. Then, you can set this factory to your DataContextRoot.
+
+Note: to display the Data contexts, you need to check the toggle button on top of the editor: [[File:images/fig8.png]]
+
+[[File:images/fig9.png|The UML DataContextRoots, with their own factories]]
+
+====Content Providers and Widgets====
+
+Note: The ContentProviders have been refactored in Papyrus 0.9, to be simplified. However, most of this chapter should remain true.
+
+The ContentProvider is a complex features, which often evolves in the Papyrus property view. The ModelElement has been designed to be compatible with many kinds of different widgets (Combo-box, Tree-based dialogs'). The problem is that these widgets typically use different kinds of JFace ContentProvider (IStructuredContentProvider for flat display, ITreeContentProvider for Tree display). In the Property view, we needed to unify these providers.
+
+Thus, it is recommended to use a IHierarchicContentProvider, which extends ITreeContentProvider, with an additional method: isValidValue(Object). In a Tree, we typically have two kinds of elements: the elements which can potentially be selected, and their containers, which often cannot. The isValidValue() method is used to distinguish between these values.
+
+When a flat widget (e.g. ReferenceCombo) is used, only the valid values will be displayed. When a tree-based widget (e.g. ReferenceDialog) is used, a sub-tree will be displayed, excluding the sub-trees which don't contain any valid value. Moreover, the invalid values won't be selectable (For example, in the ReferenceDialog, the 'ok' button will be grayed).
+
+[[File:images/fig10.png|IHierarchicContentProvider at runtime]]
+
+====Dynamic sections====
+
+Sometimes, the property view should not depend on a selection, but on a specific property of the selected element. In such a case, it is frequent that this specific property might be edited by the property view itself. However, the property view is only refreshed when the selection changes.
+
+To overcome this problem, Papyrus offers a 'Dynamic section' feature, which allows refreshing dynamically one or more sections of the property view. For example, when you're editing a View's constraint in the Property view Editor, the constraint's properties directly depend on the constraint's type. When you select an UML constraint, the constraint's parameter is the name of a UML Metaclass. When you select an EMF constraint, the constraint has two parameters: Namespace URI of the Metamodel, and the name of the Metaclass. Changing the constraint type should also change the constraint's parameters editors.
+
+[[File:images/fig11.png|A view with a static and a dynamic section]]
+
+This can be achieved with dynamic sections, i.e. a section with a constraint. The constraint will be executed once at the beginning, and once again each time a property from the property view changes. If the constraint is matched, the section will be displayed. Otherwise, it will be hidden.
+A view with dynamic sections will typically look like the following:
+
+* A single unconstrained section containing the common parameters
+* One dynamic (i.e. constrained) section for each specific case
+
+[[File:images/fig12.png|Dynamic sections configuration]]
+
+Please note that tabs cannot be added nor removed dynamically. For example, when you apply a stereotype on a UML Element, the tab associated to the stereotype's property view cannot be displayed until you select the element again.
+
+====Property view Header====
+The Eclipse Tabbed Property View offers an extension point to define the label provider for the property view header. However, this label provider will be specific to the editor. For generic editors, it is not always possible to provide a pertinent label provider: they will always be too generic, and won't be able to handle specific elements. For example, a generic EMF Model Editor with the customizable property view will only be able to display standard EMF labels and icons. To overcome this problem, Papyrus offers a configurable label provider for the header: org.eclipse.papyrus.properties.provider.SelectionLabelProvider
+
+This label provider uses the selected element to find the most appropriate label provider, then dispatches the getText and getIcon calls to it. This label provider can be configured through an extension point: org.eclipse.papyrus.properties.labelprovider
+
+This extension point takes an implementation of IFilteredLabelProvider and a priority. The IFilteredLabelProvider is a label provider with an additional method: boolean accept(IStructuredSelection). For each selection, the label provider accepting the selection, and having the highest priority will be used to display a header for it. It will then be possible to define a generic label provider for all java objects, with the lowest priority; another generic label provider for all EMF Objects, and a really specific label provider for a given metamodel (with the highest priority).
+In Papyrus, we have such an example for UML. The Papyrus UML Diagrams use the GMF model, which doesn't have icons. We wanted to have a different icon for each type of Diagram: this is not possible with a standard EMF label provider, which associates an icon to an EClass, independently of its instances' attributes.
+
+So, we registered the standard EMF Label Provider with a medium priority, which can handle any kind of EObject, and a UML Label Provider, which can only handle UML Elements and GMF Diagrams, with a higher priority.
+
+The lower the priority number, the higher the priority actually is:
+
+* 100: Lowest priority. The standard EMF Object label provider has a priority of 100, and is called iff no other label provider can accept an EObject.
+* 50: Medium priority. The Papyrus UML Label Provider has a priority of 50.
+* 10: High priority.
+* 0: Highest priority.
+
+If no label provider matches the selection, the default JFace LabelProvider is used.
+
+====Binding and Validation====
+
+View Properties support JFace Databinding, which connects our UI to our model. For the validation there are two kinds of validators:
+
+* Widget validators: they check that our input is the kind of data expected by our widget before synchronizing it ( e.g IntegerEditor must have a correct integer for input)
+
+* Model validators: they check that our input verifies our model constraint, they must be instantiate in UmlModelElement#getValidator();
+
+If there are errors during the binding a control decoration is shown next to the widget. It also supports three level of severity (Ok, Warning, Error).
+
+[[File:images/fig13.png|Example of binding with a model validator and warning severity result]]
+
+====Field coloration====
+
+Properties views have fields' coloration. If you modify a value the background of the field will be orange, when you validate a change the background will turn green for couple of seconds if the synchronization was successful, it will turn red otherwise.
+
+[[File:images/fig14.png|Example of a field being modified]]
+
+===Generation Tool===
+
+Editing an existing property view can be useful, but most of the time, you'll want a brand new configuration for your own profile or meta-model. Thus, the framework provides a tool to automatically generate the initial property view, which you can then customize using the customization tool.
+The generator can create a property view configuration from either a UML Profile or an Ecore Meta-model. The wizard is available in the Papyrus category: File -> New -> Other' -> Papyrus/Property view configuration.
+
+The wizard provides two default generators:
+
+* Generate a property view from a UML Profile
+* Generate a property view from an Ecore Meta-model
+
+The source file must be located in your workspace. A default target file named will be filled with the .ctx extension (This is the extension for a property view configuration).
+
+Press next: a combo asks you which strategy to use.
+
+A basic method: all the elements from the profile or meta-model will be extracted, with no dependencies to other models.
+
+Same CTX file: you are asked to choose which models you want to extract, and will be saved in the same file
+
+Different CTX file(s): you are asked to choose which models you want to extract and they will be saved in different files, (each profile name will be the name of the generated ctx file)
+
+Press next: a table with all the elements extracted from your profile or meta-model is displayed. This table contains four columns:
+
+* Field: the name of the element or property
+* Display single: whether this property should be displayed when a single instance of this element is selected
+* Display multiple: whether this property should be displayed when more than one instance of this element is selected
+* Description: the description of the property (Most of the time, it will be N/A, as the default generators cannot extract the documentation from the source model).
+
+Press finish: two files or more files according to the chosen strategy and a folder are generated:
+
+* The *.ctx file, corresponding to your property view configuration
+* The ui/ folder, containing a set of XWT files, which contain the graphical information of your property views
+* The *FieldSelection.xmi file, which reminds the choices you've made about displaying each property. This file is currently unused.
+
+You can now open the *.ctx file and customize your property view.
+
+
+===Deploying a property view===
+
+Papyrus provides a simple tool to deploy a property view locally (Right click on a CTX file -> Deploy/Undeploy)
+
+==Multipllicity Editor==
+===Description===
+The multiplicity editor contains two modes of edition:
+* The '''simple''' mode which allows to edit the lower and the upper values from a unique editor
+* The '''advanced''' mode which allows to edit the lower and the upper values from two editors of ValueSpecification.
+
+===Usage===
+====Simple mode====
+The simple mode is represented as the following:
+
+[[File:images/simpleMode.png]]
+
+This editor must be filled by the following pattern:
+{| class="wikitable" border="1" cellspacing="0"
+! Value filled
+! Lower value
+! Upper value
+|-
+| 1
+| <code>null</code> (default value is '''1''')
+| <code>null</code> (default value is '''1''')
+|-
+| x..y
+| <code>LiteralInteger</code> with value '''x'''
+| <code>LiteralUnlimitedNatural</code> with value '''y'''
+|-
+| x..*
+| <code>LiteralInteger</code> with value '''x'''
+| <code>LiteralUnlimitedNatural</code> with value '''-1''' (interpreted as <code>*</code>)
+|-
+| x
+| <code>LiteralInteger</code> with value '''x'''
+| <code>LiteralUnlimitedNatural</code> with value '''x'''
+|}
+
+The values set as lower and upper are always positive (except the <code>*</code> for the upper which is valued as '''-1''').
+
+This editor is usable only when the lower ValueSpecification is a <code>LiteralInteger</code> or <code>null</code> and when the upper ValueSpecification is a <code>LiteralUnlimitedNatural</code> or <code>null</code>.
+On the other hand, this editor will be displayed like the following:
+
+[[File:images/simpleModeDisabled.png]]
+
+====Advanced mode====
+=====Simple ValueSpecification editor=====
+The advanced mode with simple ValueSpecificatiton editors is represented as the following:
+
+[[File:images/advancedMode.png]]
+
+The lower and the upper ValueSpecification can be created/edited/deleted by the buttons:
+
+[[File:images/buttonsEdit.png]]
+
+=====XText ValueSpecification editor=====
+The advanced mode with XText ValueSpecification editors is represented as the following:
+
+[[File:images/advancedModeXText.png]]
+
+This editor use the XText ValueSpecification editors (explain [[Papyrus_User_Guide#UML_ValueSpecification_editor|here]]) with some specificities depending on lower or upper value edition.
+
+The specificity of the '''lower''' ValueSpecification edition is when the value filled is an integer, this one will be handled as <code>LiteralInteger</code> instead of <code>LiteralUnlimitedNatural</code> or <code>LiteralInteger</code> (the <code>*</code> value will create an <code>OpaqueExpression</code>).
+
+The specificity of the '''upper''' ValueSpecification edition is when the value filled is an integer or <code>*</code>:
+* if the integer is '''positive or -1''', a <code>LiteralUnlimitedNatural</code> will be created
+* if the integer is '''negative''', an <code>OpaqueExpression</code> will be created instead of <code>LiteralInteger</code>
+
+====Switch modes====
+This is possible to switch between the two modes by two ways:
+* The button in the multiplicity editor:
+
+[[File:images/buttonSwitch.png]]
+
+* The '''multiplicity editor''' preferences in the '''property views''' preferences:
+
+[[File:images/preferencesMultiplicityEditor.png]]
+
+Regarless of the way used to switch modes, the mode used is saved in the preferences and will be used for each multiplicity in Papyrus. \ No newline at end of file
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/icons/Switch_12x12.gif b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/icons/Switch_12x12.gif
new file mode 100644
index 00000000000..9a6070c38ef
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/icons/Switch_12x12.gif
Binary files differ
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractReferenceDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractReferenceDialog.java
new file mode 100644
index 00000000000..70ef6df522c
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/AbstractReferenceDialog.java
@@ -0,0 +1,182 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class allow to define a reference value editor.
+ */
+public abstract class AbstractReferenceDialog extends AbstractValueEditor implements IReferenceValueEditor {
+
+ /**
+ * Boolean to detect direct creation.
+ */
+ protected boolean directCreation;
+
+ /**
+ * Indicates whether the widget requires a value or not. If it is mandatory,
+ * it cannot delete/unset its value
+ */
+ protected boolean mandatory;
+
+ /**
+ * Boolean to determinate if the editors are read-only.
+ */
+ protected boolean readOnly;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected AbstractReferenceDialog(final Composite parent) {
+ super(parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ * @param label
+ * The label.
+ */
+ protected AbstractReferenceDialog(final Composite parent, final int style, final String label) {
+ super(parent, style, label);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ */
+ protected AbstractReferenceDialog(final Composite parent, final int style) {
+ super(parent, style);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param label
+ * The label.
+ */
+ protected AbstractReferenceDialog(final Composite parent, final String label) {
+ super(parent, label);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#setContentProvider(org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider)
+ */
+ @Override
+ public abstract void setContentProvider(final IStaticContentProvider provider);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#setLabelProvider(org.eclipse.jface.viewers.ILabelProvider)
+ */
+ @Override
+ public abstract void setLabelProvider(final ILabelProvider provider);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#setValueFactory(org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory)
+ */
+ @Override
+ public abstract void setValueFactory(final ReferenceValueFactory factory);
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#updateControls()
+ */
+ @Override
+ public abstract void updateControls();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#setDirectCreation(boolean)
+ */
+ @Override
+ public void setDirectCreation(final boolean directCreation) {
+ this.directCreation = directCreation;
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.IReferenceValueEditor#setMandatory(boolean)
+ */
+ @Override
+ public void setMandatory(final boolean mandatory) {
+ this.mandatory = mandatory;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#getValue()
+ */
+ @Override
+ public abstract Object getValue();
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#getEditableType()
+ */
+ @Override
+ public Object getEditableType() {
+ return Object.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#setReadOnly(boolean)
+ */
+ @Override
+ public void setReadOnly(final boolean readOnly) {
+ this.readOnly = readOnly;
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/IReferenceValueEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/IReferenceValueEditor.java
new file mode 100644
index 00000000000..a546674dfea
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/IReferenceValueEditor.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+
+/**
+ * This interface allow to define the reference value editor methods to implements.
+ */
+public interface IReferenceValueEditor {
+
+ /**
+ * Updates the buttons' status
+ */
+ void updateControls();
+
+ /**
+ * Updates the displayed label for the current value
+ */
+ void updateLabel();
+
+ /**
+ * Sets the Content provider for this editor
+ *
+ * @param provider
+ * The content provider used to retrieve the possible values for this Reference.
+ */
+ void setContentProvider(final IStaticContentProvider provider);
+
+ /**
+ * Sets the Label provider for this editor If the label provider is null, a
+ * default one will be used. The same label provider is used for both the
+ * editor's label and the selection dialog.
+ *
+ * @param provider
+ * The label provider.
+ */
+ void setLabelProvider(final ILabelProvider provider);
+
+ /**
+ * Sets the factory.
+ *
+ * @param factory
+ * The reference value factory.
+ */
+ void setValueFactory(final ReferenceValueFactory factory);
+
+ /**
+ * Sets the direct creation value.
+ *
+ * @param directCreation
+ * Boolean to determinate the direct creation value.
+ */
+ void setDirectCreation(final boolean directCreation);
+
+ /**
+ * Sets the mandatory.
+ *
+ * @param mandatory
+ * The mandatory boolean value.
+ */
+ void setMandatory(final boolean mandatory);
+
+ /**
+ * Sets the read only value.
+ *
+ * @param readOnly
+ * The read only value.
+ */
+ void setReadOnly(final boolean readOnly);
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultiplicityDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultiplicityDialog.java
new file mode 100644
index 00000000000..2c8766fd456
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/MultiplicityDialog.java
@@ -0,0 +1,605 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.messages.Messages;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.util.MultiplicityConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * The multiplicity dialog which allow to define 2 'modes' : The simple mode with a string combo editor and the advanced with 2 editors of ValueSpecification.
+ */
+public class MultiplicityDialog extends AbstractValueEditor implements SelectionListener, IChangeListener {
+
+ /**
+ * The string combo index in the list of editors.
+ */
+ protected static final int MULTIPLICITY_STRING_COMBO_INDEX = 0;
+
+ /**
+ * The lower value editor index in the list of editors.
+ */
+ protected static final int MULTIPLICITY_LOWER_VALUE_INDEX = 1;
+
+ /**
+ * The upper value editor index in the list of editors.
+ */
+ protected static final int MULTIPLICITY_UPPER_VALUE_INDEX = 2;
+
+
+ /**
+ * The stack layout for the 'mode' of editor to display.
+ */
+ protected StackLayout stackLayout;
+
+ /**
+ * The string combo editor for the 'simple' mode.
+ */
+ protected StringCombo stringComboEditor;
+
+ /**
+ * The parent stack layout composite.
+ */
+ protected Composite stackLayoutComposite;
+
+ /**
+ * The composite which contains the 'advanced' mode editors.
+ */
+ protected Composite doubleEditorsComposite;
+
+ /**
+ * The lower value specification editor.
+ */
+ protected AbstractReferenceDialog lowerValueEditor;
+
+ /**
+ * The upper value specification editor.
+ */
+ protected AbstractReferenceDialog upperValueEditor;
+
+ /**
+ * The switch editors button.
+ */
+ protected Button switchEditorsButton;
+
+ /**
+ * Boolean to determinate if the editors are read-only.
+ */
+ protected boolean readOnly;
+
+ /**
+ * The preference store.
+ */
+ protected IPreferenceStore preferenceStore;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ */
+ public MultiplicityDialog(final Composite parent, final int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ * @param preferenceStore
+ * The preference store.
+ */
+ public MultiplicityDialog(final Composite parent, final int style, final IPreferenceStore preferenceStore) {
+ super(parent, style);
+
+ // Create the stack layout composite
+ stackLayout = new StackLayout();
+ stackLayoutComposite = new Composite(this, style);
+ stackLayoutComposite.setLayout(stackLayout);
+ stackLayoutComposite.setLayoutData(getDefaultLayoutData());
+
+ // Create the string combo editor
+ stringComboEditor = new StringCombo(stackLayoutComposite, style);
+ stringComboEditor.setLayoutData(getDefaultLayoutData());
+
+ // Create the composite which contains the lower and the upper value specification editors
+ doubleEditorsComposite = new Composite(stackLayoutComposite, style);
+ final GridLayout layout = new GridLayout(2, true);
+ // Manage the height and the width (for a better visualization)
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ doubleEditorsComposite.setLayout(layout);
+ doubleEditorsComposite.setLayoutData(getDefaultLayoutData());
+
+ // Create the lower ValueSpecification editor
+ lowerValueEditor = createLowerValueSpecificationEditor(doubleEditorsComposite, style);
+ lowerValueEditor.setLayoutData(getDefaultLayoutData());
+
+ // Create the upper ValueSpecification editor
+ upperValueEditor = createUpperValueSpecificationEditor(doubleEditorsComposite, style);
+ upperValueEditor.setLayoutData(getDefaultLayoutData());
+
+ // Add a property change listener on the preference
+ this.preferenceStore = preferenceStore;
+ if (null != preferenceStore) {
+ this.preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
+
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ displayTopControl();
+ }
+ });
+ }
+
+ displayTopControl();
+
+ createButtons();
+ updateControls();
+ }
+
+ /**
+ * This allow to create the lower ValueSpecification editor.
+ *
+ * @param parent
+ * The parent composite
+ * @param style
+ * The style.
+ * @return The create lower ValueSpecification editor.
+ */
+ protected AbstractReferenceDialog createLowerValueSpecificationEditor(final Composite parent, final int style) {
+ return createValueSpecificationEditor(parent, style);
+ }
+
+ /**
+ * This allow to create the upper ValueSpecification editor.
+ *
+ * @param parent
+ * The parent composite
+ * @param style
+ * The style.
+ * @return The create upper ValueSpecification editor.
+ */
+ protected AbstractReferenceDialog createUpperValueSpecificationEditor(final Composite parent, final int style) {
+ return createValueSpecificationEditor(parent, style);
+ }
+
+ /**
+ * This allow to create the ValueSpecification editor.
+ *
+ * @param parent
+ * The parent composite
+ * @param style
+ * The style.
+ * @return The create ValueSpecification editor.
+ */
+ protected AbstractReferenceDialog createValueSpecificationEditor(final Composite parent, final int style) {
+ return new ReferenceDialog(parent, style);
+ }
+
+ /**
+ * This allow to create the buttons.
+ */
+ protected void createButtons() {
+ ((GridLayout) getLayout()).numColumns++;
+
+ switchEditorsButton = factory.createButton(this, null, SWT.PUSH);
+ switchEditorsButton.setImage(Activator.getDefault().getImage("/icons/Switch_12x12.gif")); //$NON-NLS-1$
+ switchEditorsButton.setToolTipText(Messages.MultiplicityReferenceDialog_SwitchEditors);
+ switchEditorsButton.addSelectionListener(this);
+ }
+
+ /**
+ * This allow to manage the stack layout top control displayed.
+ */
+ protected void displayTopControl() {
+ final String multiplicityEditorMode = preferenceStore.getString(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE);
+ if (null != preferenceStore && null != multiplicityEditorMode) {
+ // If the advanced mode is used, display the double editors composite, else use the simple mode with the string combo
+ stackLayout.topControl = multiplicityEditorMode.equals(MultiplicityConstants.ADVANCED_MODE) ? doubleEditorsComposite : stringComboEditor;
+ } else {
+ if (null == stackLayout.topControl) {
+ stackLayout.topControl = stringComboEditor;
+ }
+ }
+
+ if (!stackLayoutComposite.isDisposed()) {
+ stackLayoutComposite.layout();
+ }
+ setReadOnly(readOnly);
+ updateLabels();
+ }
+
+ /**
+ * This allow to define the switch action for the switch buttons.
+ */
+ protected void switchAction() {
+ if (null != preferenceStore) {
+ if (stackLayout.topControl.equals(stringComboEditor)) {
+ preferenceStore.setValue(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE, MultiplicityConstants.ADVANCED_MODE);
+ } else {
+ preferenceStore.setValue(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE, MultiplicityConstants.SIMPLE_MODE);
+ }
+ } else {
+ stackLayout.topControl = stackLayout.topControl.equals(stringComboEditor) ? doubleEditorsComposite : stringComboEditor;
+ }
+ // Refresh the read only value (because the lower and upper values must be different and multiplicity may not be update by simple editor)
+ displayTopControl();
+ }
+
+ /**
+ * Updates the displayed label for the current value
+ */
+ protected void updateLabels() {
+ lowerValueEditor.updateLabel();
+ upperValueEditor.updateLabel();
+ }
+
+ /**
+ * This allow to update the controls.
+ */
+ protected void updateControls() {
+ if (stackLayout.topControl.equals(stringComboEditor)) {
+ if (!stringComboEditor.isDisposed()) {
+ stringComboEditor.updateControls();
+ }
+ } else {
+ if (!lowerValueEditor.isDisposed()) {
+ lowerValueEditor.updateControls();
+ }
+
+ if (!upperValueEditor.isDisposed()) {
+ upperValueEditor.updateControls();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.widgets.Control#update()
+ */
+ @Override
+ public void update() {
+ super.update();
+ if (stackLayout.topControl.equals(stringComboEditor)) {
+ if (!stringComboEditor.isDisposed()) {
+ stringComboEditor.update();
+ }
+ } else {
+ if (!lowerValueEditor.isDisposed()) {
+ lowerValueEditor.update();
+ }
+
+ if (!upperValueEditor.isDisposed()) {
+ upperValueEditor.update();
+ }
+ }
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractListEditor#doBinding()
+ */
+ @Override
+ protected void doBinding() {
+ super.doBinding();
+ if (null != stringComboEditor) {
+ stringComboEditor.doBinding();
+ }
+ if (null != lowerValueEditor) {
+ lowerValueEditor.doBinding();
+ }
+ if (null != upperValueEditor) {
+ upperValueEditor.doBinding();
+ }
+ modelProperty.addChangeListener(this);
+ }
+
+ /**
+ * Sets the content providers.
+ *
+ * @param providers
+ * The content providers for each editor.
+ */
+ public void setContentProviders(final List<IStaticContentProvider> providers) {
+ stringComboEditor.setContentProvider(getObjectFromList(providers, MULTIPLICITY_STRING_COMBO_INDEX));
+ lowerValueEditor.setContentProvider(getObjectFromList(providers, MULTIPLICITY_LOWER_VALUE_INDEX));
+ upperValueEditor.setContentProvider(getObjectFromList(providers, MULTIPLICITY_UPPER_VALUE_INDEX));
+ }
+
+ /**
+ * Sets the label providers.
+ *
+ * @param providers
+ * The label providers for each editor.
+ */
+ public void setLabelProviders(final List<ILabelProvider> providers) {
+ stringComboEditor.setLabelProvider(getObjectFromList(providers, MULTIPLICITY_STRING_COMBO_INDEX));
+ lowerValueEditor.setLabelProvider(getObjectFromList(providers, MULTIPLICITY_LOWER_VALUE_INDEX));
+ upperValueEditor.setLabelProvider(getObjectFromList(providers, MULTIPLICITY_UPPER_VALUE_INDEX));
+
+ updateControls();
+ updateLabels();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#getEditableType()
+ */
+ @Override
+ public Object getEditableType() {
+ return Object.class;
+ }
+
+ /**
+ * This allow to define if the string combo can be edited.
+ *
+ * @return <code>true</code> if the string combo can be edited, <code>false</code> otherwise.
+ */
+ protected boolean canEditStringCombo() {
+ return true;
+ }
+
+ /**
+ * This allow to define if the lower value can be edited.
+ *
+ * @return <code>true</code> if the lower value can be edited, <code>false</code> otherwise.
+ */
+ protected boolean canEditLowerValue() {
+ return true;
+ }
+
+ /**
+ * This allow to define if the upper value can be edited.
+ *
+ * @return <code>true</code> if the upper value can be edited, <code>false</code> otherwise.
+ */
+ protected boolean canEditUpperValue() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractListEditor#setModelObservable(org.eclipse.core.databinding.observable.list.IObservableList)
+ */
+ @Override
+ public void setModelObservable(final IObservableValue modelProperty) {
+ setWidgetObservable(modelProperty);
+ setEditorsModelObservable(modelProperty);
+ super.setModelObservable(modelProperty);
+
+ updateControls();
+ updateLabels();
+ }
+
+ /**
+ * Sets the model properties for the editors.
+ *
+ * @param modelProperty
+ * The observable value.
+ */
+ protected void setEditorsModelObservable(final IObservableValue modelProperty) {
+ if (null != modelProperty && modelProperty.getValue() instanceof List<?>) {
+ final Object stringComboObservableValue = getObjectFromList((List<?>) modelProperty.getValue(), MULTIPLICITY_STRING_COMBO_INDEX);
+ if (stringComboObservableValue instanceof IObservableValue) {
+ stringComboEditor.setModelObservable((IObservableValue) stringComboObservableValue);
+ }
+ final Object lowerValueObservableValue = getObjectFromList((List<?>) modelProperty.getValue(), MULTIPLICITY_LOWER_VALUE_INDEX);
+ if (lowerValueObservableValue instanceof IObservableValue) {
+ lowerValueEditor.setModelObservable((IObservableValue) lowerValueObservableValue);
+ }
+ final Object upperValueObservableValue = getObjectFromList((List<?>) modelProperty.getValue(), MULTIPLICITY_UPPER_VALUE_INDEX);
+ if (upperValueObservableValue instanceof IObservableValue) {
+ upperValueEditor.setModelObservable((IObservableValue) upperValueObservableValue);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
+ */
+ @Override
+ public void setToolTipText(String text) {
+ stringComboEditor.setToolTipText(text);
+ lowerValueEditor.setToolTipText(Messages.MultiplicityReferenceDialog_LowerValueToolTip);
+ upperValueEditor.setToolTipText(Messages.MultiplicityReferenceDialog_UpperValueToolTip);
+ }
+
+ /**
+ * Sets the value factories.
+ *
+ * @param factories
+ * The Reference Value factories.
+ */
+ public void setValueFactories(final List<ReferenceValueFactory> factories) {
+ lowerValueEditor.setValueFactory(getObjectFromList(factories, MULTIPLICITY_LOWER_VALUE_INDEX));
+ upperValueEditor.setValueFactory(getObjectFromList(factories, MULTIPLICITY_UPPER_VALUE_INDEX));
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#setReadOnly(boolean)
+ */
+ @Override
+ public void setReadOnly(final boolean readOnly) {
+ this.readOnly = readOnly;
+ if (stackLayout.topControl.equals(stringComboEditor)) {
+ if (!stringComboEditor.isDisposed()) {
+ stringComboEditor.setReadOnly(readOnly || !canEditStringCombo());
+ }
+ } else {
+ if (!lowerValueEditor.isDisposed()) {
+ lowerValueEditor.setReadOnly(readOnly || !canEditLowerValue());
+ }
+ if (!upperValueEditor.isDisposed()) {
+ upperValueEditor.setReadOnly(readOnly || !canEditUpperValue());
+ }
+ }
+ updateControls();
+ }
+
+ /**
+ * This allow to set the direct creation of the lower and the upper value editors.
+ *
+ * @param directCreation
+ * The direct creation value.
+ */
+ public void setDirectCreation(final boolean directCreation) {
+ lowerValueEditor.setDirectCreation(directCreation);
+ upperValueEditor.setDirectCreation(directCreation);
+ updateControls();
+ }
+
+ /**
+ * This allow to set the mandatory of the lower and the upper value editors.
+ *
+ * @param mandatory
+ * The mandatory value.
+ */
+ public void setMandatory(final boolean mandatory) {
+ lowerValueEditor.setMandatory(mandatory);
+ upperValueEditor.setMandatory(mandatory);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ Widget widget = e.widget;
+ if (widget == switchEditorsButton) {
+ switchAction();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected(final SelectionEvent e) {
+ // Nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.widgets.Widget#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (null != stringComboEditor) {
+ stringComboEditor.dispose();
+ }
+ if (null != lowerValueEditor) {
+ lowerValueEditor.dispose();
+ }
+ if (null != upperValueEditor) {
+ upperValueEditor.dispose();
+ }
+ super.dispose();
+ }
+
+ /**
+ * Get the object index from the list of objects.
+ *
+ * @param listObjects
+ * The list of objects.
+ * @param index
+ * The index object to get.
+ * @return The object at the index position or <code>null</code>.
+ */
+ protected <T> T getObjectFromList(final List<T> listObjects, final int index) {
+ T object = null;
+ if (null != listObjects && !listObjects.isEmpty()) {
+ if (listObjects.size() > index) {
+ object = listObjects.get(index);
+ }
+ }
+ return object;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#getValue()
+ *
+ * @return
+ */
+ @Override
+ public Object getValue() {
+ return modelProperty.getValue();
+ }
+
+ /**
+ * Redefine this method to re-affect the correct observable value to each editors.
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
+ */
+ @Override
+ public void handleChange(ChangeEvent event) {
+ // Manage the modification of observable values by runnable to not freeze the UI modification
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ setEditorsModelObservable(modelProperty);
+ }
+ });
+ }
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
index 1103051c9dc..057bd68e903 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/ReferenceDialog.java
@@ -1,606 +1,620 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * 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
- * Thibault Le Ouay t.leouay@sherpa-eng.com - Add binding implementation
- * Christian W. Damus (CEA) - bug 402525
- * Christian W. Damus (CEA) - bug 443497
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.editors;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.widgets.Activator;
-import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
-import org.eclipse.papyrus.infra.widgets.databinding.CLabelObservableValue;
-import org.eclipse.papyrus.infra.widgets.databinding.ReferenceDialogObservableValue;
-import org.eclipse.papyrus.infra.widgets.messages.Messages;
-import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * An editor representing a single reference as a Label A filtered selection
- * dialog is used to edit the value. Also offers support for unsetting the
- * value. This Editor needs a ContentProvider, and may use an optional
- * LabelProvider, describing the objects that can be referred by this property
- *
- * @author Camille Letavernier
- *
- */
-public class ReferenceDialog extends AbstractValueEditor implements SelectionListener {
-
- /**
- * The CLabel displaying the current value
- */
- protected final CLabel currentValueLabel;
-
- /**
- * The Button used to browse the available values
- */
- protected Button browseValuesButton;
-
- /**
- * The Button used to create a new instance
- */
- protected Button createInstanceButton;
-
- /**
- * The Button used to edit the current object
- */
- protected Button editInstanceButton;
-
- /**
- * The Button used to unset the current value
- */
- protected Button unsetButton;
-
- /**
- * The label provider used to display the values in both the label and the
- * selection dialog
- */
- protected ILabelProvider labelProvider;
-
- /**
- * The content provider, providing the different possible values for the
- * input object
- */
- protected IStaticContentProvider contentProvider;
-
- /**
- * The dialog used to select the value
- */
- protected final ITreeSelectorDialog dialog;
-
- /**
- * The current value for this editor
- */
- protected Object value;
-
- /**
- * The factory used to create or edit objects directly from this editor
- */
- protected ReferenceValueFactory valueFactory;
-
- /**
- * Indicates whether the widget is read-only or not
- */
- protected boolean readOnly;
-
- private boolean directCreation;
-
- /**
- * Indicates whether the widget requires a value or not. If it is mandatory,
- * it cannot delete/unset its value
- */
- protected boolean mandatory;
-
- private ControlDecoration controlDecoration;
-
- protected boolean error = false;
-
- private Timer timer;
-
- private TimerTask changeColorTask;
-
- private boolean edit = false;
-
- /**
- *
- * Constructs a new ReferenceDialog in the given parent Composite. The style
- * will be applied to the CLabel displaying the current value.
- *
- * @param parent
- * @param style
- */
- public ReferenceDialog(Composite parent, int style) {
- super(parent, style);
- GridData gridData = getDefaultLayoutData();
-
- currentValueLabel = factory.createCLabel(this, null, factory.getBorderStyle() | style);
- currentValueLabel.setLayoutData(gridData);
- currentValueLabel.addMouseListener(new MouseListener() {
-
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- editAction(); // TODO : Try to determine whether the double
- // click should call the edit, create or browse
- // action
- // e.g. if the value is null, try to browse. If we cannot
- // browse, try to create an instance.
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- // Nothing
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
- // Nothing
- }
-
- });
-
- dialog = createDialog(parent.getShell());
-
- createButtons();
- updateControls();
- controlDecoration = new ControlDecoration(currentValueLabel, SWT.TOP | SWT.LEFT);
-
- gridData.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
- }
-
- protected ITreeSelectorDialog createDialog(Shell shell) {
- return new TreeSelectorDialog(shell);
- }
-
- protected void createButtons() {
- ((GridLayout) getLayout()).numColumns += 4;
-
- browseValuesButton = factory.createButton(this, null, SWT.PUSH);
- browseValuesButton.setImage(Activator.getDefault().getImage("/icons/browse_12x12.gif")); //$NON-NLS-1$
- browseValuesButton.setToolTipText(Messages.ReferenceDialog_EditValue);
- browseValuesButton.addSelectionListener(this);
-
- createInstanceButton = factory.createButton(this, null, SWT.PUSH);
- createInstanceButton.setImage(Activator.getDefault().getImage("/icons/Add_12x12.gif")); //$NON-NLS-1$
- createInstanceButton.setToolTipText(Messages.ReferenceDialog_CreateANewObject);
- createInstanceButton.addSelectionListener(this);
-
- editInstanceButton = factory.createButton(this, null, SWT.PUSH);
- editInstanceButton.setImage(Activator.getDefault().getImage("/icons/Edit_12x12.gif")); //$NON-NLS-1$
- editInstanceButton.setToolTipText(Messages.ReferenceDialog_EditTheCurrentValue);
- editInstanceButton.addSelectionListener(this);
-
- unsetButton = factory.createButton(this, null, SWT.PUSH);
- unsetButton.setImage(Activator.getDefault().getImage("/icons/Delete_12x12.gif")); //$NON-NLS-1$
- unsetButton.setToolTipText(Messages.ReferenceDialog_UnsetValue);
- unsetButton.addSelectionListener(this);
- }
-
- /**
- * The action executed when the "browse" button is selected Choose a value
- * from a selection of already created objects
- */
- protected void browseAction() {
- setInitialSelection(Collections.singletonList(getValue()));
- int result = dialog.open();
- if (result == Window.OK) {
- Object[] newValue = dialog.getResult();
- if (newValue == null) {
- return;
- }
-
- if (newValue.length == 0) {
- setValue(null);
- } else {
- Object value = newValue[0];
- if (contentProvider instanceof IAdaptableContentProvider) {
-
- value = ((IAdaptableContentProvider) contentProvider).getAdaptedValue(value);
- }
- setValue(value);
- }
- }
- }
-
- /**
- * The action executed when the "create" button is selected Create a new
- * instance and assign it to this reference
- */
- protected void createAction() {
- if (valueFactory != null && valueFactory.canCreateObject()) {
- final Object context = getContextElement();
- getOperationExecutor(context).execute(new Runnable() {
-
- @Override
- public void run() {
- Object value = valueFactory.createObject(createInstanceButton, context);
- if (value == null) {
- // Cancel the operation
- throw new OperationCanceledException();
- }
- Collection<Object> validatedObjects = valueFactory.validateObjects(Collections.singleton(value));
- if (!validatedObjects.isEmpty()) {
- setValue(validatedObjects.iterator().next());
- }
- }
- }, NLS.bind(Messages.ReferenceDialog_setOperation, labelText));
- }
- }
-
- /**
- * The action executed when the "edit" button is selected Edits the object
- * that is currently selected
- */
- protected void editAction() {
- currentValueLabel.setBackground(EDIT);
- edit = true;
- final Object currentValue = getValue();
- if (currentValue != null && valueFactory != null && valueFactory.canEdit()) {
- getOperationExecutor(currentValue).execute(new Runnable() {
-
- @Override
- public void run() {
- Object newValue = valueFactory.edit(editInstanceButton, currentValue);
-
- // Per the contract of ReferenceValueFactory::edit(), a null return means the object was edited "in place."
- // In that case, there is nothing further to do
- if ((newValue != null) && (newValue != currentValue)) {
- setValue(newValue);
- }
-
- updateLabel();
- }
- }, NLS.bind(Messages.ReferenceDialog_editOperation, labelText));
- }
- }
-
- /**
- * The action executed when the "unset" button is selected Sets the current
- * reference to null
- */
- protected void unsetAction() {
- setValue(null);
- }
-
- /**
- * Updates the displayed label for the current value
- */
- protected void updateLabel() {
- if (binding != null) {
- binding.updateModelToTarget();
-
- } else {
- currentValueLabel.setImage(labelProvider.getImage(getValue()));
- currentValueLabel.setText(labelProvider.getText(getValue()));
- }
- }
-
- /**
- * Sets the Content provider for this editor
- *
- * @param provider
- * The content provider used to retrieve the possible values for
- * this Reference
- */
- public void setContentProvider(IStaticContentProvider provider) {
- dialog.setContentProvider(new EncapsulatedContentProvider(provider));
- if (getValue() != null) {
- setInitialSelection(Collections.singletonList(getValue()));
- }
-
- this.contentProvider = provider;
- }
-
- /**
- * Sets the Label provider for this editor If the label provider is null, a
- * default one will be used. The same label provider is used for both the
- * editor's label and the selection dialog.
- *
- * @param provider
- * The label provider
- */
- public void setLabelProvider(ILabelProvider provider) {
- if (provider == null) {
- setLabelProvider(new LabelProvider());
- return;
- }
-
- dialog.setLabelProvider(provider);
- this.labelProvider = provider;
- if (widgetObservable != null) {
- ((CLabelObservableValue) widgetObservable).setLabelProvider(labelProvider);
- }
- updateLabel();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setLabel(String label) {
- super.setLabel(label);
- dialog.setTitle(label);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getValue() {
- if (modelProperty != null) {
- return modelProperty.getValue();
- }
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object getEditableType() {
- return Object.class;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- updateControls();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isReadOnly() {
- return !currentValueLabel.isEnabled();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void doBinding() {
- super.doBinding();
- }
-
- protected void setInitialSelection(List<?> initialValues) {
- dialog.setInitialElementSelections(initialValues);
- }
-
- @Override
- public void setModelObservable(IObservableValue modelProperty) {
- setWidgetObservable(new ReferenceDialogObservableValue(this, this.currentValueLabel, modelProperty, labelProvider));
- super.setModelObservable(modelProperty);
- updateControls();
- }
-
- @Override
- public void setToolTipText(String text) {
- super.setLabelToolTipText(text);
- currentValueLabel.setToolTipText(text);
- }
-
- public void setValueFactory(ReferenceValueFactory factory) {
- valueFactory = factory;
- updateControls();
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Widget widget = e.widget;
- if (widget == browseValuesButton) {
- browseAction();
- } else if (widget == createInstanceButton) {
- createAction();
- } else if (widget == editInstanceButton) {
- editAction();
- } else if (widget == unsetButton) {
- unsetAction();
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing
- }
-
- /**
- * Updates the buttons' status
- */
- protected void updateControls() {
- // Check if the edit & create buttons should be displayed
- boolean exclude = valueFactory == null || !valueFactory.canCreateObject();
- setExclusion(editInstanceButton, exclude);
- setExclusion(createInstanceButton, exclude);
-
- setExclusion(browseValuesButton, directCreation);
-
- browseValuesButton.setEnabled(!readOnly);
-
- // If they are displayed, check if they should be enabled
- if (!exclude) {
- editInstanceButton.setEnabled(valueFactory != null && valueFactory.canEdit() && getValue() != null);
- createInstanceButton.setEnabled(valueFactory != null && valueFactory.canCreateObject() && !readOnly);
- }
-
- // Do not display unset if the value is mandatory
- setExclusion(unsetButton, mandatory);
- if (!mandatory) {
- boolean enabled = !readOnly;
- enabled = enabled && getValue() != null;
-
- unsetButton.setEnabled(enabled);
- }
- }
-
- @Override
- public void update() {
- super.update();
- updateControls();
- }
-
- public void setDirectCreation(boolean directCreation) {
- this.directCreation = directCreation;
- updateControls();
- }
-
- public void setValue(Object value) {
- this.value = value;
- try {
- if (modelProperty != null) {
- modelProperty.setValue(value);
- error = false;
- }
- } catch (Exception e) {
- error = true;
-
- }
-
- updateControls();
- updateLabel();
- commit();
- }
-
- /**
- * @see org.eclipse.jface.viewers.StructuredViewer#setInput(Object)
- * @param input
- */
- public void setInput(Object input) {
- this.dialog.setInput(input);
- }
-
- public void setMandatory(boolean mandatory) {
- this.mandatory = mandatory;
- }
-
- @Override
- public void updateStatus(IStatus status) {
-
- if (error) {
- FieldDecoration error = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
- controlDecoration.setImage(error.getImage());
- controlDecoration.showHoverText(Messages.ReferenceDialog_0);
- controlDecoration.setDescriptionText(Messages.ReferenceDialog_1);
- controlDecoration.show();
- currentValueLabel.setBackground(ERROR);
- currentValueLabel.update();
-
-
- } else {
- controlDecoration.hide();
- }
- }
-
- @Override
- public void dispose() {
- if (changeColorTask != null) {
- changeColorTask.cancel();
- }
- if (timer != null) {
- timer.cancel();
- }
- super.dispose();
- }
-
- private void cancelCurrentTask() {
- if (changeColorTask != null) {
- changeColorTask.cancel();
- }
- }
-
- @Override
- public void changeColorField() {
- if (!error & !edit) {
-
- if (timer == null) {
- timer = new Timer(true);
- }
-
- cancelCurrentTask();
- changeColorTask = new TimerTask() {
-
- @Override
- public void run() {
- if (ReferenceDialog.this.isDisposed()) {
- return;
- }
- ReferenceDialog.this.getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- if (ReferenceDialog.this.isDisposed()) {// Bug 434787 : Shouldn't not execute the timer thread if the widget is disposed
- return;
- }
- currentValueLabel.setBackground(DEFAULT);
- currentValueLabel.update();
- }
-
-
- });
- }
- };
-
- if (errorBinding) {
- currentValueLabel.setBackground(ERROR);
- currentValueLabel.update();
- } else {
- IStatus status = (IStatus) binding.getValidationStatus().getValue();
- switch (status.getSeverity()) {
- case IStatus.OK:
- case IStatus.WARNING:
- timer.schedule(changeColorTask, 600);
- currentValueLabel.setBackground(VALID);
- currentValueLabel.update();
- break;
- case IStatus.ERROR:
- currentValueLabel.setBackground(ERROR);
- currentValueLabel.update();
- break;
-
- }
- }
- } else {
- currentValueLabel.setBackground(DEFAULT);
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * 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
+ * Thibault Le Ouay t.leouay@sherpa-eng.com - Add binding implementation
+ * Christian W. Damus (CEA) - bug 402525
+ * Christian W. Damus (CEA) - bug 443497
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.databinding.CLabelObservableValue;
+import org.eclipse.papyrus.infra.widgets.databinding.ReferenceDialogObservableValue;
+import org.eclipse.papyrus.infra.widgets.databinding.StyledTextReferenceDialogObservableValue;
+import org.eclipse.papyrus.infra.widgets.messages.Messages;
+import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * An editor representing a single reference as a Label A filtered selection
+ * dialog is used to edit the value. Also offers support for unsetting the
+ * value. This Editor needs a ContentProvider, and may use an optional
+ * LabelProvider, describing the objects that can be referred by this property
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class ReferenceDialog extends AbstractReferenceDialog implements SelectionListener {
+
+ /**
+ * The CLabel displaying the current value
+ */
+ protected final CLabel currentValueLabel;
+
+ /**
+ * The Button used to browse the available values
+ */
+ protected Button browseValuesButton;
+
+ /**
+ * The Button used to create a new instance
+ */
+ protected Button createInstanceButton;
+
+ /**
+ * The Button used to edit the current object
+ */
+ protected Button editInstanceButton;
+
+ /**
+ * The Button used to unset the current value
+ */
+ protected Button unsetButton;
+
+ /**
+ * The label provider used to display the values in both the label and the
+ * selection dialog
+ */
+ protected ILabelProvider labelProvider;
+
+ /**
+ * The content provider, providing the different possible values for the
+ * input object
+ */
+ protected IStaticContentProvider contentProvider;
+
+ /**
+ * The dialog used to select the value
+ */
+ protected final ITreeSelectorDialog dialog;
+
+ /**
+ * The current value for this editor
+ */
+ protected Object value;
+
+ /**
+ * The factory used to create or edit objects directly from this editor
+ */
+ protected ReferenceValueFactory valueFactory;
+
+ /**
+ * Indicates whether the widget is read-only or not
+ */
+ protected boolean readOnly;
+
+ private boolean directCreation;
+
+ /**
+ * Indicates whether the widget requires a value or not. If it is mandatory,
+ * it cannot delete/unset its value
+ */
+ protected boolean mandatory;
+
+ private ControlDecoration controlDecoration;
+
+ protected boolean error = false;
+
+ private Timer timer;
+
+ private TimerTask changeColorTask;
+
+ private boolean edit = false;
+
+ /**
+ *
+ * Constructs a new ReferenceDialog in the given parent Composite. The style
+ * will be applied to the CLabel displaying the current value.
+ *
+ * @param parent
+ * @param style
+ */
+ public ReferenceDialog(Composite parent, int style) {
+ super(parent, style);
+ GridData gridData = getDefaultLayoutData();
+
+ currentValueLabel = factory.createCLabel(this, null, factory.getBorderStyle() | style);
+ currentValueLabel.setLayoutData(gridData);
+ currentValueLabel.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ editAction(); // TODO : Try to determine whether the double
+ // click should call the edit, create or browse
+ // action
+ // e.g. if the value is null, try to browse. If we cannot
+ // browse, try to create an instance.
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ // Nothing
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // Nothing
+ }
+
+ });
+
+ dialog = createDialog(parent.getShell());
+
+ createButtons();
+ updateControls();
+ controlDecoration = new ControlDecoration(currentValueLabel, SWT.TOP | SWT.LEFT);
+
+ gridData.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ }
+
+ protected ITreeSelectorDialog createDialog(Shell shell) {
+ return new TreeSelectorDialog(shell);
+ }
+
+ protected void createButtons() {
+ ((GridLayout) getLayout()).numColumns += 4;
+
+ browseValuesButton = factory.createButton(this, null, SWT.PUSH);
+ browseValuesButton.setImage(Activator.getDefault().getImage("/icons/browse_12x12.gif")); //$NON-NLS-1$
+ browseValuesButton.setToolTipText(Messages.ReferenceDialog_EditValue);
+ browseValuesButton.addSelectionListener(this);
+
+ createInstanceButton = factory.createButton(this, null, SWT.PUSH);
+ createInstanceButton.setImage(Activator.getDefault().getImage("/icons/Add_12x12.gif")); //$NON-NLS-1$
+ createInstanceButton.setToolTipText(Messages.ReferenceDialog_CreateANewObject);
+ createInstanceButton.addSelectionListener(this);
+
+ editInstanceButton = factory.createButton(this, null, SWT.PUSH);
+ editInstanceButton.setImage(Activator.getDefault().getImage("/icons/Edit_12x12.gif")); //$NON-NLS-1$
+ editInstanceButton.setToolTipText(Messages.ReferenceDialog_EditTheCurrentValue);
+ editInstanceButton.addSelectionListener(this);
+
+ unsetButton = factory.createButton(this, null, SWT.PUSH);
+ unsetButton.setImage(Activator.getDefault().getImage("/icons/Delete_12x12.gif")); //$NON-NLS-1$
+ unsetButton.setToolTipText(Messages.ReferenceDialog_UnsetValue);
+ unsetButton.addSelectionListener(this);
+ }
+
+ /**
+ * The action executed when the "browse" button is selected Choose a value
+ * from a selection of already created objects
+ */
+ protected void browseAction() {
+ setInitialSelection(Collections.singletonList(getValue()));
+ int result = dialog.open();
+ if (result == Window.OK) {
+ Object[] newValue = dialog.getResult();
+ if (newValue == null) {
+ return;
+ }
+
+ if (newValue.length == 0) {
+ setValue(null);
+ } else {
+ Object value = newValue[0];
+ if (contentProvider instanceof IAdaptableContentProvider) {
+
+ value = ((IAdaptableContentProvider) contentProvider).getAdaptedValue(value);
+ }
+ setValue(value);
+ }
+ }
+ }
+
+ /**
+ * The action executed when the "create" button is selected Create a new
+ * instance and assign it to this reference
+ */
+ protected void createAction() {
+ if (valueFactory != null && valueFactory.canCreateObject()) {
+ final Object context = getContextElement();
+ getOperationExecutor(context).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ Object value = valueFactory.createObject(createInstanceButton, context);
+ if (value == null) {
+ // Cancel the operation
+ throw new OperationCanceledException();
+ }
+ Collection<Object> validatedObjects = valueFactory.validateObjects(Collections.singleton(value));
+ if (!validatedObjects.isEmpty()) {
+ setValue(validatedObjects.iterator().next());
+ }
+ }
+ }, NLS.bind(Messages.ReferenceDialog_setOperation, labelText));
+ }
+ }
+
+ /**
+ * The action executed when the "edit" button is selected Edits the object
+ * that is currently selected
+ */
+ protected void editAction() {
+ currentValueLabel.setBackground(EDIT);
+ edit = true;
+ final Object currentValue = getValue();
+ if (currentValue != null && valueFactory != null && valueFactory.canEdit()) {
+ getOperationExecutor(currentValue).execute(new Runnable() {
+
+ @Override
+ public void run() {
+ Object newValue = valueFactory.edit(editInstanceButton, currentValue);
+
+ // Per the contract of ReferenceValueFactory::edit(), a null return means the object was edited "in place."
+ // In that case, there is nothing further to do
+ if ((newValue != null) && (newValue != currentValue)) {
+ setValue(newValue);
+ }
+
+ updateLabel();
+ }
+ }, NLS.bind(Messages.ReferenceDialog_editOperation, labelText));
+ }
+ }
+
+ /**
+ * The action executed when the "unset" button is selected Sets the current
+ * reference to null
+ */
+ protected void unsetAction() {
+ setValue(null);
+ }
+
+ /**
+ * Updates the displayed label for the current value
+ */
+ public void updateLabel() {
+ if (binding != null) {
+ binding.updateModelToTarget();
+
+ } else {
+ if(null != labelProvider){
+ currentValueLabel.setImage(labelProvider.getImage(getValue()));
+ currentValueLabel.setText(labelProvider.getText(getValue()));
+ }
+ }
+ }
+
+ /**
+ * Sets the Content provider for this editor
+ *
+ * @param provider
+ * The content provider used to retrieve the possible values for
+ * this Reference
+ */
+ public void setContentProvider(IStaticContentProvider provider) {
+ dialog.setContentProvider(new EncapsulatedContentProvider(provider));
+ if (getValue() != null) {
+ setInitialSelection(Collections.singletonList(getValue()));
+ }
+
+ this.contentProvider = provider;
+ }
+
+ /**
+ * Sets the Label provider for this editor If the label provider is null, a
+ * default one will be used. The same label provider is used for both the
+ * editor's label and the selection dialog.
+ *
+ * @param provider
+ * The label provider
+ */
+ public void setLabelProvider(ILabelProvider provider) {
+ if (provider == null) {
+ setLabelProvider(new LabelProvider());
+ return;
+ }
+
+ dialog.setLabelProvider(provider);
+ this.labelProvider = provider;
+ if (widgetObservable != null) {
+ ((CLabelObservableValue) widgetObservable).setLabelProvider(labelProvider);
+ }
+ updateLabel();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setLabel(String label) {
+ super.setLabel(label);
+ dialog.setTitle(label);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getValue() {
+ if (modelProperty != null) {
+ return modelProperty.getValue();
+ }
+ return value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getEditableType() {
+ return Object.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isReadOnly() {
+ return !currentValueLabel.isEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doBinding() {
+ super.doBinding();
+ }
+
+ protected void setInitialSelection(List<?> initialValues) {
+ dialog.setInitialElementSelections(initialValues);
+ }
+
+ @Override
+ public void setModelObservable(IObservableValue modelProperty) {
+ setWidgetObservable(createWidgetObservable(modelProperty));
+ super.setModelObservable(modelProperty);
+ updateControls();
+ }
+
+ /**
+ * This allow to create the widget observable value.
+ *
+ * @param modelProperty
+ * The current observable value.
+ * @return The created {@link StyledTextReferenceDialogObservableValue}.
+ */
+ protected IObservableValue createWidgetObservable(final IObservableValue modelProperty) {
+ return new ReferenceDialogObservableValue(this, this.currentValueLabel, modelProperty, labelProvider);
+ }
+
+ @Override
+ public void setToolTipText(String text) {
+ super.setLabelToolTipText(text);
+ currentValueLabel.setToolTipText(text);
+ }
+
+ public void setValueFactory(ReferenceValueFactory factory) {
+ valueFactory = factory;
+ updateControls();
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Widget widget = e.widget;
+ if (widget == browseValuesButton) {
+ browseAction();
+ } else if (widget == createInstanceButton) {
+ createAction();
+ } else if (widget == editInstanceButton) {
+ editAction();
+ } else if (widget == unsetButton) {
+ unsetAction();
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Nothing
+ }
+
+ /**
+ * Updates the buttons' status
+ */
+ public void updateControls() {
+ // Check if the edit & create buttons should be displayed
+ boolean exclude = valueFactory == null || !valueFactory.canCreateObject();
+ setExclusion(editInstanceButton, exclude);
+ setExclusion(createInstanceButton, exclude);
+
+ setExclusion(browseValuesButton, directCreation);
+
+ browseValuesButton.setEnabled(!readOnly);
+
+ // If they are displayed, check if they should be enabled
+ if (!exclude) {
+ editInstanceButton.setEnabled(valueFactory != null && valueFactory.canEdit() && getValue() != null);
+ createInstanceButton.setEnabled(valueFactory != null && valueFactory.canCreateObject() && !readOnly);
+ }
+
+ // Do not display unset if the value is mandatory
+ setExclusion(unsetButton, mandatory);
+ if (!mandatory) {
+ boolean enabled = !readOnly;
+ enabled = enabled && getValue() != null;
+
+ unsetButton.setEnabled(enabled);
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ updateControls();
+ }
+
+ public void setDirectCreation(boolean directCreation) {
+ this.directCreation = directCreation;
+ updateControls();
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ try {
+ if (modelProperty != null) {
+ modelProperty.setValue(value);
+ error = false;
+ }
+ } catch (Exception e) {
+ error = true;
+
+ }
+
+ updateControls();
+ updateLabel();
+ commit();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.StructuredViewer#setInput(Object)
+ * @param input
+ */
+ public void setInput(Object input) {
+ this.dialog.setInput(input);
+ }
+
+ public void setMandatory(boolean mandatory) {
+ this.mandatory = mandatory;
+ }
+
+ @Override
+ public void updateStatus(IStatus status) {
+
+ if (error) {
+ FieldDecoration error = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ controlDecoration.setImage(error.getImage());
+ controlDecoration.showHoverText(Messages.ReferenceDialog_0);
+ controlDecoration.setDescriptionText(Messages.ReferenceDialog_1);
+ controlDecoration.show();
+ currentValueLabel.setBackground(ERROR);
+ currentValueLabel.update();
+
+
+ } else {
+ controlDecoration.hide();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if (changeColorTask != null) {
+ changeColorTask.cancel();
+ }
+ if (timer != null) {
+ timer.cancel();
+ }
+ super.dispose();
+ }
+
+ private void cancelCurrentTask() {
+ if (changeColorTask != null) {
+ changeColorTask.cancel();
+ }
+ }
+
+ @Override
+ public void changeColorField() {
+ if (!error & !edit) {
+
+ if (timer == null) {
+ timer = new Timer(true);
+ }
+
+ cancelCurrentTask();
+ changeColorTask = new TimerTask() {
+
+ @Override
+ public void run() {
+ if (ReferenceDialog.this.isDisposed()) {
+ return;
+ }
+ ReferenceDialog.this.getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (ReferenceDialog.this.isDisposed()) {// Bug 434787 : Shouldn't not execute the timer thread if the widget is disposed
+ return;
+ }
+ currentValueLabel.setBackground(DEFAULT);
+ currentValueLabel.update();
+ }
+
+
+ });
+ }
+ };
+
+ if (errorBinding) {
+ currentValueLabel.setBackground(ERROR);
+ currentValueLabel.update();
+ } else {
+ IStatus status = (IStatus) binding.getValidationStatus().getValue();
+ switch (status.getSeverity()) {
+ case IStatus.OK:
+ case IStatus.WARNING:
+ timer.schedule(changeColorTask, 600);
+ currentValueLabel.setBackground(VALID);
+ currentValueLabel.update();
+ break;
+ case IStatus.ERROR:
+ currentValueLabel.setBackground(ERROR);
+ currentValueLabel.update();
+ break;
+
+ }
+ }
+ } else {
+ currentValueLabel.setBackground(DEFAULT);
+ }
+ }
+
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextReferenceDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextReferenceDialog.java
index 6b1b44ddb1d..bd19e12270e 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextReferenceDialog.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextReferenceDialog.java
@@ -39,6 +39,7 @@ import org.eclipse.papyrus.infra.widgets.messages.Messages;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.validator.AbstractValidator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
@@ -59,10 +60,10 @@ import org.eclipse.swt.widgets.Widget;
*
* @author Vincent Lorenzo
*
- * Duplicated code from {@link ReferenceDialog}, replacing CLabel by {@link StyledTextStringEditor}
+ * Duplicated code from {@link ReferenceDialog}, replacing CLabel by {@link StyledTextStringEditor}
*
*/
-public class StyledTextReferenceDialog extends AbstractValueEditor implements SelectionListener {
+public class StyledTextReferenceDialog extends AbstractReferenceDialog implements SelectionListener {
/**
* The styled text displaying the current value
@@ -167,7 +168,22 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
* The style of the styled text.
*/
public StyledTextReferenceDialog(final Composite parent, final int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ * Constructs a new ReferenceDialog in the given parent Composite. The style will be applied to the styled text displaying the current value. This constructor manage the value validator.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style of the styled text.
+ * @param targetValidator
+ * The validator used for the styled text.
+ */
+ public StyledTextReferenceDialog(final Composite parent, final int style, final AbstractValidator targetValidator) {
super(parent, style);
+ this.targetValidator = targetValidator;
GridData gridData = getDefaultLayoutData();
styledTextStringEditor = createStyledTextStringEditor(this, null, factory.getBorderStyle() | style);
@@ -215,7 +231,7 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
* @return The created {@link StyledTextStringEditor}.
*/
protected StyledTextStringEditor createStyledTextStringEditor(final Composite parent, final String initialValue, final int style) {
- StyledTextStringEditor editor = new StyledTextStringEditor(parent, style);
+ StyledTextStringEditor editor = new StyledTextStringEditor(parent, style, targetValidator);
editor.setValue(initialValue);
return editor;
}
@@ -351,12 +367,13 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
/**
* Updates the displayed label for the current value
*/
- protected void updateLabel() {
+ public void updateLabel() {
if (binding != null) {
binding.updateModelToTarget();
-
} else {
- styledTextStringEditor.setValue(labelProvider.getText(getValue()));
+ if (null != labelProvider) {
+ styledTextStringEditor.setValue(labelProvider.getText(getValue()));
+ }
}
}
@@ -414,10 +431,10 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
public Object getValue() {
if (modelProperty != null) {
Object modelPropertyValue = modelProperty.getValue();
- if(modelPropertyValue == null){
+ if (modelPropertyValue == null) {
EObject contextElement = getContextElement() != null && getContextElement() instanceof EObject ? (EObject) getContextElement() : null;
- if(modelProperty.getValueType() instanceof EStructuralFeature){
- return contextElement.eGet((EStructuralFeature)modelProperty.getValueType());
+ if (modelProperty.getValueType() instanceof EStructuralFeature) {
+ return contextElement.eGet((EStructuralFeature) modelProperty.getValueType());
}
}
return modelPropertyValue;
@@ -451,14 +468,6 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
}
/**
- * {@inheritDoc}
- */
- @Override
- protected void doBinding() {
- super.doBinding();
- }
-
- /**
* Set the initial selection.
*
* @param initialValues
@@ -478,7 +487,7 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
setWidgetObservable(createWidgetObservable(modelProperty));
super.setModelObservable(modelProperty);
this.styledTextStringEditor.setModelObservable(modelProperty);
-
+
updateControls();
}
@@ -547,7 +556,7 @@ public class StyledTextReferenceDialog extends AbstractValueEditor implements Se
/**
* Updates the buttons' status
*/
- protected void updateControls() {
+ public void updateControls() {
// Check if the edit & create buttons should be displayed
boolean exclude = valueFactory == null || !valueFactory.canCreateObject();
setExclusion(editInstanceButton, exclude);
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextStringEditor.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextStringEditor.java
index 6f82b025613..ae1075cfe50 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextStringEditor.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StyledTextStringEditor.java
@@ -24,6 +24,7 @@ import org.eclipse.jface.fieldassist.FieldDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.papyrus.infra.widgets.databinding.StyledTextObservableValue;
import org.eclipse.papyrus.infra.widgets.selectors.StringSelector;
+import org.eclipse.papyrus.infra.widgets.validator.AbstractValidator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.KeyEvent;
@@ -68,7 +69,6 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
/**
- *
* Constructor.
*
* @param parent
@@ -78,11 +78,23 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
*/
public StyledTextStringEditor(Composite parent, int style) {
this(parent, style, null, DEFAULT_HEIGHT_HINT, DEFAULT_WIDTH_HINT);
-
}
/**
+ * Constructor.
*
+ * @param parent
+ * The composite in which this editor should be displayed
+ * @param style
+ * The style for this editor's text box
+ * @param targetValidator
+ * The validator used for the styled text.
+ */
+ public StyledTextStringEditor(final Composite parent, final int style, final AbstractValidator targetValidator) {
+ this(parent, style, null, DEFAULT_HEIGHT_HINT, DEFAULT_WIDTH_HINT, targetValidator);
+ }
+
+ /**
* Constructor.
*
* @param parent
@@ -97,7 +109,22 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
}
/**
+ * Constructor.
*
+ * @param parent
+ * The composite in which this editor should be displayed
+ * @param style
+ * The style for this editor's text box
+ * @param label
+ * The label for this editor
+ * @param targetValidator
+ * The validator used for the styled text.
+ */
+ public StyledTextStringEditor(final Composite parent, final int style, final String label, final AbstractValidator targetValidator) {
+ this(parent, style, label, DEFAULT_HEIGHT_HINT, DEFAULT_WIDTH_HINT, targetValidator);
+ }
+
+ /**
* Constructor.
*
* @param parent
@@ -114,7 +141,6 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
}
/**
- *
* Constructor.
*
* @param parent
@@ -129,20 +155,43 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
* Width hint of the text area in multiline mode
*/
public StyledTextStringEditor(Composite parent, int style, String label, int heighHint, int widthHint) {
+ this(parent, style, label, heighHint, widthHint, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this editor should be displayed
+ * @param style
+ * The style for this editor's text box
+ * @param label
+ * The label for this editor
+ * @param heighHint
+ * Height hint of the text area in multiline mode
+ * @param widthHint
+ * Width hint of the text area in multiline mode
+ * @param targetValidator
+ * The validator used for the styled text.
+ */
+ public StyledTextStringEditor(final Composite parent, final int style, final String label, final int heighHint, final int widthHint, final AbstractValidator targetValidator) {
super(parent, label);
+ this.targetValidator = targetValidator;
+
GridData data = getDefaultLayoutData();
data.grabExcessVerticalSpace = true;
data.grabExcessHorizontalSpace = true;
data.verticalAlignment = SWT.FILL;
data.horizontalAlignment = SWT.FILL;
+ int styledTextStyle = style;
if ((style & SWT.MULTI) != 0) {
data.minimumHeight = heighHint;
data.minimumWidth = widthHint;
- style = style | SWT.V_SCROLL;
+ styledTextStyle = style | SWT.V_SCROLL;
}
- text = createStyledText(this, null, style);
+ text = createStyledText(this, null, styledTextStyle);
text.setLayoutData(data);
if (label != null) {
@@ -164,7 +213,6 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
layout.marginWidth = 0;
pack();
-
}
@@ -279,7 +327,7 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
commit();
changeColorField();
}
-
+
@Override
public void setToolTipText(String tooltip) {
text.setToolTipText(tooltip);
@@ -295,7 +343,7 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
if (value instanceof String) {
this.text.setText((String) value);
} else {
- this.text.setText(""); //$NON-NLS-1$;
+ this.text.setText(""); //$NON-NLS-1$
}
}
@@ -378,11 +426,11 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
timer.schedule(currentValidateTask, delay);
}
if (targetValidator != null) {
- IStatus status = targetValidator.validate(text.getText());
+ IStatus status = targetValidator.validate(getTextToValidate());
updateStatus(status);
}
if (modelValidator != null) {
- IStatus status = modelValidator.validate(text.getText());
+ IStatus status = modelValidator.validate(getTextToValidate());
updateStatus(status);
if (binding == null) {
update();
@@ -406,6 +454,15 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
}
}
+ /**
+ * Gets the string to validate.
+ *
+ * @return The string text to validate.
+ */
+ protected String getTextToValidate() {
+ return text.getText();
+ }
+
@Override
public void dispose() {
cancelCurrentTask();
@@ -423,29 +480,30 @@ public class StyledTextStringEditor extends AbstractValueEditor implements KeyLi
@Override
public void updateStatus(IStatus status) {
- switch (status.getSeverity()) {
- case IStatus.OK:
- controlDecoration.hide();
- break;
- case IStatus.WARNING:
- FieldDecoration warning = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
- controlDecoration.setImage(warning.getImage());
- controlDecoration.showHoverText(status.getMessage());
- controlDecoration.setDescriptionText(status.getMessage());
- controlDecoration.show();
- break;
- case IStatus.ERROR:
- FieldDecoration error = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
- controlDecoration.setImage(error.getImage());
- controlDecoration.showHoverText(status.getMessage());
- controlDecoration.setDescriptionText(status.getMessage());
- controlDecoration.show();
- break;
- default:
- controlDecoration.hide();
- break;
+ if(!isDisposed()){
+ switch (status.getSeverity()) {
+ case IStatus.OK:
+ controlDecoration.hide();
+ break;
+ case IStatus.WARNING:
+ FieldDecoration warning = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
+ controlDecoration.setImage(warning.getImage());
+ controlDecoration.showHoverText(status.getMessage());
+ controlDecoration.setDescriptionText(status.getMessage());
+ controlDecoration.show();
+ break;
+ case IStatus.ERROR:
+ FieldDecoration error = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ controlDecoration.setImage(error.getImage());
+ controlDecoration.showHoverText(status.getMessage());
+ controlDecoration.setDescriptionText(status.getMessage());
+ controlDecoration.show();
+ break;
+ default:
+ controlDecoration.hide();
+ break;
+ }
}
-
}
@Override
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
index 510d05e4497..9cc4b1d79c0 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/Messages.java
@@ -1,132 +1,141 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * 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
- * Christian W. Damus (CEA) - bug 402525
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * The Class Messages.
- */
-public class Messages extends NLS {
-
- /** The Constant BUNDLE_NAME. */
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.widgets.messages.messages"; //$NON-NLS-1$
-
- public static String BooleanInputValidator_NotABoolean;
-
- public static String IntegerInputValidator_NotAnIntegerMessage;
-
- public static String RealInputValidator_NotaRealMessage;
-
- public static String UnlimitedNaturalInputValidator_NotAnUnlimitedNaturalMessage;
-
- public static String MultipleStringFileEditor_0;
-
- public static String MultipleStringFileEditor_1;
-
- public static String MultipleStringFileEditor_2;
-
- public static String MultipleValueEditAndSelectionWidget_EditSelectedElement;
-
- /** The Multiple value editor_ add elements. */
- public static String MultipleValueEditor_AddElements;
-
- public static String MultipleValueEditor_addOperation;
-
- public static String MultipleValueEditor_editOperation;
-
- /** The Multiple value editor_ edit selected value */
- public static String MultipleValueEditor_EditSelectedValue;
-
- /** The Multiple value editor_ move selected elements down. */
- public static String MultipleValueEditor_MoveSelectedElementsDown;
-
- /** The Multiple value editor_ move selected elements up. */
- public static String MultipleValueEditor_MoveSelectedElementsUp;
-
- /** The Multiple value editor_ remove selected elements. */
- public static String MultipleValueEditor_RemoveSelectedElements;
-
- /** The Multiple value selector dialog_ add all elements. */
- public static String MultipleValueSelectorDialog_AddAllElements;
-
- /** The Multiple value selector dialog_ add selected elements. */
- public static String MultipleValueSelectorDialog_AddSelectedElements;
-
- /** The Multiple value selector dialog_ create new element */
- public static String MultipleValueSelectorDialog_CreateNewElement;
-
- /** The Multiple value selector dialog_ delete new element */
- public static String MultipleValueSelectorDialog_DeleteNewElement;
-
- /** The Multiple value selector dialog_ remove all elements. */
- public static String MultipleValueSelectorDialog_RemoveAllElements;
-
- public static String ReferenceDialog_0;
-
- public static String ReferenceDialog_1;
-
- public static String ReferenceDialog_CreateANewObject;
-
- public static String ReferenceDialog_editOperation;
-
- public static String ReferenceDialog_EditTheCurrentValue;
-
- /** The Reference dialog_ edit value */
- public static String ReferenceDialog_EditValue;
-
- /** The Reference dialog_ select value */
- public static String ReferenceDialog_SelectValue;
-
- public static String ReferenceDialog_setOperation;
-
- /** The Reference dialog_ unset */
- public static String ReferenceDialog_Unset;
-
- /** The Reference dialog_ edit unset value */
- public static String ReferenceDialog_UnsetValue;
-
- /** Indicates that a list of elements have different values for the given property (Multi-selection) */
- public static String ReferenceDialogObservable_Unchanged;
-
- /** the Enum radio_ no value */
- public static String EnumRadio_NoValue;
-
- public static String FlattenableRestrictedFilteredContentProvider_AllPossibleContentsMessage;
-
- public static String FlattenableRestrictedFilteredContentProvider_FlatViewMessage;
-
- public static String IntegerMask_ErrorTooManyValues;
-
- public static String ProviderBasedBrowseStrategy_0;
-
- public static String StringEditionFactory_EnterANewValue;
-
- public static String StringFileSelector_0;
-
- public static String StringFileSelector_Browse;
-
- public static String StringFileSelector_BrowseWorkspace;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * Instantiates a new messages.
- */
- private Messages() {
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * 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
+ * Christian W. Damus (CEA) - bug 402525
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The Class Messages.
+ */
+public class Messages extends NLS {
+
+ /** The Constant BUNDLE_NAME. */
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.widgets.messages.messages"; //$NON-NLS-1$
+
+ public static String BooleanInputValidator_NotABoolean;
+
+ public static String IntegerInputValidator_NotAnIntegerMessage;
+
+ public static String RealInputValidator_NotaRealMessage;
+
+ public static String UnlimitedNaturalInputValidator_NotAnUnlimitedNaturalMessage;
+
+ public static String MultipleStringFileEditor_0;
+
+ public static String MultipleStringFileEditor_1;
+
+ public static String MultipleStringFileEditor_2;
+
+ public static String MultipleValueEditAndSelectionWidget_EditSelectedElement;
+
+ /** The Multiple value editor_ add elements. */
+ public static String MultipleValueEditor_AddElements;
+
+ public static String MultipleValueEditor_addOperation;
+
+ public static String MultipleValueEditor_editOperation;
+
+ /** The Multiple value editor_ edit selected value */
+ public static String MultipleValueEditor_EditSelectedValue;
+
+ /** The Multiple value editor_ move selected elements down. */
+ public static String MultipleValueEditor_MoveSelectedElementsDown;
+
+ /** The Multiple value editor_ move selected elements up. */
+ public static String MultipleValueEditor_MoveSelectedElementsUp;
+
+ /** The Multiple value editor_ remove selected elements. */
+ public static String MultipleValueEditor_RemoveSelectedElements;
+
+ /** The Multiple value selector dialog_ add all elements. */
+ public static String MultipleValueSelectorDialog_AddAllElements;
+
+ /** The Multiple value selector dialog_ add selected elements. */
+ public static String MultipleValueSelectorDialog_AddSelectedElements;
+
+ /** The Multiple value selector dialog_ create new element */
+ public static String MultipleValueSelectorDialog_CreateNewElement;
+
+ /** The Multiple value selector dialog_ delete new element */
+ public static String MultipleValueSelectorDialog_DeleteNewElement;
+
+ /** The Multiple value selector dialog_ remove all elements. */
+ public static String MultipleValueSelectorDialog_RemoveAllElements;
+
+ public static String ReferenceDialog_0;
+
+ public static String ReferenceDialog_1;
+
+ public static String ReferenceDialog_CreateANewObject;
+
+ public static String ReferenceDialog_editOperation;
+
+ public static String ReferenceDialog_EditTheCurrentValue;
+
+ /** The Reference dialog_ edit value */
+ public static String ReferenceDialog_EditValue;
+
+ /** The Reference dialog_ select value */
+ public static String ReferenceDialog_SelectValue;
+
+ public static String ReferenceDialog_setOperation;
+
+ /** The Reference dialog_ unset */
+ public static String ReferenceDialog_Unset;
+
+ /** The Reference dialog_ edit unset value */
+ public static String ReferenceDialog_UnsetValue;
+
+ /** Indicates that a list of elements have different values for the given property (Multi-selection) */
+ public static String ReferenceDialogObservable_Unchanged;
+
+ /** The switch editors label for Multiplicity reference dialog. */
+ public static String MultiplicityReferenceDialog_SwitchEditors;
+
+ /** The lower value tool tip for Multiplicity reference dialog. */
+ public static String MultiplicityReferenceDialog_LowerValueToolTip;
+
+ /** The upper value tool tip for Multiplicity reference dialog. */
+ public static String MultiplicityReferenceDialog_UpperValueToolTip;
+
+ /** the Enum radio_ no value */
+ public static String EnumRadio_NoValue;
+
+ public static String FlattenableRestrictedFilteredContentProvider_AllPossibleContentsMessage;
+
+ public static String FlattenableRestrictedFilteredContentProvider_FlatViewMessage;
+
+ public static String IntegerMask_ErrorTooManyValues;
+
+ public static String ProviderBasedBrowseStrategy_0;
+
+ public static String StringEditionFactory_EnterANewValue;
+
+ public static String StringFileSelector_0;
+
+ public static String StringFileSelector_Browse;
+
+ public static String StringFileSelector_BrowseWorkspace;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * Instantiates a new messages.
+ */
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
index 8a3e48b30b3..2aa21d64ea1 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/messages/messages.properties
@@ -1,54 +1,57 @@
-###############################################################################
-# Copyright (c) 2010, 2014 CEA LIST and others.
-#
-# 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
-# Christian W. Damus (CEA) - bug 402525
-#
-###############################################################################
-
-BooleanInputValidator_NotABoolean=The actual entry is not a Boolean.
-IntegerInputValidator_NotAnIntegerMessage=The actual entry is not an Integer.
-RealInputValidator_NotaRealMessage=The actual entry is not a Real.
-UnlimitedNaturalInputValidator_NotAnUnlimitedNaturalMessage=The actual entry is not an UnlimitedNatural. An UnlimitedNatural must be either -1, * or >= 0
-MultipleStringFileEditor_0=Browse file system
-MultipleStringFileEditor_1=Browse workspace
-MultipleStringFileEditor_2=FilterExtensions and FilterNames do not match
-MultipleValueEditAndSelectionWidget_EditSelectedElement=Edit selected Element
-MultipleValueEditor_AddElements=Add elements
-MultipleValueEditor_addOperation=Add {0}
-MultipleValueEditor_editOperation=Edit {0}
-MultipleValueEditor_EditSelectedValue=Edit the selected value
-MultipleValueEditor_MoveSelectedElementsDown=Move selected elements down
-MultipleValueEditor_MoveSelectedElementsUp=Move selected elements up
-MultipleValueEditor_RemoveSelectedElements=Remove selected elements
-MultipleValueSelectorDialog_AddAllElements=Add all elements
-MultipleValueSelectorDialog_AddSelectedElements=Add selected elements
-MultipleValueSelectorDialog_RemoveAllElements=Remove all elements
-MultipleValueSelectorDialog_CreateNewElement=Create a new element
-MultipleValueSelectorDialog_DeleteNewElement=Deletes a newly created element
-ReferenceDialog_0=An error occured while setting the value.
-ReferenceDialog_1=An error occured while setting the value.
-ReferenceDialog_CreateANewObject=Create a new object
-ReferenceDialog_editOperation=Edit {0}
-ReferenceDialog_EditTheCurrentValue=Edit the current value
-ReferenceDialog_EditValue=Edit the reference value
-ReferenceDialog_SelectValue=Select the value for this reference
-ReferenceDialog_setOperation=Set {0}
-ReferenceDialog_Unset=<Undefined>
-ReferenceDialog_UnsetValue=Unset the reference value
-ReferenceDialogObservable_Unchanged=<Unchanged>
-EnumRadio_NoValue=There is no value to select
-FlattenableRestrictedFilteredContentProvider_AllPossibleContentsMessage=Show all possible values
-FlattenableRestrictedFilteredContentProvider_FlatViewMessage=Flat View
-StringEditionFactory_EnterANewValue=Enter the new value
-StringFileSelector_0=FilterExtensions and FilterNames do not match
-StringFileSelector_Browse=Browse
-StringFileSelector_BrowseWorkspace=Browse workspace
-IntegerMask_ErrorTooManyValues=The mask-based integer editor cannot be used with more than 32 values
-ProviderBasedBrowseStrategy_0=The provider has not been initialized
+###############################################################################
+# Copyright (c) 2010, 2014 CEA LIST and others.
+#
+# 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
+# Christian W. Damus (CEA) - bug 402525
+#
+###############################################################################
+
+BooleanInputValidator_NotABoolean=The actual entry is not a Boolean.
+IntegerInputValidator_NotAnIntegerMessage=The actual entry is not an Integer.
+RealInputValidator_NotaRealMessage=The actual entry is not a Real.
+UnlimitedNaturalInputValidator_NotAnUnlimitedNaturalMessage=The actual entry is not an UnlimitedNatural. An UnlimitedNatural must be either -1, * or >= 0
+MultipleStringFileEditor_0=Browse file system
+MultipleStringFileEditor_1=Browse workspace
+MultipleStringFileEditor_2=FilterExtensions and FilterNames do not match
+MultipleValueEditAndSelectionWidget_EditSelectedElement=Edit selected Element
+MultipleValueEditor_AddElements=Add elements
+MultipleValueEditor_addOperation=Add {0}
+MultipleValueEditor_editOperation=Edit {0}
+MultipleValueEditor_EditSelectedValue=Edit the selected value
+MultipleValueEditor_MoveSelectedElementsDown=Move selected elements down
+MultipleValueEditor_MoveSelectedElementsUp=Move selected elements up
+MultipleValueEditor_RemoveSelectedElements=Remove selected elements
+MultipleValueSelectorDialog_AddAllElements=Add all elements
+MultipleValueSelectorDialog_AddSelectedElements=Add selected elements
+MultipleValueSelectorDialog_RemoveAllElements=Remove all elements
+MultipleValueSelectorDialog_CreateNewElement=Create a new element
+MultipleValueSelectorDialog_DeleteNewElement=Deletes a newly created element
+ReferenceDialog_0=An error occured while setting the value.
+ReferenceDialog_1=An error occured while setting the value.
+ReferenceDialog_CreateANewObject=Create a new object
+ReferenceDialog_editOperation=Edit {0}
+ReferenceDialog_EditTheCurrentValue=Edit the current value
+ReferenceDialog_EditValue=Edit the reference value
+ReferenceDialog_SelectValue=Select the value for this reference
+ReferenceDialog_setOperation=Set {0}
+ReferenceDialog_Unset=<Undefined>
+ReferenceDialog_UnsetValue=Unset the reference value
+ReferenceDialogObservable_Unchanged=<Unchanged>
+MultiplicityReferenceDialog_SwitchEditors=Switch editors
+MultiplicityReferenceDialog_LowerValueToolTip=Lower ValueSpecification
+MultiplicityReferenceDialog_UpperValueToolTip=Upper ValueSpecification
+EnumRadio_NoValue=There is no value to select
+FlattenableRestrictedFilteredContentProvider_AllPossibleContentsMessage=Show all possible values
+FlattenableRestrictedFilteredContentProvider_FlatViewMessage=Flat View
+StringEditionFactory_EnterANewValue=Enter the new value
+StringFileSelector_0=FilterExtensions and FilterNames do not match
+StringFileSelector_Browse=Browse
+StringFileSelector_BrowseWorkspace=Browse workspace
+IntegerMask_ErrorTooManyValues=The mask-based integer editor cannot be used with more than 32 values
+ProviderBasedBrowseStrategy_0=The provider has not been initialized
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/util/MultiplicityConstants.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/util/MultiplicityConstants.java
new file mode 100644
index 00000000000..69b6372375d
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/util/MultiplicityConstants.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.util;
+
+/**
+ * The multiplicity constants.
+ */
+public interface MultiplicityConstants {
+
+ /**
+ * The multiplicity editor preference identifier.
+ */
+ public static final String MULTIPLICITY_EDITOR_MODE = "multiplicityEditorMode"; //$NON-NLS-1$
+
+ /**
+ * The simple mode preference identifier.
+ */
+ public static final String SIMPLE_MODE = "simpleMode"; //$NON-NLS-1$
+
+ /**
+ * The simple mode text value display.
+ */
+ public static final String SIMPLE_MODE_TEXT_VALUE = "Simple mode"; //$NON-NLS-1$
+
+ /**
+ * The advanced mode preference identifier.
+ */
+ public static final String ADVANCED_MODE = "advanceMode"; //$NON-NLS-1$
+
+ /**
+ * The advanced mode text value display.
+ */
+ public static final String ADVANCED_MODE_TEXT_VALUE = "Advanced mode"; //$NON-NLS-1$
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
index 7f8cf94dc23..9a002a174ff 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
@@ -26,6 +26,9 @@ import org.eclipse.ocl.pivot.internal.delegate.OCLDelegateValidator;
import org.eclipse.ocl.pivot.uml.internal.validation.UMLOCLEValidator;
import org.eclipse.papyrus.infra.services.validation.EValidatorAdapter;
import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.MultiplicityElement;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.uml2.uml.OpaqueExpression;
@@ -72,6 +75,23 @@ public class OCLEValidatorAdapter
return batchValidate(eObject, diagnostics, context);
}
+ /**
+ * Validate if only the lower and the upper are integer values.
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.uml2.uml.util.UMLValidator#validateMultiplicityElement_validateUpperGeLower(org.eclipse.uml2.uml.MultiplicityElement, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
+ */
+ @Override
+ public boolean validateMultiplicityElement_validateUpperGeLower(final MultiplicityElement multiplicityElement, final DiagnosticChain diagnostics, final Map<Object, Object> context) {
+ boolean result = false;
+ if (((multiplicityElement.getLowerValue() instanceof LiteralInteger || multiplicityElement.getLowerValue() instanceof LiteralUnlimitedNatural)
+ && (multiplicityElement.getUpperValue() instanceof LiteralInteger || multiplicityElement.getUpperValue() instanceof LiteralUnlimitedNatural))) {
+ result = super.validateMultiplicityElement_validateUpperGeLower(multiplicityElement, diagnostics, context);
+ }
+
+ return result;
+ }
+
@Override
public boolean validateInstanceSpecification(InstanceSpecification instanceSpecification,
DiagnosticChain diagnostics, Map<Object, Object> context) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/model/environment.xmi b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/model/environment.xmi
index 0addaed8040..585b00013e2 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/model/environment.xmi
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/model/environment.xmi
@@ -7,6 +7,11 @@
label="Xtext Reference Editor"
widgetClass="UMLStyledTextReferenceDialog"
namespace="//@namespaces.0"/>
+ <propertyEditorTypes
+ label="Multiplicity Xtext Reference Editor"
+ widgetClass="MultiplicityXTextDialog"
+ namespace="//@namespaces.0"
+ type="Reference"/>
<namespaces
name="xtexteditor"
value="org.eclipse.papyrus.uml.properties.xtext.widget.property"/>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/MultiplicityXTextValueEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/MultiplicityXTextValueEditor.java
new file mode 100644
index 00000000000..02a2969b997
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/MultiplicityXTextValueEditor.java
@@ -0,0 +1,142 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.xtext.widget;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractReferenceDialog;
+import org.eclipse.papyrus.infra.widgets.editors.StyledTextReferenceDialog;
+import org.eclipse.papyrus.infra.widgets.validator.UnlimitedNaturalValidator;
+import org.eclipse.papyrus.uml.properties.widgets.ExtendedMultiplicityDialog;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This allow to define the multiplicity editors (with 2 modes) with XText editors for lower and upper ValueSpecification
+ */
+public class MultiplicityXTextValueEditor extends ExtendedMultiplicityDialog implements SelectionListener {
+
+ /**
+ * The default lower value direct editor configuration class name.
+ */
+ private final static String DEFAULT_LOWER_VALUE_DIRECT_EDITOR_CONFIGURATION = "org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration";
+
+ /**
+ * The default upper value direct editor configuration class name.
+ */
+ private final static String DEFAULT_UPPER_VALUE_DIRECT_EDITOR_CONFIGURATION = "org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration";
+
+
+ /**
+ * The lower value direct editor configuration class name edited.
+ */
+ private String lowerValueDirectEditorConfiguration;
+
+ /**
+ * The upper value direct editor configuration class name edited.
+ */
+ private String upperValueDirectEditorConfiguration;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ */
+ public MultiplicityXTextValueEditor(final Composite parent, final int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ * @param preferenceStore
+ * The preference store.
+ */
+ public MultiplicityXTextValueEditor(final Composite parent, final int style, final IPreferenceStore preferenceStore) {
+ super(parent, style, preferenceStore);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog#createLowerValueSpecificationEditor(org.eclipse.swt.widgets.Composite, int)
+ */
+ @Override
+ protected AbstractReferenceDialog createLowerValueSpecificationEditor(final Composite parent, final int style) {
+ final AbstractReferenceDialog lowerValueSpecificationEditor = super.createLowerValueSpecificationEditor(parent, style);
+ if (null == lowerValueDirectEditorConfiguration) {
+ lowerValueDirectEditorConfiguration = DEFAULT_LOWER_VALUE_DIRECT_EDITOR_CONFIGURATION;
+ }
+ ((UMLXtextReferenceValueEditor) lowerValueSpecificationEditor).setDirectEditorConfiguration(lowerValueDirectEditorConfiguration);
+ return lowerValueSpecificationEditor;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog#createLowerValueSpecificationEditor(org.eclipse.swt.widgets.Composite, int)
+ */
+ @Override
+ protected AbstractReferenceDialog createUpperValueSpecificationEditor(final Composite parent, final int style) {
+ final AbstractReferenceDialog upperValueSpecificationEditor = new UMLXtextReferenceValueEditor(parent, style, new UnlimitedNaturalValidator());
+ if (null == upperValueDirectEditorConfiguration) {
+ upperValueDirectEditorConfiguration = DEFAULT_UPPER_VALUE_DIRECT_EDITOR_CONFIGURATION;
+ }
+ ((UMLXtextReferenceValueEditor) upperValueSpecificationEditor).setDirectEditorConfiguration(upperValueDirectEditorConfiguration);
+ return upperValueSpecificationEditor;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog#createValueSpecificationEditor(org.eclipse.swt.widgets.Composite, int)
+ */
+ @Override
+ protected StyledTextReferenceDialog createValueSpecificationEditor(final Composite parent, final int style) {
+ return new UMLXtextReferenceValueEditor(parent, style);
+ }
+
+ /**
+ * Sets the lower value direct editor configuration class name.
+ *
+ * @param lowerValueDirectEditorConfiguration
+ * The lower value direct editor configuration class name.
+ */
+ public void setLowerValueDirectEditorConfiguration(final String lowerValueDirectEditorConfiguration) {
+ this.lowerValueDirectEditorConfiguration = lowerValueDirectEditorConfiguration;
+ if (null != lowerValueEditor) {
+ ((UMLXtextReferenceValueEditor) lowerValueEditor).setDirectEditorConfiguration(lowerValueDirectEditorConfiguration);
+ }
+ }
+
+ /**
+ * Sets the upper value direct editor configuration class name.
+ *
+ * @param upperValueDirectEditorConfiguration
+ * The upper valuedirect editor configuration class name.
+ */
+ public void setUpperValueDirectEditorConfiguration(final String upperValueDirectEditorConfiguration) {
+ this.upperValueDirectEditorConfiguration = upperValueDirectEditorConfiguration;
+ if (null != upperValueEditor) {
+ ((UMLXtextReferenceValueEditor) upperValueEditor).setDirectEditorConfiguration(upperValueDirectEditorConfiguration);
+ }
+ }
+
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/UMLXtextReferenceValueEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/UMLXtextReferenceValueEditor.java
index e65e313da96..d7b69c6b1c6 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/UMLXtextReferenceValueEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/UMLXtextReferenceValueEditor.java
@@ -25,6 +25,7 @@ import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.infra.widgets.editors.StyledTextReferenceDialog;
import org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor;
import org.eclipse.papyrus.infra.widgets.selectors.StringSelector;
+import org.eclipse.papyrus.infra.widgets.validator.AbstractValidator;
import org.eclipse.papyrus.uml.properties.xtext.Activator;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.papyrus.uml.xtext.integration.StyledTextXtextAdapter;
@@ -39,6 +40,7 @@ import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
/**
@@ -49,6 +51,17 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
implements IContextElementProvider, SelectionListener {
/**
+ * The equal character.
+ */
+ private static final String EQUAL = "="; //$NON-NLS-1$
+
+ /**
+ * The default value to validate.
+ */
+ private static final String DEFAULT_VALIDATE_VALUE = "0"; //$NON-NLS-1$
+
+
+ /**
* The xtext adapter.
*/
private StyledTextXtextAdapter xtextAdapter;
@@ -74,6 +87,7 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
*/
private String directEditorConfiguration;
+
/**
* Constructor.
*
@@ -83,30 +97,40 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
* The style for the widget.
*/
public UMLXtextReferenceValueEditor(final Composite parent, final int style) {
- super(parent, style);
+ this(parent, style, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ * @param targetValidator
+ * The validator used for the styled text.
+ */
+ public UMLXtextReferenceValueEditor(final Composite parent, final int style, final AbstractValidator targetValidator) {
+ super(parent, style, targetValidator);
styledTextStringEditor.getText().addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
if (canParse) {
IParser parser = getParser();
- if (null == xtextAdapter) {
- return;
- }
-
- if (null != xtextAdapter
- && null != xtextAdapter.getCompletionProposalAdapter()
- && xtextAdapter.getCompletionProposalAdapter()
- .delayedIsPopupOpen()) {
- // ignore focus lost
- return;
+ if (null != xtextAdapter) {
+ if (null == xtextAdapter
+ || null == xtextAdapter.getCompletionProposalAdapter()
+ || !xtextAdapter.getCompletionProposalAdapter()
+ .delayedIsPopupOpen()) {
+ manageParserCommand(parser);
+
+ // Manage the color field and the control decoration
+ styledTextStringEditor.notifyListeners(SWT.FocusOut, new Event());
+ styledTextStringEditor.changeColorField();
+ controlDecoration.hide();
+ canParse = false;
+ }
}
- manageParserCommand(parser);
-
- // Manage the color field and the control decoration
- styledTextStringEditor.notifyListeners(SWT.FocusOut, new Event());
- styledTextStringEditor.changeColorField();
- controlDecoration.hide();
- canParse = false;
}
}
@@ -164,7 +188,13 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
final Composite parent, final String initialValue, final int style) {
// Change the style to set the singleText to a single line
int createdStyle = style | SWT.SINGLE;
- return new StyledTextStringEditor(parent, createdStyle) {
+ return new StyledTextStringEditor(parent, createdStyle, targetValidator) {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor#createStyledText(org.eclipse.swt.widgets.Composite, java.lang.String, int)
+ */
public StyledText createStyledText(final Composite parent, final String value,
final int createdStyle) {
StyledText txt = new StyledText(parent, createdStyle);
@@ -175,9 +205,9 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
}
/**
+ * {@inheritDoc}
+ *
* @see org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor#keyPressed(org.eclipse.swt.events.KeyEvent)
- *
- * @param e
*/
@Override
public void keyPressed(final KeyEvent e) {
@@ -203,8 +233,9 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
}
/**
+ * {@inheritDoc}
+ *
* @see org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor#notifyChange()
- *
*/
@Override
protected void notifyChange() {
@@ -221,9 +252,9 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
}
/**
+ * {@inheritDoc}
+ *
* @see org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor#keyReleased(org.eclipse.swt.events.KeyEvent)
- *
- * @param e
*/
@Override
public void keyReleased(KeyEvent e) {
@@ -231,6 +262,30 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
// Manage the 'enter' key with 'keyPressed' instead of 'keyReleased'
// because the proposal window is already closed in the 'keyReleased' method
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.StyledTextStringEditor#getTextToValidate()
+ */
+ @Override
+ protected String getTextToValidate() {
+ // Manage the string to parse (because the XText parser allow a filled name with the value)
+ String result = super.getTextToValidate();
+ // If the text contains '=', just parse the value after
+ if (result.contains(EQUAL) && result.indexOf(EQUAL) != (result.length() - 1)) {
+ result = result.substring(result.indexOf(EQUAL) + 1, result.length());
+ } else {
+ // Try to parse the value as integer if id doesn't contain '='
+ try {
+ Integer.parseInt(result);
+ } catch (NumberFormatException exception) {
+ // Set the default value validation to avoid validation error
+ result = DEFAULT_VALIDATE_VALUE;
+ }
+ }
+ return result;
+ }
};
}
@@ -358,7 +413,12 @@ public class UMLXtextReferenceValueEditor extends StyledTextReferenceDialog
protected void doBinding() {
super.doBinding();
updateXtextAdapters(styledTextStringEditor.getText());
- styledTextStringEditor.setValue(labelProvider.getText(getValue()));
+ // Manage the setText of StyledText by a Runnable because the UI is blocker previously
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ styledTextStringEditor.setValue(labelProvider.getText(getValue()));
+ }
+ });
updateLabel();
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/MultiplicityXTextDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/MultiplicityXTextDialog.java
new file mode 100644
index 00000000000..af2f35884ef
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/MultiplicityXTextDialog.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.xtext.widget.property;
+
+import org.eclipse.papyrus.uml.properties.preferences.MultiplicityEditorPreferences;
+import org.eclipse.papyrus.uml.properties.widgets.MultiplicityDialog;
+import org.eclipse.papyrus.uml.properties.xtext.widget.MultiplicityXTextValueEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The multiplicity dialog which allow to manage the XText editors for the multiplicity lower and upper values.
+ */
+public class MultiplicityXTextDialog extends MultiplicityDialog {
+
+ /**
+ * The lower value direct editor configuration name class.
+ */
+ private String lowerValueDirectEditorConfiguration = null;
+
+ /**
+ * The lower value direct editor configuration name class.
+ */
+ private String upperValueDirectEditorConfiguration = null;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ */
+ public MultiplicityXTextDialog(final Composite parent, final int style) {
+ super(parent, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.properties.widgets.MultiplicityDialog#createMultiplicityDialog(org.eclipse.swt.widgets.Composite, int)
+ */
+ @Override
+ protected org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog createMultiplicityDialog(final Composite parent, final int style) {
+ return editor = new MultiplicityXTextValueEditor(parent, style, MultiplicityEditorPreferences.instance.getPreferenceStore());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.properties.widgets.MultiplicityDialog#doBinding()
+ */
+ @Override
+ protected void doBinding() {
+ super.doBinding();
+ if (null != editor && null != getLowerValueDirectEditorConfiguration()) {
+ ((MultiplicityXTextValueEditor) editor).setLowerValueDirectEditorConfiguration(getLowerValueDirectEditorConfiguration());
+ }
+ if (null != editor && null != getUpperValueDirectEditorConfiguration()) {
+ ((MultiplicityXTextValueEditor) editor).setUpperValueDirectEditorConfiguration(getUpperValueDirectEditorConfiguration());
+ }
+ }
+
+ /**
+ * Sets the lower value editor configuration attribute from XWT file.
+ *
+ * @param lowerValueDirectEditorConfiguration
+ * The lower value direct editor configuration class name.
+ */
+ public void setLowerValueDirectEditorConfiguration(final String lowerValueDirectEditorConfiguration) {
+ this.lowerValueDirectEditorConfiguration = lowerValueDirectEditorConfiguration;
+ if (null != editor && null != lowerValueDirectEditorConfiguration) {
+ ((MultiplicityXTextValueEditor) editor).setLowerValueDirectEditorConfiguration(lowerValueDirectEditorConfiguration);
+ }
+ }
+
+ /**
+ * Gets the lower value direct editor configuration attribute value.
+ *
+ * @return The lower value direct editor configuration attribute value.
+ */
+ public String getLowerValueDirectEditorConfiguration() {
+ return lowerValueDirectEditorConfiguration;
+ }
+
+ /**
+ * Sets the lower value editor configuration attribute from XWT file.
+ *
+ * @param upperValueDirectEditorConfiguration
+ * The lower value direct editor configuration class name.
+ */
+ public void setUpperValueDirectEditorConfiguration(final String upperValueDirectEditorConfiguration) {
+ this.upperValueDirectEditorConfiguration = upperValueDirectEditorConfiguration;
+ if (null != editor && null != upperValueDirectEditorConfiguration) {
+ ((MultiplicityXTextValueEditor) editor).setUpperValueDirectEditorConfiguration(upperValueDirectEditorConfiguration);
+ }
+ }
+
+ /**
+ * Gets the upper value direct editor configuration attribute value.
+ *
+ * @return The upper value direct editor configuration attribute value.
+ */
+ public String getUpperValueDirectEditorConfiguration() {
+ return upperValueDirectEditorConfiguration;
+ }
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF
index 0e315687c63..a70501934a7 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/META-INF/MANIFEST.MF
@@ -1,63 +1,64 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.properties.constraints,
- org.eclipse.papyrus.uml.properties.creation,
- org.eclipse.papyrus.uml.properties.databinding,
- org.eclipse.papyrus.uml.properties.datatype,
- org.eclipse.papyrus.uml.properties.modelelement,
- org.eclipse.papyrus.uml.properties.profile.ui.actions,
- org.eclipse.papyrus.uml.properties.profile.ui.compositeforview,
- org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel,
- org.eclipse.papyrus.uml.properties.profile.ui.dialogs,
- org.eclipse.papyrus.uml.properties.profile.ui.items,
- org.eclipse.papyrus.uml.properties.profile.ui.listeners,
- org.eclipse.papyrus.uml.properties.profile.ui.panels,
- org.eclipse.papyrus.uml.properties.profile.ui.section,
- org.eclipse.papyrus.uml.properties.profile.ui.views,
- org.eclipse.papyrus.uml.properties.util,
- org.eclipse.papyrus.uml.properties.widgets
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.views.properties.model;bundle-version="1.1.0",
- org.eclipse.papyrus.views.properties;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
- org.eclipse.emf.databinding;bundle-version="1.2.0",
- org.eclipse.jface;bundle-version="3.6.1",
- org.eclipse.core.databinding.property;bundle-version="1.3.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
- org.eclipse.ui;bundle-version="3.6.1",
- org.eclipse.papyrus.uml.profile;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.constraints;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.1.0",
- org.eclipse.uml2.uml;bundle-version="5.0.0",
- org.eclipse.uml2.common.edit;bundle-version="1.6.0",
- org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.appearance;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
- org.eclipse.gef;bundle-version="3.8.1",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.1.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-Activator: org.eclipse.papyrus.uml.properties.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.properties;singleton:=tru
- e
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Description: %pluginDescription
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.properties.constraints,
+ org.eclipse.papyrus.uml.properties.creation,
+ org.eclipse.papyrus.uml.properties.databinding,
+ org.eclipse.papyrus.uml.properties.datatype,
+ org.eclipse.papyrus.uml.properties.modelelement,
+ org.eclipse.papyrus.uml.properties.preferences,
+ org.eclipse.papyrus.uml.properties.profile.ui.actions,
+ org.eclipse.papyrus.uml.properties.profile.ui.compositeforview,
+ org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel,
+ org.eclipse.papyrus.uml.properties.profile.ui.dialogs,
+ org.eclipse.papyrus.uml.properties.profile.ui.items,
+ org.eclipse.papyrus.uml.properties.profile.ui.listeners,
+ org.eclipse.papyrus.uml.properties.profile.ui.panels,
+ org.eclipse.papyrus.uml.properties.profile.ui.section,
+ org.eclipse.papyrus.uml.properties.profile.ui.views,
+ org.eclipse.papyrus.uml.properties.util,
+ org.eclipse.papyrus.uml.properties.widgets
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.views.properties.model;bundle-version="1.1.0",
+ org.eclipse.papyrus.views.properties;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
+ org.eclipse.emf.databinding;bundle-version="1.2.0",
+ org.eclipse.jface;bundle-version="3.6.1",
+ org.eclipse.core.databinding.property;bundle-version="1.3.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
+ org.eclipse.ui;bundle-version="3.6.1",
+ org.eclipse.papyrus.uml.profile;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.constraints;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.properties;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.1.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ org.eclipse.uml2.common.edit;bundle-version="1.6.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.appearance;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
+ org.eclipse.gef;bundle-version="3.8.1",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.1.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.1.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.uml.properties.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.properties;singleton:=tru
+ e
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Description: %pluginDescription
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/Environment.xmi b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/Environment.xmi
index c7f09140fa8..89281fa422c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/Environment.xmi
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/Environment.xmi
@@ -89,6 +89,11 @@
widgetClass="GenericUMLDatatypeEditor"
namespace="//@namespaces.0"
type="Reference"/>
+ <propertyEditorTypes
+ label="Multiplicity Editor"
+ widgetClass="MultiplicityDialog"
+ namespace="//@namespaces.0"
+ type="Reference"/>
<namespaces
name="uml"
value="org.eclipse.papyrus.uml.properties.widgets"/>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt
index ee8b8e276d0..2d1ae899e4a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MemberEnd.xwt
@@ -1,19 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Group xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation" xmlns:j="clr-namespace:java.lang"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- text="Member End">
- <Group.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Group.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- <ppe:EnumCombo input="{Binding}" property="MemberEnd:owner"></ppe:EnumCombo>
- <ppe:BooleanRadio input="{Binding}" property="MemberEnd:navigable"></ppe:BooleanRadio>
- <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Group xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns="http://www.eclipse.org/xwt/presentation" xmlns:j="clr-namespace:java.lang"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ text="Member End">
+ <Group.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Group.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ <ppe:EnumCombo input="{Binding}" property="MemberEnd:owner"></ppe:EnumCombo>
+ <ppe:BooleanRadio input="{Binding}" property="MemberEnd:navigable"></ppe:BooleanRadio>
+ <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ </Composite>
</Group> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MultipleProperty.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MultipleProperty.xwt
index 1c334dacda8..1feccc483cd 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MultipleProperty.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/MultipleProperty.xwt
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt
index a537acc67ce..09d021d14e2 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleActionInputPin.xwt
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:j="clr-namespace:java.lang" xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog property="UML:TypedElement:type"
- input="{Binding}"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:j="clr-namespace:java.lang" xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog property="UML:TypedElement:type"
+ input="{Binding}"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectorEnd.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectorEnd.xwt
index d242b1d5806..0ad3a11345b 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectorEnd.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleConnectorEnd.xwt
@@ -1,24 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
- xmlns="http://www.eclipse.org/xwt/presentation">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns="http://www.eclipse.org/xwt/presentation">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt
index 54d1e2c0618..9fec90a720e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleInputPin.xwt
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:j="clr-namespace:java.lang"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets" xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog property="UML:TypedElement:type"
- input="{Binding}"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:j="clr-namespace:java.lang"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets" xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog property="UML:TypedElement:type"
+ input="{Binding}"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMultiplicityElement.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMultiplicityElement.xwt
index 7acfbd06023..b28b772f34e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMultiplicityElement.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleMultiplicityElement.xwt
@@ -1,23 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets" xmlns="http://www.eclipse.org/xwt/presentation">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets" xmlns="http://www.eclipse.org/xwt/presentation">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt
index 5f92405f885..9fc7a230e6e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleOutputPin.xwt
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog property="UML:TypedElement:type"
- input="{Binding}"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog property="UML:TypedElement:type"
+ input="{Binding}"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt
index 7d773898a5b..2caf5db80f6 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleParameter.xwt
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Parameter:isException"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Parameter:isStream"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:Parameter:direction"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:Parameter:effect"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:Parameter:defaultValue"></ppe:ReferenceDialog>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns="http://www.eclipse.org/xwt/presentation" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Parameter:isException"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Parameter:isStream"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:Parameter:direction"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:Parameter:effect"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:Parameter:defaultValue"></ppe:ReferenceDialog>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt
index 80682854676..02f73d779b7 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePin.xwt
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog property="UML:TypedElement:type"
- input="{Binding}"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog property="UML:TypedElement:type"
+ input="{Binding}"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt
index 3d698e2651d..e49e8af1500 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SinglePort.xwt
@@ -1,60 +1,60 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Port:isBehavior"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Port:isService"></ppe:BooleanRadio>
- <ppe:BooleanRadio property="UML:Port:isConjugated"
- input="{Binding}"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:Property:defaultValue"></ppe:ReferenceDialog>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:Port:provided"></ppe:MultiReference>
- <ppe:MultiReference input="{Binding}" property="UML:Port:required"></ppe:MultiReference>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}"
- property="UML:Property:subsettedProperty"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:java.lang"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Port:isBehavior"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Port:isService"></ppe:BooleanRadio>
+ <ppe:BooleanRadio property="UML:Port:isConjugated"
+ input="{Binding}"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:Property:defaultValue"></ppe:ReferenceDialog>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:Port:provided"></ppe:MultiReference>
+ <ppe:MultiReference input="{Binding}" property="UML:Port:required"></ppe:MultiReference>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}"
+ property="UML:Property:subsettedProperty"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt
index 7a2951d21f8..16462827ca3 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleProperty.xwt
@@ -1,42 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:x="http://www.eclipse.org/xwt">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:Property:defaultValue"></ppe:ReferenceDialog>
- <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
- <ppe:MultiReference input="{Binding}"
- property="UML:Property:subsettedProperty"></ppe:MultiReference>
- <ppe:MultiReference property="UML:Property:redefinedProperty"
- input="{Binding}"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:j="clr-namespace:java.lang"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:x="http://www.eclipse.org/xwt">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerived"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Property:isDerivedUnion"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:Property:defaultValue"></ppe:ReferenceDialog>
+ <ppe:EnumCombo input="{Binding}" property="UML:Property:aggregation"></ppe:EnumCombo>
+ <ppe:MultiReference input="{Binding}"
+ property="UML:Property:subsettedProperty"></ppe:MultiReference>
+ <ppe:MultiReference property="UML:Property:redefinedProperty"
+ input="{Binding}"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt
index e9f4f5a63bc..e976767f289 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleStructuralFeature.xwt
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:j="clr-namespace:java.lang"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:j="clr-namespace:java.lang"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns="http://www.eclipse.org/xwt/presentation" xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:StructuralFeature:isReadOnly"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Feature:isStatic"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt
index 3e3509ba44a..58b9df65971 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleValuePin.xwt
@@ -1,54 +1,54 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
- xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt"
- xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}"
- property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
- <ppe:ReferenceDialog input="{Binding}" property="UML:ValuePin:value"></ppe:ReferenceDialog>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns:j="clr-namespace:java.lang" xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}" property="UML:Pin:isControl"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:ObjectNode:isControlType"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:RedefinableElement:isLeaf"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:ObjectNode:ordering"></ppe:EnumCombo>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:selection"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:TypedElement:type"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}"
+ property="UML:ObjectNode:upperBound"></ppe:ReferenceDialog>
+ <ppe:ReferenceDialog input="{Binding}" property="UML:ValuePin:value"></ppe:ReferenceDialog>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:MultiReference input="{Binding}" property="UML:ObjectNode:inState"></ppe:MultiReference>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt
index c8d94261fd5..e09d846257d 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/ui/SingleVariable.xwt
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Composite xmlns:j="clr-namespace:java.lang"
- xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
- xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
- xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation"
- xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
- <ppe:BooleanRadio input="{Binding}"
- property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
- </Composite>
- <Composite>
- <Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
- </Composite.layout>
- <ppe:StringCombo input="{Binding}" property="Multiplicity:multiplicity"></ppe:StringCombo>
- <ppe:ReferenceDialog property="UML:TypedElement:type"
- input="{Binding}"></ppe:ReferenceDialog>
- </Composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite xmlns:j="clr-namespace:java.lang"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:uml="clr-namespace:org.eclipse.papyrus.uml.properties.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:StringEditor input="{Binding}" property="UML:NamedElement:name"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isOrdered"></ppe:BooleanRadio>
+ <ppe:BooleanRadio input="{Binding}"
+ property="UML:MultiplicityElement:isUnique"></ppe:BooleanRadio>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:EnumCombo input="{Binding}" property="UML:NamedElement:visibility"></ppe:EnumCombo>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
+ <uml:MultiplicityDialog input="{Binding}" property="Multiplicity:multiplicity"></uml:MultiplicityDialog>
+ <ppe:ReferenceDialog property="UML:TypedElement:type"
+ input="{Binding}"></ppe:ReferenceDialog>
+ </Composite>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/plugin.xml b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/plugin.xml
index b0e3d898804..a53b2901f09 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/plugin.xml
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/plugin.xml
@@ -1,81 +1,96 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse version="3.4"?>
-
-<plugin>
- <extension-point id="org.eclipse.papyrus.uml.properties.languageEditor" name="%extension-point.name" schema="schema/org.eclipse.papyrus.uml.properties.languageEditor.exsd"/>
- <extension-point id="org.eclipse.papyrus.uml.properties.datatype" name="DataType" schema="schema/org.eclipse.papyrus.uml.properties.datatype.exsd"/>
- <extension point="org.eclipse.papyrus.views.properties.environment">
- <environment environmentModel="Model/Environment.xmi">
- </environment>
- </extension>
- <extension point="org.eclipse.papyrus.views.properties.context">
- <context contextModel="Model/UML/UML.ctx">
- </context>
- </extension>
- <extension
- point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
- <propertyContributor
- contributorId="TreeOutlinePage"
- labelProvider="org.eclipse.papyrus.views.properties.providers.PropertiesHeaderLabelProvider"
- tabDescriptorProvider="org.eclipse.papyrus.views.properties.xwt.XWTTabDescriptorProvider">
- <propertyCategory
- category="org.eclipse.papyrus"></propertyCategory>
- </propertyContributor>
- </extension>
- <extension point="org.eclipse.emf.ecore.uri_mapping">
- <mapping source="pathmap://UML_CONTEXT/" target="platform:/plugin/org.eclipse.papyrus.views.properties.uml/Model/UML/">
- </mapping>
- </extension>
- <extension point="org.eclipse.papyrus.uml.properties.languageEditor">
- <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor">
- </editor>
- <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="C">
- </editor>
- <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="C++">
- </editor>
- <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="JAVA">
- </editor>
- <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="Natural language">
- </editor>
- </extension>
- <extension point="org.eclipse.papyrus.views.properties.context">
- <context contextModel="Model/UMLNotation/UMLNotation.ctx">
- </context>
- </extension>
-
- <!-- TODO EMF-FACET
- <extension
- point="org.eclipse.papyrus.emf.facet.infra.query.registration">
- <modelqueryset
- file="Model/UML/uml.querySet">
- </modelqueryset>
- </extension-->
- <extension
- point="org.eclipse.papyrus.views.properties.labelprovider">
- <labelProvider
- labelProvider="org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider"
- priority="50">
- </labelProvider>
- <labelProvider
- labelProvider="org.eclipse.papyrus.uml.profile.providers.AppliedStereotypePropertyFilteredLabelProvider"
- priority="45">
- </labelProvider>
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
- <propertyTabs
- contributorId="TreeOutlinePage">
- <propertyTab id="Base" label="General" category="org.eclipse.papyrus" afterTab=""/>
- <propertyTab id="Comments" label="Comments" category="org.eclipse.papyrus" afterTab="Base"/>
- <propertyTab id="advanced" label="Advanced" category="org.eclipse.papyrus" afterTab="Comments"/>
- </propertyTabs>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.eclipse.papyrus.uml.properties.languagepreferences.languagepreferencesPackage"
- genModel="Model/LanguagePreferences.genmodel"
- uri="http://www.eclipse.org/papyrus/properties/uml/languagePreferences">
- </package>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse version="3.4"?>
+
+<plugin>
+ <extension-point id="org.eclipse.papyrus.uml.properties.languageEditor" name="%extension-point.name" schema="schema/org.eclipse.papyrus.uml.properties.languageEditor.exsd"/>
+ <extension-point id="org.eclipse.papyrus.uml.properties.datatype" name="DataType" schema="schema/org.eclipse.papyrus.uml.properties.datatype.exsd"/>
+ <extension point="org.eclipse.papyrus.views.properties.environment">
+ <environment environmentModel="Model/Environment.xmi">
+ </environment>
</extension>
-</plugin>
+ <extension point="org.eclipse.papyrus.views.properties.context">
+ <context contextModel="Model/UML/UML.ctx">
+ </context>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="TreeOutlinePage"
+ labelProvider="org.eclipse.papyrus.views.properties.providers.PropertiesHeaderLabelProvider"
+ tabDescriptorProvider="org.eclipse.papyrus.views.properties.xwt.XWTTabDescriptorProvider">
+ <propertyCategory
+ category="org.eclipse.papyrus"></propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension point="org.eclipse.emf.ecore.uri_mapping">
+ <mapping source="pathmap://UML_CONTEXT/" target="platform:/plugin/org.eclipse.papyrus.views.properties.uml/Model/UML/">
+ </mapping>
+ </extension>
+ <extension point="org.eclipse.papyrus.uml.properties.languageEditor">
+ <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor">
+ </editor>
+ <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="C">
+ </editor>
+ <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="C++">
+ </editor>
+ <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="JAVA">
+ </editor>
+ <editor editor="org.eclipse.papyrus.uml.properties.widgets.NaturalLanguageEditor" language="Natural language">
+ </editor>
+ </extension>
+ <extension point="org.eclipse.papyrus.views.properties.context">
+ <context contextModel="Model/UMLNotation/UMLNotation.ctx">
+ </context>
+ </extension>
+
+ <!-- TODO EMF-FACET
+ <extension
+ point="org.eclipse.papyrus.emf.facet.infra.query.registration">
+ <modelqueryset
+ file="Model/UML/uml.querySet">
+ </modelqueryset>
+ </extension-->
+ <extension
+ point="org.eclipse.papyrus.views.properties.labelprovider">
+ <labelProvider
+ labelProvider="org.eclipse.papyrus.uml.tools.providers.UMLFilteredLabelProvider"
+ priority="50">
+ </labelProvider>
+ <labelProvider
+ labelProvider="org.eclipse.papyrus.uml.profile.providers.AppliedStereotypePropertyFilteredLabelProvider"
+ priority="45">
+ </labelProvider>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="TreeOutlinePage">
+ <propertyTab id="Base" label="General" category="org.eclipse.papyrus" afterTab=""/>
+ <propertyTab id="Comments" label="Comments" category="org.eclipse.papyrus" afterTab="Base"/>
+ <propertyTab id="advanced" label="Advanced" category="org.eclipse.papyrus" afterTab="Comments"/>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.emf.ecore.generated_package">
+ <package
+ class="org.eclipse.papyrus.uml.properties.languagepreferences.languagepreferencesPackage"
+ genModel="Model/LanguagePreferences.genmodel"
+ uri="http://www.eclipse.org/papyrus/properties/uml/languagePreferences">
+ </package>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.views.properties.propertyview"
+ class="org.eclipse.papyrus.uml.properties.preferences.MultiplicityEditorPreferencePage"
+ id="org.eclipse.papyrus.uml.properties.multiplicityEditorProperties"
+ name="Multiplicity Editor">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.uml.properties.preferences.MultiplicityEditorPreferenceInitializer">
+ </initializer>
+ </extension>
+</plugin>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/Messages.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/Messages.java
index e7dff13d42e..e6757d2ec5a 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/Messages.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/Messages.java
@@ -1,51 +1,63 @@
-/*****************************************************************************
- * Copyright (c) 2011 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.uml.properties.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.properties.messages.messages"; //$NON-NLS-1$
-
- public static String ExpressionLanguageFactory_EditLanguage;
-
- public static String ExpressionLanguageFactory_LanguageDuplicateError;
-
- public static String ExpressionLanguageFactory_SetNewLanguage;
-
- public static String UMLNotationModelElement_DepthFull;
-
- public static String UMLNotationModelElement_DepthNone;
-
- public static String ExpressionEditor_BodyLabel;
-
- public static String ProfileApplicationEditor_ApplyProfile;
-
- public static String ProfileApplicationEditor_ApplyProfilesDialogDescription;
-
- public static String ProfileApplicationEditor_ApplyProfilesDialogTitle;
-
- public static String ProfileApplicationEditor_ApplyRegisteredProfile;
-
- public static String ProfileApplicationEditor_WaitMessage;
-
- public static String ProfileApplicationEditor_WaitMessageTitle;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 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.uml.properties.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.properties.messages.messages"; //$NON-NLS-1$
+
+ public static String ExpressionLanguageFactory_EditLanguage;
+
+ public static String ExpressionLanguageFactory_LanguageDuplicateError;
+
+ public static String ExpressionLanguageFactory_SetNewLanguage;
+
+ public static String UMLNotationModelElement_DepthFull;
+
+ public static String UMLNotationModelElement_DepthNone;
+
+ public static String ExpressionEditor_BodyLabel;
+
+ public static String ProfileApplicationEditor_ApplyProfile;
+
+ public static String ProfileApplicationEditor_ApplyProfilesDialogDescription;
+
+ public static String ProfileApplicationEditor_ApplyProfilesDialogTitle;
+
+ public static String ProfileApplicationEditor_ApplyRegisteredProfile;
+
+ public static String ProfileApplicationEditor_WaitMessage;
+
+ public static String ProfileApplicationEditor_WaitMessageTitle;
+
+ /** The multiplicity Editor string text label. */
+ public static String MultiplicityPreference_MultiplicityEditor;
+
+ /** The simple mode description. */
+ public static String MultiplicityPreference_SimpleModeDescription;
+
+ /** The advanced mode description. */
+ public static String MultiplicityPreference_AdvancedModeDescription;
+
+ /** The multiplicity Editor string text label. */
+ public static String MultiplicityPreference_fieldEditorMode;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/messages.properties b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/messages.properties
index b2662df2674..886eded98a1 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/messages.properties
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/messages/messages.properties
@@ -1,12 +1,16 @@
-ExpressionEditor_BodyLabel=Body
-ProfileApplicationEditor_ApplyProfile=Apply profile
-ProfileApplicationEditor_ApplyProfilesDialogDescription=Choose profiles to apply
-ProfileApplicationEditor_ApplyProfilesDialogTitle=Apply Profiles...
-ProfileApplicationEditor_ApplyRegisteredProfile=Apply registered profile
-ProfileApplicationEditor_WaitMessage=Applying profile...
-ProfileApplicationEditor_WaitMessageTitle=Profile application
-UMLNotationModelElement_DepthFull=Full
-UMLNotationModelElement_DepthNone=None
-ExpressionLanguageFactory_EditLanguage=Edit language
-ExpressionLanguageFactory_LanguageDuplicateError=The same language cannot be used more than once
-ExpressionLanguageFactory_SetNewLanguage=Set the new language
+ExpressionEditor_BodyLabel=Body
+ProfileApplicationEditor_ApplyProfile=Apply profile
+ProfileApplicationEditor_ApplyProfilesDialogDescription=Choose profiles to apply
+ProfileApplicationEditor_ApplyProfilesDialogTitle=Apply Profiles...
+ProfileApplicationEditor_ApplyRegisteredProfile=Apply registered profile
+ProfileApplicationEditor_WaitMessage=Applying profile...
+ProfileApplicationEditor_WaitMessageTitle=Profile application
+UMLNotationModelElement_DepthFull=Full
+UMLNotationModelElement_DepthNone=None
+ExpressionLanguageFactory_EditLanguage=Edit language
+ExpressionLanguageFactory_LanguageDuplicateError=The same language cannot be used more than once
+ExpressionLanguageFactory_SetNewLanguage=Set the new language
+MultiplicityPreference_MultiplicityEditor=Multiplicity Editor
+MultiplicityPreference_SimpleModeDescription= is the edition of lower and upper values by one editor.
+MultiplicityPreference_AdvancedModeDescription= is the edition of lower and upper values by two editors.
+MultiplicityPreference_fieldEditorMode=Multiplicity editor mode
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
index e94aa1a07ea..94a59097200 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/MemberEndModelElement.java
@@ -1,142 +1,142 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * 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
- * Christian W. Damus (CEA) - bug 323802
- * Christian W. Damus (CEA) - bug 417409
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.modelelement;
-
-import static org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue.ASSOCIATION;
-import static org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue.CLASSIFIER;
-import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ANY;
-import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ONE;
-import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ONE_OR_MORE;
-import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.OPTIONAL;
-
-import java.util.List;
-
-import org.eclipse.core.databinding.observable.IObservable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
-import org.eclipse.papyrus.uml.properties.Activator;
-import org.eclipse.papyrus.uml.tools.databinding.ExtensionEndMultiplicityObservableValue;
-import org.eclipse.papyrus.uml.tools.databinding.MultiplicityObservableValue;
-import org.eclipse.papyrus.uml.tools.databinding.NavigationObservableValue;
-import org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue;
-import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement;
-import org.eclipse.uml2.uml.ExtensionEnd;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A Model Element for manipulating MemberEnd properties
- *
- * @author Camille Letavernier
- */
-public class MemberEndModelElement extends AbstractModelElement {
-
- protected EObject source;
-
- protected EditingDomain domain;
-
- /**
- * The "multiplicity" virtual property
- */
- public static final String MULTIPLICITY = "multiplicity"; //$NON-NLS-1$
-
- /**
- * The "owner" virtual property
- */
- public static final String OWNER = "owner"; //$NON-NLS-1$
-
- /**
- * The "navigable" virtual property
- */
- public static final String NAVIGABLE = "navigable"; //$NON-NLS-1$
-
- /**
- *
- * Constructor.
- *
- * @param source
- * The EObject being edited
- * @param domain
- * The Editing domain on which the commands will be executed
- */
- public MemberEndModelElement(EObject source, EditingDomain domain) {
- this.source = source;
- this.domain = domain;
- }
-
- @Override
- public IObservable doGetObservable(String propertyPath) {
- if (propertyPath.equals(MULTIPLICITY)) {
- if (source instanceof ExtensionEnd) {
- return new ExtensionEndMultiplicityObservableValue((ExtensionEnd) source, domain);
- }
- return new MultiplicityObservableValue(source, domain);
- } else if (propertyPath.equals(OWNER)) {
- return new OwnerObservableValue(source, domain);
- } else if (propertyPath.equals(NAVIGABLE)) {
- return new NavigationObservableValue(source, domain);
- }
- Activator.log.warn("The property " + propertyPath + " doesn't exist"); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- }
-
- @Override
- public IStaticContentProvider getContentProvider(String propertyPath) {
- if (propertyPath.equals(MULTIPLICITY)) {
- if (source instanceof ExtensionEnd) {
- return new StaticContentProvider(new String[] { ONE, OPTIONAL });
- }
- return new StaticContentProvider(new String[] { ANY, ONE_OR_MORE, OPTIONAL, ONE });
- } else if (propertyPath.equals(OWNER)) {
- return new StaticContentProvider(new String[] { ASSOCIATION, CLASSIFIER });
- }
- return super.getContentProvider(propertyPath);
- }
-
- @Override
- public boolean isMandatory(String propertyPath) {
- return true;
- }
-
- @Override
- public boolean isEditable(String propertyPath) {
- if (propertyPath.equals(OWNER)) {
- List<Property> memberEnds = ((Property) source).getAssociation().getMemberEnds();
- if (memberEnds.size() == 2) {
- // Association between two associations : this doesn't make sense ?
- if (isAssociation(memberEnds.get(0)) && isAssociation(memberEnds.get(1))) {
- return false;
- }
- }
- return (((Property) source).getAssociation().getMemberEnds().size() <= 2) && !EMFHelper.isReadOnly(source);
- }
- return !EMFHelper.isReadOnly(source);
- }
-
- private boolean isAssociation(Property property) {
- if (property.getType() == null) {
- return false;
- }
- return property.getType().eClass() == UMLPackage.eINSTANCE.getAssociation();
- }
-
- @Override
- public boolean forceRefresh(String propertyPath) {
- return propertyPath.equals(NAVIGABLE) || propertyPath.equals(OWNER);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * 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
+ * Christian W. Damus (CEA) - bug 323802
+ * Christian W. Damus (CEA) - bug 417409
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.modelelement;
+
+import static org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue.ASSOCIATION;
+import static org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue.CLASSIFIER;
+import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ANY;
+import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ONE;
+import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.ONE_OR_MORE;
+import static org.eclipse.papyrus.uml.tools.util.MultiplicityParser.OPTIONAL;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
+import org.eclipse.papyrus.uml.properties.Activator;
+import org.eclipse.papyrus.uml.tools.databinding.ExtendedMultiplicityObservableValue;
+import org.eclipse.papyrus.uml.tools.databinding.ExtensionEndMultiplicityObservableValue;
+import org.eclipse.papyrus.uml.tools.databinding.NavigationObservableValue;
+import org.eclipse.papyrus.uml.tools.databinding.OwnerObservableValue;
+import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement;
+import org.eclipse.uml2.uml.ExtensionEnd;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * A Model Element for manipulating MemberEnd properties
+ *
+ * @author Camille Letavernier
+ */
+public class MemberEndModelElement extends AbstractModelElement {
+
+ protected EObject source;
+
+ protected EditingDomain domain;
+
+ /**
+ * The "multiplicity" virtual property
+ */
+ public static final String MULTIPLICITY = "multiplicity"; //$NON-NLS-1$
+
+ /**
+ * The "owner" virtual property
+ */
+ public static final String OWNER = "owner"; //$NON-NLS-1$
+
+ /**
+ * The "navigable" virtual property
+ */
+ public static final String NAVIGABLE = "navigable"; //$NON-NLS-1$
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param source
+ * The EObject being edited
+ * @param domain
+ * The Editing domain on which the commands will be executed
+ */
+ public MemberEndModelElement(EObject source, EditingDomain domain) {
+ this.source = source;
+ this.domain = domain;
+ }
+
+ @Override
+ public IObservable doGetObservable(String propertyPath) {
+ if (propertyPath.equals(MULTIPLICITY)) {
+ if (source instanceof ExtensionEnd) {
+ return new ExtensionEndMultiplicityObservableValue((ExtensionEnd) source, domain);
+ }
+ return new ExtendedMultiplicityObservableValue(source, domain);
+ } else if (propertyPath.equals(OWNER)) {
+ return new OwnerObservableValue(source, domain);
+ } else if (propertyPath.equals(NAVIGABLE)) {
+ return new NavigationObservableValue(source, domain);
+ }
+ Activator.log.warn("The property " + propertyPath + " doesn't exist"); //$NON-NLS-1$ //$NON-NLS-2$
+ return null;
+ }
+
+ @Override
+ public IStaticContentProvider getContentProvider(String propertyPath) {
+ if (propertyPath.equals(MULTIPLICITY)) {
+ if (source instanceof ExtensionEnd) {
+ return new StaticContentProvider(new String[] { ONE, OPTIONAL });
+ }
+ return new StaticContentProvider(new String[] { ANY, ONE_OR_MORE, OPTIONAL, ONE });
+ } else if (propertyPath.equals(OWNER)) {
+ return new StaticContentProvider(new String[] { ASSOCIATION, CLASSIFIER });
+ }
+ return super.getContentProvider(propertyPath);
+ }
+
+ @Override
+ public boolean isMandatory(String propertyPath) {
+ return true;
+ }
+
+ @Override
+ public boolean isEditable(String propertyPath) {
+ if (propertyPath.equals(OWNER)) {
+ List<Property> memberEnds = ((Property) source).getAssociation().getMemberEnds();
+ if (memberEnds.size() == 2) {
+ // Association between two associations : this doesn't make sense ?
+ if (isAssociation(memberEnds.get(0)) && isAssociation(memberEnds.get(1))) {
+ return false;
+ }
+ }
+ return (((Property) source).getAssociation().getMemberEnds().size() <= 2) && !EMFHelper.isReadOnly(source);
+ }
+ return !EMFHelper.isReadOnly(source);
+ }
+
+ private boolean isAssociation(Property property) {
+ if (property.getType() == null) {
+ return false;
+ }
+ return property.getType().eClass() == UMLPackage.eINSTANCE.getAssociation();
+ }
+
+ @Override
+ public boolean forceRefresh(String propertyPath) {
+ return propertyPath.equals(NAVIGABLE) || propertyPath.equals(OWNER);
+ }
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferenceInitializer.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferenceInitializer.java
new file mode 100644
index 00000000000..dcf2bc4838f
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferenceInitializer.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.widgets.util.MultiplicityConstants;
+
+/**
+ * This class allow to define the multiplicity preference initialization.
+ */
+public class MultiplicityEditorPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityEditorPreferenceInitializer() {
+ // Nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ final IPreferenceStore store = MultiplicityEditorPreferences.instance.getPreferenceStore();
+ store.setDefault(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE, MultiplicityConstants.SIMPLE_MODE);
+ }
+
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferencePage.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferencePage.java
new file mode 100644
index 00000000000..95363eb903e
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferencePage.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.preferences;
+
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.papyrus.infra.widgets.util.MultiplicityConstants;
+import org.eclipse.papyrus.uml.properties.messages.Messages;
+import org.eclipse.swt.SWT;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class define the multiplicity editor preference page.
+ */
+public class MultiplicityEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ /**
+ * Initialize the preference page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ *
+ * @param workbench
+ * The current workbench.
+ */
+ public void init(final IWorkbench workbench) {
+ setPreferenceStore(MultiplicityEditorPreferences.instance.getPreferenceStore());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(final Composite parent) {
+
+ // Create the group for the multiplicity editor
+ final Group multiplicityEditorGroup = new Group(parent, SWT.NONE);
+ multiplicityEditorGroup.setText(Messages.MultiplicityPreference_MultiplicityEditor);
+ multiplicityEditorGroup.setLayout(new GridLayout(1, true));
+ multiplicityEditorGroup.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+
+ // Create the parent contents
+ super.createContents(multiplicityEditorGroup);
+
+ // Create the label description
+ final Label descriptionLabel = new Label(multiplicityEditorGroup, SWT.NONE);
+ descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+ StringBuilder description = new StringBuilder();
+ description.append("\""); //$NON-NLS-1$
+ description.append(MultiplicityConstants.SIMPLE_MODE_TEXT_VALUE);
+ description.append(Messages.MultiplicityPreference_SimpleModeDescription);
+ description.append("\n\""); //$NON-NLS-1$
+ description.append(MultiplicityConstants.ADVANCED_MODE_TEXT_VALUE);
+ description.append(Messages.MultiplicityPreference_AdvancedModeDescription);
+ descriptionLabel.setText(description.toString());
+
+ return multiplicityEditorGroup;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+
+ final String[][] values = { { MultiplicityConstants.SIMPLE_MODE_TEXT_VALUE, MultiplicityConstants.SIMPLE_MODE }, { MultiplicityConstants.ADVANCED_MODE_TEXT_VALUE, MultiplicityConstants.ADVANCED_MODE } };
+ final ComboFieldEditor fieldEditor = new ComboFieldEditor(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE, Messages.MultiplicityPreference_fieldEditorMode, values, getFieldEditorParent());
+ addField(fieldEditor);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferences.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferences.java
new file mode 100644
index 00000000000..4eff8d0ba9f
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/preferences/MultiplicityEditorPreferences.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
+
+/**
+ * This class define the constants and the preference store for the multiplicity editor in properties view.
+ */
+public class MultiplicityEditorPreferences {
+
+ /**
+ * Instance singleton.
+ */
+ public static final MultiplicityEditorPreferences instance = new MultiplicityEditorPreferences();
+
+
+ /**
+ * The preference store.
+ */
+ private IPreferenceStore preferences = Activator.getInstance().getPreferenceStore();
+
+
+ /**
+ * Constructor.
+ */
+ private MultiplicityEditorPreferences() {
+ // Nothing
+ }
+
+ /**
+ * Gets the preference store.
+ *
+ * @return The preference store.
+ */
+ public IPreferenceStore getPreferenceStore() {
+ return preferences;
+ }
+
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/ExtendedMultiplicityDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/ExtendedMultiplicityDialog.java
new file mode 100644
index 00000000000..54339f35420
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/ExtendedMultiplicityDialog.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.widgets;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+
+/**
+ * The extended multiplicity dialog which allow to redefine the {@link #canEditStringCombo()} method dependent of lower and upper ValueSpecification type.
+ */
+public class ExtendedMultiplicityDialog extends MultiplicityDialog {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ */
+ public ExtendedMultiplicityDialog(final Composite parent, final int style) {
+ this(parent, style, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style.
+ * @param preferenceStore
+ * The preference store.
+ */
+ public ExtendedMultiplicityDialog(final Composite parent, final int style, final IPreferenceStore preferenceStore) {
+ super(parent, style, preferenceStore);
+ }
+
+ /**
+ * Redefine this method to manage the lower and upper ValueSpecification type. {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog#canEditStringCombo()
+ */
+ @Override
+ protected boolean canEditStringCombo() {
+ boolean result = super.canEditStringCombo();
+ if (null != lowerValueEditor.getValue()) {
+ if (!(lowerValueEditor.getValue() instanceof LiteralInteger)) {
+ result = false;
+ }
+ }
+
+ if (null != upperValueEditor.getValue()) {
+ if (!(upperValueEditor.getValue() instanceof LiteralUnlimitedNatural)) {
+ result = false;
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/MultiplicityDialog.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/MultiplicityDialog.java
new file mode 100644
index 00000000000..bdb3a12f69a
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/MultiplicityDialog.java
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.uml.properties.preferences.MultiplicityEditorPreferences;
+import org.eclipse.papyrus.views.properties.widgets.AbstractPropertyEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The multiplicity dialog for the properties view.
+ */
+public class MultiplicityDialog extends AbstractPropertyEditor {
+
+ /**
+ * The multiplicity lower value property path.
+ */
+ private static final String MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH = "UML:MultiplicityElement:lowerValue"; //$NON-NLS-1$
+
+ /**
+ * The multiplicity upper value property path.
+ */
+ private static final String MULTIPLICITY_UPPER_VALUE_UML_PROPERTY_PATH = "UML:MultiplicityElement:upperValue"; //$NON-NLS-1$
+
+ /**
+ * The number of properties path used.
+ */
+ private static final int NuMBER_PROPERTIES_PATH = 3;
+
+
+ /**
+ * The ValueFactory used to create or edit Objects directly from this editor.
+ */
+ protected ReferenceValueFactory factory;
+
+ /**
+ * The MultiplicityReferenceDialog widget.
+ */
+ protected org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog editor;
+
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ */
+ public MultiplicityDialog(final Composite parent, final int style) {
+ setEditor(createMultiplicityDialog(parent, style));
+ }
+
+ /**
+ * Creates the multiplicity dialog.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ * @return The reference dialog.
+ */
+ protected org.eclipse.papyrus.infra.widgets.editors.MultiplicityDialog createMultiplicityDialog(
+ final Composite parent, final int style) {
+ return editor = new ExtendedMultiplicityDialog(parent, style, MultiplicityEditorPreferences.instance.getPreferenceStore());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.views.properties.widgets.AbstractPropertyEditor#doBinding()
+ */
+ @Override
+ protected void doBinding() {
+ // Create the content providers for each editor
+ final List<IStaticContentProvider> contentProviders = new ArrayList<IStaticContentProvider>(NuMBER_PROPERTIES_PATH);
+ contentProviders.add(input.getContentProvider(propertyPath));
+ contentProviders.add(input.getContentProvider(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ contentProviders.add(input.getContentProvider(MULTIPLICITY_UPPER_VALUE_UML_PROPERTY_PATH));
+ editor.setContentProviders(contentProviders);
+
+ // Create the label providers for each editor
+ final List<ILabelProvider> labelProviders = new ArrayList<ILabelProvider>(NuMBER_PROPERTIES_PATH);
+ labelProviders.add(input.getLabelProvider(propertyPath));
+ labelProviders.add(input.getLabelProvider(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ labelProviders.add(input.getLabelProvider(MULTIPLICITY_UPPER_VALUE_UML_PROPERTY_PATH));
+ editor.setLabelProviders(labelProviders);
+
+ editor.setDirectCreation(input.getDirectCreation(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ editor.setMandatory(input.isMandatory(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+
+ final List<ReferenceValueFactory> factories = new ArrayList<ReferenceValueFactory>(NuMBER_PROPERTIES_PATH);
+ if (null == factory) {
+ // Use the default factory from the DataSource
+ factories.add(input.getValueFactory(propertyPath));
+ } else {
+ // Use the factory explicitly specified
+ factories.add(factory);
+ }
+ factories.add(input.getValueFactory(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ factories.add(input.getValueFactory(MULTIPLICITY_UPPER_VALUE_UML_PROPERTY_PATH));
+ editor.setValueFactories(factories);
+
+ super.doBinding();
+ }
+
+ /**
+ * Sets the ValueFactory used to create or edit Objects directly from this editor.
+ *
+ * @param factory
+ * The reference value factory.
+ */
+ public void setFactory(final ReferenceValueFactory factory) {
+ this.factory = factory;
+ final List<ReferenceValueFactory> factories = new ArrayList<ReferenceValueFactory>(NuMBER_PROPERTIES_PATH);
+ factories.add(factory);
+ factories.add(input.getValueFactory(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ factories.add(input.getValueFactory(MULTIPLICITY_LOWER_VALUE_UML_PROPERTY_PATH));
+ editor.setValueFactories(factories);
+ }
+
+ /**
+ * Get the factory.
+ *
+ * @return The ValueFactory used to create or edit Objects directly from
+ * this editor.
+ */
+ public ReferenceValueFactory getFactory() {
+ return factory;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/plugin.xml b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/plugin.xml
index 7e54fcea8eb..5e17171b317 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/plugin.xml
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/plugin.xml
@@ -354,6 +354,32 @@
name="Lowest">
</Priority>
</DirectEditor>
+ <DirectEditor
+ additionalConstraint="org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.constraint.MultiplicityLowerValueDirectEditorConstraint"
+ contributor="CEA LIST"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValueSpecification.gif"
+ language="Advanced Value Specification Textual Editor"
+ objectToEdit="org.eclipse.uml2.uml.ValueSpecification">
+ <popupeditor
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration">
+ </popupeditor>
+ <Priority
+ name="Low">
+ </Priority>
+ </DirectEditor>
+ <DirectEditor
+ additionalConstraint="org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.constraint.MultiplicityUpperValueDirectEditorConstraint"
+ contributor="CEA LIST"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValueSpecification.gif"
+ language="Advanced Value Specification Textual Editor"
+ objectToEdit="org.eclipse.uml2.uml.ValueSpecification">
+ <popupeditor
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration">
+ </popupeditor>
+ <Priority
+ name="Low">
+ </Priority>
+ </DirectEditor>
</extension>
</plugin>
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityLowerValueDirectEditorConstraint.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityLowerValueDirectEditorConstraint.java
new file mode 100644
index 00000000000..8fb295e862b
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityLowerValueDirectEditorConstraint.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.constraint;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * This class allow to define a constraint corresponding to the multiplicity lower value.
+ */
+public class MultiplicityLowerValueDirectEditorConstraint implements IDirectEditorConstraint {
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityLowerValueDirectEditorConstraint() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#getLabel()
+ *
+ * @return The label.
+ */
+ public String getLabel() {
+ return " Multiplicity Element Lower Value"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#appliesTo(java.lang.Object)
+ *
+ * @param selection
+ * the current selection
+ * @return <code>true</code> if selection matches the constraint, otherwise <code>false</code>
+ */
+ public boolean appliesTo(final Object selection) {
+ boolean appliedConstraint = false;
+ // Check that the selection is a structural feature and the lower value of multiplicity element
+ if (selection instanceof EStructuralFeature && UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(selection)) {
+ appliedConstraint = true;
+ } else if (selection instanceof ValueSpecification) {
+ final ValueSpecification valueSpecification = (ValueSpecification) selection;
+ if (valueSpecification.eContainer() instanceof MultiplicityElement) {
+ final EObject parent = valueSpecification.eContainer();
+ final Object lowerValue = parent.eGet(UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue());
+ appliedConstraint = valueSpecification.equals(lowerValue);
+ }
+ }
+ return appliedConstraint;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityUpperValueDirectEditorConstraint.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityUpperValueDirectEditorConstraint.java
new file mode 100644
index 00000000000..2a848b74854
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/constraint/MultiplicityUpperValueDirectEditorConstraint.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.constraint;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * This class allow to define a constraint corresponding to the multiplicity upper value.
+ */
+public class MultiplicityUpperValueDirectEditorConstraint implements IDirectEditorConstraint {
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityUpperValueDirectEditorConstraint() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#getLabel()
+ *
+ * @return The label.
+ */
+ public String getLabel() {
+ return " Multiplicity Element Upper Value"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#appliesTo(java.lang.Object)
+ *
+ * @param selection
+ * the current selection
+ * @return <code>true</code> if selection matches the constraint, otherwise <code>false</code>
+ */
+ public boolean appliesTo(final Object selection) {
+ boolean appliedConstraint = false;
+ // Check that the selection is a structural feature and the lower value of multiplicity element
+ if (selection instanceof EStructuralFeature && UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(selection)) {
+ appliedConstraint = true;
+ } else if (selection instanceof ValueSpecification) {
+ final ValueSpecification valueSpecification = (ValueSpecification) selection;
+ if (valueSpecification.eContainer() instanceof MultiplicityElement) {
+ final EObject parent = valueSpecification.eContainer();
+ final Object upperValue = parent.eGet(UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue());
+ appliedConstraint = upperValue.equals(valueSpecification);
+ }
+ }
+ return appliedConstraint;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration.java
new file mode 100644
index 00000000000..1a15d2c08a9
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.MultiplicityLowerValueSetCommand;
+
+/**
+ * This class allow to define a direct editor configuration for the multiplicity lower value (with allow to redefine the set command for the specific integer value.
+ */
+public class MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration extends ValueSpecificationXtextDirectEditorConfiguration {
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration#getParseCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected ICommand getParseCommand(final EObject initialValue, final EObject xtextObject) {
+ ICommand result = null;
+ if (objectToEdit instanceof EObject && null != structuralFeature) {
+ // If the xtext object is not null, that means the xtext was already parsed
+ if (null == xtextObject) {
+ result = MultiplicityLowerValueSetCommand.getInstance().createSetCommand(getInjector(), (EObject) objectToEdit, structuralFeature, xtextStringValue, getDefaultLanguages());
+ } else {
+ result = MultiplicityLowerValueSetCommand.getInstance().getParseCommand((EObject) objectToEdit, structuralFeature, xtextObject, xtextStringValue, getDefaultLanguages());
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration.java
new file mode 100644
index 00000000000..0094a987bd6
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.MultiplicityUpperValueSetCommand;
+
+/**
+ * This class allow to define a direct editor configuration for the multiplicity upper value (with allow to redefine the set command for the specific integer value.
+ */
+public class MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration extends ValueSpecificationXtextDirectEditorConfiguration {
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration#getParseCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected ICommand getParseCommand(final EObject initialValue, final EObject xtextObject) {
+ ICommand result = null;
+ if (objectToEdit instanceof EObject && null != structuralFeature) {
+ // If the xtext object is not null, that means the xtext was already parsed
+ if (null == xtextObject) {
+ result = MultiplicityUpperValueSetCommand.getInstance().createSetCommand(getInjector(), (EObject) objectToEdit, structuralFeature, xtextStringValue, getDefaultLanguages());
+ } else {
+ result = MultiplicityUpperValueSetCommand.getInstance().getParseCommand((EObject) objectToEdit, structuralFeature, xtextObject, xtextStringValue, getDefaultLanguages());
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/ValueSpecificationXtextDirectEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/ValueSpecificationXtextDirectEditorConfiguration.java
index 4a403ff51ec..631e826ebfe 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/ValueSpecificationXtextDirectEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/ui/contribution/ValueSpecificationXtextDirectEditorConfiguration.java
@@ -45,12 +45,12 @@ public class ValueSpecificationXtextDirectEditorConfiguration extends DefaultXte
/**
* The xtext string value.
*/
- private String xtextStringValue = ""; //$NON-NLS-1$
+ protected String xtextStringValue = ""; //$NON-NLS-1$
/**
* The structural feature to edit.
*/
- private EStructuralFeature structuralFeature = null;
+ protected EStructuralFeature structuralFeature = null;
/**
* {@inheritDoc}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/AbstractMultiplicityValueSpecificationSetCommand.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/AbstractMultiplicityValueSpecificationSetCommand.java
new file mode 100644
index 00000000000..a4a41de2393
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/AbstractMultiplicityValueSpecificationSetCommand.java
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralBooleanRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralIntegerOrUnlimitedNaturalRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralNullRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralRealRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralStringRule;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.LiteralBoolean;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralNull;
+import org.eclipse.uml2.uml.LiteralReal;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * This abstract class allow to define the method {@link #getObjectToUpdate(EObject, ValueSpecification, EObject)} for the multiplicity lower and upper value.
+ */
+public abstract class AbstractMultiplicityValueSpecificationSetCommand extends ValueSpecificationSetCommand {
+
+ /**
+ * Constructor.
+ */
+ public AbstractMultiplicityValueSpecificationSetCommand() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.ValueSpecificationSetCommand#getParseCommand(org.eclipse.emf.ecore.EObject, org.eclipse.uml2.uml.ValueSpecification, org.eclipse.emf.ecore.EStructuralFeature,
+ * org.eclipse.emf.ecore.EObject, java.lang.String, java.util.Collection)
+ */
+ protected ICommand getParseCommand(final EObject objectToEdit,
+ final ValueSpecification initialValueSpecification,
+ final EStructuralFeature structuralFeature,
+ final EObject xtextObject, final String xtextStringValue,
+ final Collection<String> defaultLanguages) {
+
+ // Check if the object to edit is not multi-valued
+ if (null != objectToEdit) {
+ return manageValueSpecification(objectToEdit, structuralFeature,
+ initialValueSpecification, xtextObject, xtextStringValue,
+ defaultLanguages);
+ } else {
+ // The object is multi-valued, create an opaque expression
+ return manageOpaqueExpression(
+ objectToEdit, structuralFeature, initialValueSpecification, xtextStringValue,
+ defaultLanguages);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.ValueSpecificationSetCommand#getObjectToUpdate(org.eclipse.emf.ecore.EObject, org.eclipse.uml2.uml.ValueSpecification, org.eclipse.emf.ecore.EObject)
+ */
+ protected ValueSpecification getObjectToUpdate(final EObject objectToEdit, final ValueSpecification initialValueSpecification, final EObject xtextObject) {
+ ValueSpecification result = null;
+ if (null != initialValueSpecification && null != xtextObject && xtextObject instanceof AbstractRule && null == ((AbstractRule) xtextObject).getUndefined()) {
+ final AbstractRule abstractRule = (AbstractRule) xtextObject;
+ if (initialValueSpecification instanceof InstanceValue && null != abstractRule.getInstanceSpecification()) {
+ result = (InstanceValue) initialValueSpecification;
+ } else {
+ final EObject xtextValue = abstractRule.getValue();
+ if (initialValueSpecification instanceof LiteralBoolean && xtextValue instanceof LiteralBooleanRule) {
+ result = (LiteralBoolean) initialValueSpecification;
+ } else if (initialValueSpecification instanceof LiteralInteger && xtextValue instanceof LiteralIntegerOrUnlimitedNaturalRule) {
+ if (null == ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue).getUnlimited()) {
+ result = (LiteralInteger) initialValueSpecification;
+ }
+ } else if (initialValueSpecification instanceof LiteralUnlimitedNatural && xtextValue instanceof LiteralIntegerOrUnlimitedNaturalRule) {
+ // Check that the value if positive for the unlimited natural type
+ final LiteralIntegerOrUnlimitedNaturalRule integerValue = ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue);
+ if (null != integerValue.getUnlimited() || 0 <= integerValue.getValue()) {
+ result = (LiteralUnlimitedNatural) initialValueSpecification;
+ }
+ } else if (initialValueSpecification instanceof LiteralReal && xtextValue instanceof LiteralRealRule) {
+ result = (LiteralReal) initialValueSpecification;
+ } else if (initialValueSpecification instanceof LiteralNull && xtextValue instanceof LiteralNullRule) {
+ result = (LiteralNull) initialValueSpecification;
+ } else if (initialValueSpecification instanceof LiteralString && xtextValue instanceof LiteralStringRule) {
+ result = (LiteralString) initialValueSpecification;
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityLowerValueSetCommand.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityLowerValueSetCommand.java
new file mode 100644
index 00000000000..c0864e398c2
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityLowerValueSetCommand.java
@@ -0,0 +1,129 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralBooleanRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralIntegerOrUnlimitedNaturalRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralNullRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralRealRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralStringRule;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.LiteralBoolean;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralReal;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * This class allow to define the multiplicity lower ValueSpecification set command which redefine the {@link #createValueSpecification(EObject, EObject, AbstractRule)} for the specific integer creation when the user fill an integer (instead of
+ * UnlimitedNatural).
+ */
+public class MultiplicityLowerValueSetCommand extends AbstractMultiplicityValueSpecificationSetCommand {
+
+ /**
+ * The instance of the class.
+ */
+ private static MultiplicityLowerValueSetCommand instance = new MultiplicityLowerValueSetCommand();
+
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityLowerValueSetCommand() {
+ super();
+ }
+
+ /**
+ * Get the single instance of MultiplicityLowerValueSetCommand.
+ *
+ * @return The single instance of MultiplicityLowerValueSetCommand.
+ */
+ public static MultiplicityLowerValueSetCommand getInstance() {
+ return instance;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.ValueSpecificationSetCommand#createValueSpecification(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject,
+ * org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule)
+ */
+ @Override
+ protected ValueSpecification createValueSpecification(final EObject objectToEdit, final EObject initialValueSpecification, final AbstractRule abstractRule) {
+ ValueSpecification createdValueSpecification = null;
+
+ final EObject value = abstractRule.getValue();
+ if (null != abstractRule.getInstanceSpecification()) {
+ // Create an instance value with specification value
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createInstanceValue();
+ ((InstanceValue) createdValueSpecification)
+ .setInstance(abstractRule.getInstanceSpecification());
+ } else {
+ if (value instanceof LiteralBooleanRule) {
+ // Create a literal boolean
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralBoolean();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralBoolean) createdValueSpecification)
+ .setValue(Boolean
+ .parseBoolean(((LiteralBooleanRule) value)
+ .getValue()));
+ } else if (value instanceof LiteralIntegerOrUnlimitedNaturalRule) {
+ final LiteralIntegerOrUnlimitedNaturalRule integerValue = (LiteralIntegerOrUnlimitedNaturalRule) value;
+
+ // Always create an integer for the lower value of the multiplicity
+ if(null == integerValue.getUnlimited()){
+ int intValue = integerValue.getValue();
+
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralInteger();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralInteger) createdValueSpecification)
+ .setValue(intValue);
+ }
+ } else if (value instanceof LiteralRealRule) {
+ // Create a literal real
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralReal();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralReal) createdValueSpecification)
+ .setValue(((LiteralRealRule) value).getValue());
+ } else if (value instanceof LiteralNullRule) {
+ // Create a literal null
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralNull();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ } else if (value instanceof LiteralStringRule) {
+ // Create a literal real
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralString();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralString) createdValueSpecification)
+ .setValue(((LiteralStringRule) value).getValue());
+ }
+ }
+
+ return createdValueSpecification;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityUpperValueSetCommand.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityUpperValueSetCommand.java
new file mode 100644
index 00000000000..875ec0b0a7b
--- /dev/null
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/MultiplicityUpperValueSetCommand.java
@@ -0,0 +1,139 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralBooleanRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralIntegerOrUnlimitedNaturalRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralNullRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralRealRule;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.LiteralStringRule;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.LiteralBoolean;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralReal;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * This class allow to define the multiplicity lower ValueSpecification set command which redefine the {@link #createValueSpecification(EObject, EObject, AbstractRule)} for the specific LiteralUnlimitedNatural (or integer if lower than 0) creation when the
+ * user fill an integer.
+ */
+public class MultiplicityUpperValueSetCommand extends AbstractMultiplicityValueSpecificationSetCommand {
+
+ /**
+ * The instance of the class.
+ */
+ private static MultiplicityUpperValueSetCommand instance = new MultiplicityUpperValueSetCommand();
+
+
+ /**
+ * Constructor.
+ */
+ public MultiplicityUpperValueSetCommand() {
+ super();
+ }
+
+ /**
+ * Get the single instance of MultiplicityUpperValueSetCommand.
+ *
+ * @return The single instance of MultiplicityUpperValueSetCommand.
+ */
+ public static MultiplicityUpperValueSetCommand getInstance() {
+ return instance;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils.commands.ValueSpecificationSetCommand#createValueSpecification(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject,
+ * org.eclipse.papyrus.uml.textedit.valuespecification.xtext.umlValueSpecification.AbstractRule)
+ */
+ @Override
+ protected ValueSpecification createValueSpecification(final EObject objectToEdit, final EObject initialValueSpecification, final AbstractRule abstractRule) {
+ ValueSpecification createdValueSpecification = null;
+
+ final EObject value = abstractRule.getValue();
+ if (null != abstractRule.getInstanceSpecification()) {
+ // Create an instance value with specification value
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createInstanceValue();
+ ((InstanceValue) createdValueSpecification)
+ .setInstance(abstractRule.getInstanceSpecification());
+ } else {
+ if (value instanceof LiteralBooleanRule) {
+ // Create a literal boolean
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralBoolean();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralBoolean) createdValueSpecification)
+ .setValue(Boolean
+ .parseBoolean(((LiteralBooleanRule) value)
+ .getValue()));
+ } else if (value instanceof LiteralIntegerOrUnlimitedNaturalRule) {
+ final LiteralIntegerOrUnlimitedNaturalRule integerValue = (LiteralIntegerOrUnlimitedNaturalRule) value;
+
+ try{
+ int intValue = -1;
+
+ if (null == integerValue.getUnlimited()) {
+ intValue = integerValue.getValue();
+ }
+
+ // Always create a LiteralUnlimitedNatural for the upper value of the multiplicity
+ if(-1 <= intValue){
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralUnlimitedNatural();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralUnlimitedNatural) createdValueSpecification)
+ .setValue(intValue);
+ }
+ }catch(final NumberFormatException exception){
+ // Just continue
+ }
+
+ } else if (value instanceof LiteralRealRule) {
+ // Create a literal real
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralReal();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralReal) createdValueSpecification)
+ .setValue(((LiteralRealRule) value).getValue());
+ } else if (value instanceof LiteralNullRule) {
+ // Create a literal null
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralNull();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ } else if (value instanceof LiteralStringRule) {
+ // Create a literal real
+ createdValueSpecification = UMLFactory.eINSTANCE
+ .createLiteralString();
+ copyFeatureValues(createdValueSpecification,
+ initialValueSpecification);
+ ((LiteralString) createdValueSpecification)
+ .setValue(((LiteralStringRule) value).getValue());
+ }
+ }
+
+ return createdValueSpecification;
+ }
+
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java
index c7be4974bf8..2444ffefd28 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.xtext.utils/src/org/eclipse/papyrus/uml/textedit/valuespecification/xtext/utils/commands/ValueSpecificationSetCommand.java
@@ -857,13 +857,13 @@ public class ValueSpecificationSetCommand {
if (initialValueSpecification instanceof LiteralBoolean && xtextValue instanceof LiteralBooleanRule && isTypeNeeeded(objectToEdit, UMLPackage.Literals.LITERAL_BOOLEAN)) {
result = (LiteralBoolean) initialValueSpecification;
} else if (initialValueSpecification instanceof LiteralInteger && xtextValue instanceof LiteralIntegerOrUnlimitedNaturalRule && isTypeNeeeded(objectToEdit, UMLPackage.Literals.LITERAL_INTEGER)) {
- if (null != ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue).getUnlimited()) {
+ if (null == ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue).getUnlimited()) {
result = (LiteralInteger) initialValueSpecification;
}
} else if (initialValueSpecification instanceof LiteralUnlimitedNatural && xtextValue instanceof LiteralIntegerOrUnlimitedNaturalRule && isTypeNeeeded(objectToEdit, UMLPackage.Literals.LITERAL_UNLIMITED_NATURAL)) {
// Check that the value if positive for the unlimited natural type
-
- if (null != ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue).getUnlimited() || 0 <= ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue).getValue()) {
+ final LiteralIntegerOrUnlimitedNaturalRule integerValue = ((LiteralIntegerOrUnlimitedNaturalRule) xtextValue);
+ if (null != integerValue.getUnlimited() || 0 <= integerValue.getValue()) {
result = (LiteralUnlimitedNatural) initialValueSpecification;
}
} else if (initialValueSpecification instanceof LiteralReal && xtextValue instanceof LiteralRealRule && isTypeNeeeded(objectToEdit, UMLPackage.Literals.LITERAL_REAL)) {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtendedMultiplicityObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtendedMultiplicityObservableValue.java
new file mode 100644
index 00000000000..157d79c039a
--- /dev/null
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ExtendedMultiplicityObservableValue.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.tools.databinding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.uml.tools.helper.UMLDatabindingHelper;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * The multiplicity observable values contains a list of 3 observable values : The first the multiplicity lower and upper value for the 'simple' mode and the 2 following are the lower and the upper value observable value.
+ */
+public class ExtendedMultiplicityObservableValue extends AbstractObservableValue {
+
+ /**
+ * The number of ObservableValue in the ObservableList.
+ */
+ private static final int NUMBER_OBSERVABLE_VALUES = 3;
+
+
+ /**
+ * The list of observable values for the multiplicity editors (simple mode, lower and upper values)
+ */
+ private final List<IObservableValue> observableValues;
+
+
+ /**
+ * Constructor.
+ *
+ * @param eObject
+ * The object to edit.
+ * @param domain
+ * The editing domain.
+ */
+ public ExtendedMultiplicityObservableValue(final EObject eObject, final EditingDomain domain) {
+ observableValues = new ArrayList<IObservableValue>(NUMBER_OBSERVABLE_VALUES);
+ observableValues.add(new MultiplicityObservableValue(eObject, domain));
+
+ // Get the lower and upper values features
+ final EStructuralFeature lowerValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue();
+ final EStructuralFeature upperValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue();
+
+ // Add the ObservableValues
+ observableValues.add(UMLDatabindingHelper.getObservableValue(eObject, lowerValueFeature, domain));
+ observableValues.add(UMLDatabindingHelper.getObservableValue(eObject, upperValueFeature, domain));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected Object doGetValue() {
+ return observableValues;
+ }
+
+}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
index 565395e8871..0f704c8a88f 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/MultiplicityObservableValue.java
@@ -1,223 +1,230 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * 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
- * Christian W. Damus (CEA) - 402525
- * Christian W. Damus (CEA) - bug 417409
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.tools.databinding;
-
-import org.eclipse.core.databinding.observable.ChangeEvent;
-import org.eclipse.core.databinding.observable.IChangeListener;
-import org.eclipse.core.databinding.observable.IObservable;
-import org.eclipse.core.databinding.observable.IObserving;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.ValueDiff;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.UnexecutableCommand;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.tools.databinding.AggregatedObservable;
-import org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable;
-import org.eclipse.papyrus.uml.tools.Activator;
-import org.eclipse.papyrus.uml.tools.commands.SetMultiplicityCommand;
-import org.eclipse.papyrus.uml.tools.helper.UMLDatabindingHelper;
-import org.eclipse.papyrus.uml.tools.util.MultiplicityParser;
-import org.eclipse.uml2.uml.MultiplicityElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * An ObservableValue for manipulating the UML Multiplicity property.
- * Multiplicity is a simple, virtual property, aggregating both lowerBound and upperBound,
- * and presenting them as an Enumeration with 4 values : 1, 0-1, 0-*, 1-*
- *
- * The values are edited with commands executed on the given editing domain.
- * These commands will probably only work in a Papyrus context.
- *
- * @author Camille Letavernier
- */
-public class MultiplicityObservableValue extends ReferenceCountedObservable.Value implements IChangeListener, CommandBasedObservableValue, AggregatedObservable, IObserving {
-
- private IObservableValue lowerBound, upperBound, lowerValue, upperValue, lowerValueSpecification, upperValueSpecification;
-
- private EStructuralFeature lowerFeature, upperFeature;
-
- private EObject eObject;
-
- private EditingDomain domain;
-
- /**
- * Constructor.
- *
- * @param eObject
- * The EObject which the multiplicity is being edited
- * @param domain
- * The Editing Domain on which the commands will be executed
- */
- public MultiplicityObservableValue(EObject eObject, EditingDomain domain) {
- this.eObject = eObject;
- this.domain = domain;
-
- lowerFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Lower();
- upperFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Upper();
-
- EStructuralFeature lowerValueFeature, upperValueFeature, lowerValueSpecificationFeature, upperValueSpecificationFeature;
-
- lowerValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue();
- upperValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue();
- lowerValueSpecificationFeature = UMLPackage.eINSTANCE.getLiteralInteger_Value();
- upperValueSpecificationFeature = UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value();
-
- lowerBound = UMLDatabindingHelper.getObservableValue(eObject, lowerFeature, domain);
- upperBound = UMLDatabindingHelper.getObservableValue(eObject, upperFeature, domain);
-
- lowerValue = UMLDatabindingHelper.getObservableValue(eObject, lowerValueFeature, domain);
- upperValue = UMLDatabindingHelper.getObservableValue(eObject, upperValueFeature, domain);
-
- lowerValueSpecification = getValueSpecification(lowerValue, lowerValueSpecificationFeature, domain);
- upperValueSpecification = getValueSpecification(upperValue, upperValueSpecificationFeature, domain);
-
- lowerValue.addChangeListener(this);
- upperValue.addChangeListener(this);
-
- if (lowerValueSpecification != null) {
- lowerValueSpecification.addChangeListener(this);
- }
- if (upperValueSpecification != null) {
- upperValueSpecification.addChangeListener(this);
- }
- }
-
- private IObservableValue getValueSpecification(IObservableValue source, EStructuralFeature specificationFeature, EditingDomain domain) {
- if (source.getValue() == null) {
- return null;
- }
- return UMLDatabindingHelper.getObservableValue((EObject) source.getValue(), specificationFeature, domain);
-
- }
-
- /**
- * @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
- *
- * @param event
- */
- public void handleChange(ChangeEvent event) {
- boolean fireChange = false;
- if (event.getSource() == lowerValue || event.getSource() == upperValue) {
- fireChange = true;
- lowerValueSpecification = getValueSpecification(lowerValue, UMLPackage.eINSTANCE.getLiteralInteger_Value(), domain);
- upperValueSpecification = getValueSpecification(upperValue, UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value(), domain);
- }
-
- if (event.getSource() == lowerValueSpecification || event.getSource() == upperValueSpecification) {
- fireChange = true;
- }
-
- if (fireChange) {
- final Object value = getValue();
- fireValueChange(new ValueDiff() {
-
- @Override
- public Object getOldValue() {
- return null; // Unknown
- }
-
- @Override
- public Object getNewValue() {
- return value;
- }
-
- });
- }
- }
-
- public Object getObserved() {
- return eObject;
- }
-
- @Override
- public synchronized void dispose() {
- lowerValue.removeChangeListener(this);
- upperValue.removeChangeListener(this);
- if (lowerValueSpecification != null) {
- lowerValueSpecification.removeChangeListener(this);
- lowerValueSpecification.dispose();
- }
- if (upperValueSpecification != null) {
- upperValueSpecification.removeChangeListener(this);
- upperValueSpecification.dispose();
- }
-
- lowerValue.dispose();
- upperValue.dispose();
-
- lowerBound.dispose();
- upperBound.dispose();
-
- super.dispose();
- }
-
- public Object getValueType() {
- return String.class;
- }
-
- @Override
- protected String doGetValue() {
- int upper, lower;
- upper = lower = 0;
-
- Object lowerValue = lowerBound.getValue();
- Object upperValue = upperBound.getValue();
- lower = (Integer) lowerValue;
- upper = (Integer) upperValue;
-
- return MultiplicityParser.getMultiplicity(lower, upper);
- }
-
- @Override
- protected void doSetValue(Object value) {
- Command command = getCommand(value);
- domain.getCommandStack().execute(command);
- }
-
- public Command getCommand(Object value) {
- String val = (String) value;
-
- int[] lowerUpper = MultiplicityParser.getBounds(val);
- if (lowerUpper == null || lowerUpper.length < 2) {
- return UnexecutableCommand.INSTANCE; // Invalid multiplicity
- }
-
- int lower = lowerUpper[0], upper = lowerUpper[1];
- if (MultiplicityParser.isValidMultiplicity(lower, upper)) {
- try {
- return new SetMultiplicityCommand((MultiplicityElement) eObject, val);
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-
- return UnexecutableCommand.INSTANCE;
- }
-
- public AggregatedObservable aggregate(IObservable observable) {
- try {
- return new AggregatedPapyrusObservableValue(domain, this, observable);
- } catch (IllegalArgumentException ex) {
- return null; // The observable cannot be aggregated
- }
- }
-
- public boolean hasDifferentValues() {
- return false;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * 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
+ * Christian W. Damus (CEA) - 402525
+ * Christian W. Damus (CEA) - bug 417409
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.tools.databinding;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.tools.databinding.AggregatedObservable;
+import org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable;
+import org.eclipse.papyrus.uml.tools.Activator;
+import org.eclipse.papyrus.uml.tools.commands.SetMultiplicityCommand;
+import org.eclipse.papyrus.uml.tools.helper.UMLDatabindingHelper;
+import org.eclipse.papyrus.uml.tools.util.MultiplicityParser;
+import org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * An ObservableValue for manipulating the UML Multiplicity property.
+ * Multiplicity is a simple, virtual property, aggregating both lowerBound and upperBound,
+ * and presenting them as an Enumeration with 4 values : 1, 0-1, 0-*, 1-*
+ *
+ * The values are edited with commands executed on the given editing domain.
+ * These commands will probably only work in a Papyrus context.
+ *
+ * @author Camille Letavernier
+ */
+public class MultiplicityObservableValue extends ReferenceCountedObservable.Value implements IChangeListener, CommandBasedObservableValue, AggregatedObservable, IObserving {
+
+ private IObservableValue lowerBound, upperBound, lowerValue, upperValue, lowerValueSpecification, upperValueSpecification;
+
+ private EStructuralFeature lowerFeature, upperFeature;
+
+ private EObject eObject;
+
+ private EditingDomain domain;
+
+ /**
+ * Constructor.
+ *
+ * @param eObject
+ * The EObject which the multiplicity is being edited
+ * @param domain
+ * The Editing Domain on which the commands will be executed
+ */
+ public MultiplicityObservableValue(EObject eObject, EditingDomain domain) {
+ this.eObject = eObject;
+ this.domain = domain;
+
+ lowerFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Lower();
+ upperFeature = UMLPackage.eINSTANCE.getMultiplicityElement_Upper();
+
+ EStructuralFeature lowerValueFeature, upperValueFeature, lowerValueSpecificationFeature, upperValueSpecificationFeature;
+
+ lowerValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue();
+ upperValueFeature = UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue();
+ lowerValueSpecificationFeature = UMLPackage.eINSTANCE.getLiteralInteger_Value();
+ upperValueSpecificationFeature = UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value();
+
+ lowerBound = UMLDatabindingHelper.getObservableValue(eObject, lowerFeature, domain);
+ upperBound = UMLDatabindingHelper.getObservableValue(eObject, upperFeature, domain);
+
+ lowerValue = UMLDatabindingHelper.getObservableValue(eObject, lowerValueFeature, domain);
+ upperValue = UMLDatabindingHelper.getObservableValue(eObject, upperValueFeature, domain);
+
+ lowerValueSpecification = getValueSpecification(lowerValue, lowerValueSpecificationFeature, domain);
+ upperValueSpecification = getValueSpecification(upperValue, upperValueSpecificationFeature, domain);
+
+ lowerValue.addChangeListener(this);
+ upperValue.addChangeListener(this);
+
+ if (lowerValueSpecification != null) {
+ lowerValueSpecification.addChangeListener(this);
+ }
+ if (upperValueSpecification != null) {
+ upperValueSpecification.addChangeListener(this);
+ }
+ }
+
+ private IObservableValue getValueSpecification(IObservableValue source, EStructuralFeature specificationFeature, EditingDomain domain) {
+ if (source.getValue() == null) {
+ return null;
+ }
+ return UMLDatabindingHelper.getObservableValue((EObject) source.getValue(), specificationFeature, domain);
+
+ }
+
+ /**
+ * @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
+ *
+ * @param event
+ */
+ public void handleChange(ChangeEvent event) {
+ boolean fireChange = false;
+ if (event.getSource() == lowerValue || event.getSource() == upperValue) {
+ fireChange = true;
+ lowerValueSpecification = getValueSpecification(lowerValue, UMLPackage.eINSTANCE.getLiteralInteger_Value(), domain);
+ upperValueSpecification = getValueSpecification(upperValue, UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value(), domain);
+ }
+
+ if (event.getSource() == lowerValueSpecification || event.getSource() == upperValueSpecification) {
+ fireChange = true;
+ }
+
+ if (fireChange) {
+ final Object value = getValue();
+ fireValueChange(new ValueDiff() {
+
+ @Override
+ public Object getOldValue() {
+ return null; // Unknown
+ }
+
+ @Override
+ public Object getNewValue() {
+ return value;
+ }
+
+ });
+ }
+ }
+
+ public Object getObserved() {
+ return eObject;
+ }
+
+ @Override
+ public synchronized void dispose() {
+ lowerValue.removeChangeListener(this);
+ upperValue.removeChangeListener(this);
+ if (lowerValueSpecification != null) {
+ lowerValueSpecification.removeChangeListener(this);
+ lowerValueSpecification.dispose();
+ }
+ if (upperValueSpecification != null) {
+ upperValueSpecification.removeChangeListener(this);
+ upperValueSpecification.dispose();
+ }
+
+ lowerValue.dispose();
+ upperValue.dispose();
+
+ lowerBound.dispose();
+ upperBound.dispose();
+
+ super.dispose();
+ }
+
+ public Object getValueType() {
+ return String.class;
+ }
+
+ @Override
+ protected String doGetValue() {
+ String result = null;
+ if (eObject instanceof MultiplicityElement) {
+ result = MultiplicityElementUtil.formatMultiplicityNoBrackets((MultiplicityElement) eObject);
+ } else {
+ int upper, lower;
+ upper = lower = 0;
+
+ Object lowerValue = lowerBound.getValue();
+ Object upperValue = upperBound.getValue();
+ lower = (Integer) lowerValue;
+ upper = (Integer) upperValue;
+
+ result = MultiplicityParser.getMultiplicity(lower, upper);
+ }
+ return result;
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ Command command = getCommand(value);
+ domain.getCommandStack().execute(command);
+ }
+
+ public Command getCommand(Object value) {
+ String val = (String) value;
+
+ int[] lowerUpper = MultiplicityParser.getBounds(val);
+ if (lowerUpper == null || lowerUpper.length < 2) {
+ return UnexecutableCommand.INSTANCE; // Invalid multiplicity
+ }
+
+ int lower = lowerUpper[0], upper = lowerUpper[1];
+ if (MultiplicityParser.isValidMultiplicity(lower, upper)) {
+ try {
+ return new SetMultiplicityCommand((MultiplicityElement) eObject, val);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ public AggregatedObservable aggregate(IObservable observable) {
+ try {
+ return new AggregatedPapyrusObservableValue(domain, this, observable);
+ } catch (IllegalArgumentException ex) {
+ return null; // The observable cannot be aggregated
+ }
+ }
+
+ public boolean hasDifferentValues() {
+ return false;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/AllTests.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/AllTests.java
index 1c4b7595518..8745d107654 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/AllTests.java
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/AllTests.java
@@ -18,7 +18,9 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
- ValueSpecificationGrammarTests.class
+ ValueSpecificationGrammarTests.class,
+ MultiplicityLowerValueSpecificationGrammarTests.class,
+ MultiplicityUpperValueSpecificationGrammarTests.class
})
public class AllTests {
// JUnit 4 Test Suite
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityLowerValueSpecificationGrammarTests.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityLowerValueSpecificationGrammarTests.java
new file mode 100644
index 00000000000..128e4fefa5a
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityLowerValueSpecificationGrammarTests.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.textedit.valuespecification.tests.suites;
+
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.textedit.tests.AbstractGrammarTest;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+@PluginResource("/model/xtextValueSpecificationModel.uml")
+public class MultiplicityLowerValueSpecificationGrammarTests extends AbstractGrammarTest<EStructuralFeature> {
+
+ /**
+ * The root model.
+ */
+ protected Model rootModel;
+
+ /**
+ * The tested property.
+ */
+ protected Property testedProperty;
+
+ @Before
+ public void loadTestModel() {
+ rootModel = findElement(Model.class, "model");
+
+ final Class createdClass = (Class) rootModel.createPackagedElement("Class1", UMLPackage.eINSTANCE.getClass_());
+ testedProperty = (Property) createdClass.createOwnedAttribute("Property", null, UMLPackage.eINSTANCE.getProperty());
+ }
+
+ @Test
+ public void testParser() throws Exception {
+
+ // Check literal integer (even if this is superior to 0
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER_VALUE, "#unlimitedNatural=12");
+ Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, testedProperty.getLowerValue().getVisibility());
+ Assert.assertEquals("unlimitedNatural", testedProperty.getLowerValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getLiteralInteger(), testedProperty.getLowerValue().eClass());
+ Assert.assertEquals(12, ((LiteralInteger) testedProperty.getLowerValue()).getValue());
+
+ // Check the update of the LiteralInteger
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER_VALUE, "--8");
+ Assert.assertEquals(VisibilityKind.PRIVATE_LITERAL, testedProperty.getLowerValue().getVisibility());
+ Assert.assertEquals("unlimitedNatural", testedProperty.getLowerValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getLiteralInteger(), testedProperty.getLowerValue().eClass());
+ Assert.assertEquals(-8, ((LiteralInteger) testedProperty.getLowerValue()).getValue());
+
+ // Check literal integer (even if this is superior to 0
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__LOWER_VALUE, "+integer=*");
+ Assert.assertEquals(VisibilityKind.PRIVATE_LITERAL, testedProperty.getLowerValue().getVisibility());
+ Assert.assertEquals("+integer=*", testedProperty.getLowerValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getOpaqueExpression(), testedProperty.getLowerValue().eClass());
+
+ }
+
+ @Override
+ public DefaultXtextDirectEditorConfiguration getEditor() {
+ return new MultiplicityLowerValueSpecificationXtextDirectEditorConfiguration();
+ }
+}
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityUpperValueSpecificationGrammarTests.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityUpperValueSpecificationGrammarTests.java
new file mode 100644
index 00000000000..ca4d35fd837
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.valuespecification.tests/src/org/eclipse/papyrus/uml/textedit/valuespecification/tests/suites/MultiplicityUpperValueSpecificationGrammarTests.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.textedit.valuespecification.tests.suites;
+
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.textedit.tests.AbstractGrammarTest;
+import org.eclipse.papyrus.uml.textedit.valuespecification.xtext.ui.contribution.MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.VisibilityKind;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+@PluginResource("/model/xtextValueSpecificationModel.uml")
+public class MultiplicityUpperValueSpecificationGrammarTests extends AbstractGrammarTest<EStructuralFeature> {
+
+ /**
+ * The root model.
+ */
+ protected Model rootModel;
+
+ /**
+ * The tested property.
+ */
+ protected Property testedProperty;
+
+ @Before
+ public void loadTestModel() {
+ rootModel = findElement(Model.class, "model");
+
+ final Class createdClass = (Class) rootModel.createPackagedElement("Class1", UMLPackage.eINSTANCE.getClass_());
+ testedProperty = (Property) createdClass.createOwnedAttribute("Property", null, UMLPackage.eINSTANCE.getProperty());
+ }
+
+ @Test
+ public void testParser() throws Exception {
+
+ // Check literal integer (even if this is superior to 0
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER_VALUE, "#unlimitedNatural=12");
+ Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, testedProperty.getUpperValue().getVisibility());
+ Assert.assertEquals("unlimitedNatural", testedProperty.getUpperValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getLiteralUnlimitedNatural(), testedProperty.getUpperValue().eClass());
+ Assert.assertEquals(12, ((LiteralUnlimitedNatural) testedProperty.getUpperValue()).getValue());
+
+ // Check the update of the LiteralInteger
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER_VALUE, "*");
+ Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, testedProperty.getUpperValue().getVisibility());
+ Assert.assertEquals("unlimitedNatural", testedProperty.getUpperValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getLiteralUnlimitedNatural(), testedProperty.getUpperValue().eClass());
+ Assert.assertEquals(-1, ((LiteralUnlimitedNatural) testedProperty.getUpperValue()).getValue());
+
+ // Check literal integer (even if this is superior to 0
+ tester.parseText(testedProperty, UMLPackage.Literals.MULTIPLICITY_ELEMENT__UPPER_VALUE, "-integer=-8");
+ Assert.assertEquals(VisibilityKind.PROTECTED_LITERAL, testedProperty.getUpperValue().getVisibility());
+ Assert.assertEquals("-integer=-8", testedProperty.getUpperValue().getName());
+ Assert.assertEquals(UMLPackage.eINSTANCE.getOpaqueExpression(), testedProperty.getUpperValue().eClass());
+
+ }
+
+ @Override
+ public DefaultXtextDirectEditorConfiguration getEditor() {
+ return new MultiplicityUpperValueSpecificationXtextDirectEditorConfiguration();
+ }
+}

Back to the top