Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2018-03-30 07:26:41 -0400
committerAnsgar Radermacher2018-04-16 02:26:04 -0400
commit9bb03d919d334eb3b10ad2bbeeb033412da4f3f5 (patch)
tree7334d801ef755e0be3fee12a223f552db973d5ba
parent224dfa1c661ec52f4b837d272656f69b61b59799 (diff)
downloadorg.eclipse.papyrus-9bb03d919d334eb3b10ad2bbeeb033412da4f3f5.tar.gz
org.eclipse.papyrus-9bb03d919d334eb3b10ad2bbeeb033412da4f3f5.tar.xz
org.eclipse.papyrus-9bb03d919d334eb3b10ad2bbeeb033412da4f3f5.zip
Bug 528199 - [Xtext, Constraints] The edition of constraints does not choose a suitable editor
- Cleanup implementation in DirectEditorsUtil: * Assure that method implementations are consistent and based on each other (before, implementations were duplicated, some respected priorities while others did not), fix comments * Rename getDirectEditorConfiguration (name was misleading, keep old method as deprecated) - Set version of oep.extensionpoints.editors plugin to 3.0.0, adapt all references (other MANIFEST files) accordingly - If no editor with for a given language is found, search all editors without taking language tag into account (implementations must still be compatible with semantic element). This assures that other editors are used, if the default editor is not compatible (e.g. OCL is default editor for opaque expression, but not compatible with non-OCL bodies) - Add an EmbeddedEditor.usecases txt file in plugin oep.extensionpoints.editors - Replace calls to old methods (in diagram.common, property.sheet, uml.diagram.sequence, diagram.stereotype.edition, service.types.ui and natable.xtext.valuespecification/integration) - Move OCL editor registration from generic plugin oep.uml.properties.xtext to OCL plugin. - Add a test to the existing oep.uml.textedit.tests plugin that checks whether a suitable editor is opened on an opaque expression with (1) a C++ body and (2) OCL body (the plugin registers a dummy C++ editor) Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr> Change-Id: I4cee823b91e13f9601ecb7a9655409a74e3d7579
-rw-r--r--examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/EmbedddedEditor.usecases53
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java5
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java260
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/BorderItemNameEditPart.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java4
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypePropertyEditPart.java10
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractXtextCellEditor.java6
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/celleditor/ValueSpecificationCellEditor.java28
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types.ui/src/org/eclipse/papyrus/uml/service/types/internal/ui/commands/InformationFlowCreateCommand.java2
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml7
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java2
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java5
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.javaconstraint/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF2
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF2
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF6
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/build.properties4
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/plugin.xml20
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.di2
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.notation70
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.uml23
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/ConstraintWithCppPopupEditorConfiguration.java48
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/CppDirectEditorConstraint.java82
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/UseRightEditorTest.java97
47 files changed, 563 insertions, 279 deletions
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
index 6fec2b5ee77..7d2ee11faa3 100644
--- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
+++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/META-INF/MANIFEST.MF
@@ -33,7 +33,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)",
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/EmbedddedEditor.usecases b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/EmbedddedEditor.usecases
new file mode 100644
index 00000000000..26cea759b66
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/EmbedddedEditor.usecases
@@ -0,0 +1,53 @@
+Embedded editor use cases
+
+It is sometimes more efficient to use a textual editor to modify a model element, For instance,
+an operation with parameter definitions has a compact textual representation, but it is
+quite time consuming to create all parameters and provide a type when manipulating it on
+the model level. Other elements have an inherent textual representation, notably opaque expressions
+and behaviors. Therefore, Papyrus offers textual editors for these elements.
+
+Use case 1:
+Edit an OCL expression in an opaque expression.
+This can be done by pressing "F2" after selecting either the constraint owning the expression
+or the expression itself. The editor should support completion and syntax highlighting
+to enable the efficient specification.
+Note that the user wants to open an OCL editor on an existing
+expression with OCL content, even if a different editor has been configured as default
+editor for constraints/expressions. Of course, the default editor is chosen on an empty
+opaque expression.
+
+Use case 2:
+The user edits an attribute declaration with a textual editor. The editor allows to set
+name, type, multiplicities and uniqueness. Compared to the first use case, the textual
+representation is a combination of several model elements. The modification might result
+in a non-valid representation, i.e. a text that cannot be represented in the model, for
+instance an unknown type or a non-parseable multiplicity specification. Since this might
+be caused by a single typo, the edited content of an invalid text should not get lost,
+when the user quits the editor. Papyrus manages this situation with a specific stereotype
+storing the text (automatically managed by the editor). Once the specification is corrected
+in the editor, this additional text storage gets removed automatically.
+
+Requirements
+
+* A UML object of a certain kind (i.e. instance of a meta-model element, such
+ as State or Class) has an associated default edtior. This is configurable
+ in the Papyrus preferences ("Embedded Editors"). Technically, the editor
+ is identified using its name as "language".
+
+* Each editor can have additional constraints denoting whether it is eligible
+ to edit a certain element. For instance, it can check whether a certain stereotype
+ is applied. Another typical use case is to check whether opaque expressions
+ or opaque behaviors are either empty or have a body with the "right" language
+ tag.
+
+* Each editor has a priority that is configurable in the Papyrus preferences
+ ("Embedded Editors"). Five different levels are supported:
+ lowest, low, medium, high, highest
+
+* If the user opens a textual editor for a certain UML element, the tool should
+ check first, whether the default is applicable (check eligibility constraints)
+ to the given element. If this is the case, this editor should be opened. If
+ not, it should check whether other editors are eligible and choose the one with
+ the highest priority. If multiple editors with the same priority exist, the
+ first eligitible editor is chosen. This situation should be avoided by
+ choosing the priorities in a suitable way.
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
index 7cb4b98db80..0c5e07c085a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/META-INF/MANIFEST.MF
@@ -12,7 +12,7 @@ Export-Package: org.eclipse.papyrus.extensionpoints.editors,
org.eclipse.papyrus.extensionpoints.editors.utils
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.papyrus.extensionpoints.editors.Activator
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
index f1abafdf698..ee9f67d6511 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.extensionpoints.editors</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
index a2dd99eafec..85935077a3c 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/definition/DirectEditorExtensionPoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2018 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
@@ -8,6 +8,7 @@
* Contributors:
* CEA LIST - initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
*
*******************************************************************************/
package org.eclipse.papyrus.extensionpoints.editors.definition;
@@ -125,11 +126,11 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
* @param class_
* the type of element to edit
* @return the preferred editor configuration for the specified type or <code>null</code>
- * @deprecated Use {@link DirectEditorsUtil#getDefautDirectEditorConfiguration(Object, Object)} instead
+ * @deprecated Use {@link DirectEditorsUtil#getDefaultDirectEditorExtension(Object, Object)} instead
*/
@Deprecated
public DirectEditorExtensionPoint getDefautDirectEditorConfiguration(EObject semanticObjectToEdit, Object selectedObject) {
- return (DirectEditorExtensionPoint) DirectEditorsUtil.getDefautDirectEditorConfiguration(semanticObjectToEdit, selectedObject);
+ return (DirectEditorExtensionPoint) DirectEditorsUtil.getDefaultDirectEditorExtension(semanticObjectToEdit, selectedObject);
}
@@ -141,11 +142,11 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
* type of element to be edited
* @return the set of transformations registered in the platform for the specified kind of
* element
- * @deprecated Use {@link DirectEditorsUtil#getDirectEditorConfigurations(Object, Object)} instead
+ * @deprecated Use {@link DirectEditorsUtil#getDirectEditorExtensions(Object, Object)} instead
*/
@Deprecated
public Collection<DirectEditorExtensionPoint> getDirectEditorConfigurations(EObject semanticObjectToEdit, Object selectedObject) {
- Collection<IDirectEditorExtensionPoint> directEditorConfigurations = DirectEditorsUtil.getDirectEditorConfigurations(semanticObjectToEdit, selectedObject);
+ Collection<IDirectEditorExtensionPoint> directEditorConfigurations = DirectEditorsUtil.getDirectEditorExtensions(semanticObjectToEdit, selectedObject);
List<DirectEditorExtensionPoint> returnList = new ArrayList<DirectEditorExtensionPoint>();
for (IDirectEditorExtensionPoint extension : directEditorConfigurations) {
@@ -520,5 +521,4 @@ public class DirectEditorExtensionPoint implements IDirectEditorExtensionPoint {
public boolean isSuperType() {
return superType;
}
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
index 4c35398fe41..56306f8cc33 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditorsContributionItem.java
@@ -105,7 +105,7 @@ public class DirectEditorsContributionItem extends ContributionItem implements I
}
// retrieves all editor configurations for this kind of element
- final Collection<IDirectEditorExtensionPoint> configurations = DirectEditorsUtil.getDirectEditorConfigurations(businessObject, selectedElement);
+ final Collection<IDirectEditorExtensionPoint> configurations = DirectEditorsUtil.getDirectEditorExtensions(businessObject, selectedElement);
// if configurations is not empty, a submenu should open to select which
// editor to use...
@@ -132,7 +132,7 @@ public class DirectEditorsContributionItem extends ContributionItem implements I
// items on the submenu
// there are as many items as configurations
- final IDirectEditorExtensionPoint defaultConfig = DirectEditorsUtil.getDefautDirectEditorConfiguration(businessObject, selectedElement);
+ final IDirectEditorExtensionPoint defaultConfig = DirectEditorsUtil.getDefaultDirectEditorExtension(businessObject, selectedElement);
for (final IDirectEditorExtensionPoint configuration : configurations) {
MenuItem item = new MenuItem(subMenu, SWT.NONE);
@@ -306,5 +306,4 @@ public class DirectEditorsContributionItem extends ContributionItem implements I
assert (serviceLocator != null);
this.serviceLocator = serviceLocator;
}
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
index 9a3c4005037..5f43cd5f5aa 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 528199
*
*****************************************************************************/
@@ -32,32 +33,21 @@ public class DirectEditorsUtil {
private static final int UNKNOWN_PRIORITY = 100;
/**
- * Finds a editor for specific language and object to edit type
+ * Find an editor configuration for specific language and object to edit
*
* @param language
* the language to edit
- * @param objectToEdit
- * the type of object to edit
- * @return the extension point proxy that manages this kind of editor
- *
- * @deprecated Use {@link #findEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @return the editor configuration
+ * @since 3.0
*/
- @Deprecated
- public static IDirectEditorConfiguration findEditorConfiguration(String language, String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- return directEditorExtensionPoint.getDirectEditorConfiguration();
- }
- }
- return new DefaultDirectEditorConfiguration();
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, EObject objectToEdit) {
+ return findEditorConfiguration(language, objectToEdit, objectToEdit);
}
/**
- * Finds a editor for specific language and object to edit type
+ * Find an editor configuration for specific language and object to edit
*
* @param language
* the language to edit
@@ -65,50 +55,48 @@ public class DirectEditorsUtil {
* the semantic object to edit
* @param selectedElement
* The real selected element (e.g. widget, edit part, ...)
- * @return the extension point proxy that manages this kind of editor
+ * @return the editor configuration
*/
public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- IDirectEditorConfiguration editorConfiguration = new DefaultDirectEditorConfiguration();
- int configurationPriority = UNKNOWN_PRIORITY;
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if ((constraint == null || constraint.appliesTo(selectedElement)) && directEditorExtensionPoint.getPriority() < configurationPriority) {
- // extension point found!
- editorConfiguration = directEditorExtensionPoint.getDirectEditorConfiguration();
- configurationPriority = directEditorExtensionPoint.getPriority();
- }
- }
+ IDirectEditorExtensionPoint extension = findEditorExtension(language, semanticObjectToEdit, selectedElement);
+ if (extension != null) {
+ return extension.getDirectEditorConfiguration();
}
- return editorConfiguration;
+ // none found, return default
+ return new DefaultDirectEditorConfiguration();
}
/**
- * finds if an editor for specific language and object is available to edit type
- *
+ * Find an editor extension for a specific language and object to edit
+ *
* @param language
- * the language to edit
- * @param objectToEdit
- * the object to edit
- * @return <code>true</code> if an editor exists
- *
- * @deprecated Use {@link #hasSpecificEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ * the language to edit, if null accept all languages
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return the extension point that manages this kind of editor
+ * @since 3.0
*/
- @Deprecated
- public static boolean hasSpecificEditorConfiguration(String language, String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- return true;
+ public static IDirectEditorExtensionPoint findEditorExtension(String language, Object semanticObjectToEdit, Object selectedElement) {
+ Collection<IDirectEditorExtensionPoint> configs = getDirectEditorExtensions(semanticObjectToEdit, selectedElement);
+
+ IDirectEditorExtensionPoint currentExtension = null;
+ int currentPriority = UNKNOWN_PRIORITY;
+ for (IDirectEditorExtensionPoint extensionPoint : configs) {
+ if ((language == null || language.equals(extensionPoint.getLanguage())) && extensionPoint.getPriority() < currentPriority) {
+ currentExtension = extensionPoint;
+ currentPriority = extensionPoint.getPriority();
}
}
- return false;
+
+ if (currentExtension == null && language != null) {
+ // no extension found, retry without specific language filter. This is useful, since the default editor
+ // might not match, e.g. if you edit an opaque expression with a non-OCL body, the OCL editor should not
+ // be used, see bug 528199
+ return findEditorExtension(null, semanticObjectToEdit, selectedElement);
+ }
+ return currentExtension;
}
/**
@@ -123,47 +111,22 @@ public class DirectEditorsUtil {
* @return <code>true</code> if an editor exists
*/
public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedElement)) {
- // extension point found!
- return true;
- }
- }
- }
- return false;
+ return findEditorExtension(language, semanticObjectToEdit, selectedElement) != null;
}
/**
- * finds if an editor for specific object is available to edit type
- *
- * @param language
- * the language to edit
+ * finds whether an editor for specific object is available to edit
+ *
* @param objectToEdit
- * the type of object to edit
* @return <code>true</code> if an editor exists
- *
- * @deprecated Use {@link #hasSpecificEditorConfiguration(EObject)} instead
+ * @since 3.0
*/
- @Deprecated
- public static boolean hasSpecificEditorConfiguration(String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (oToEdit.equals(objectToEdit)) {
- // extension point found!
- return true;
- }
- }
- return false;
+ public static boolean hasSpecificEditorConfiguration(EObject objectToEdit) {
+ return hasSpecificEditorConfiguration(objectToEdit, objectToEdit);
}
/**
- * finds if an editor for specific object is available to edit type
+ * finds whether an editor for a specific object is available to edit
*
* @param language
* the language to edit
@@ -174,122 +137,65 @@ public class DirectEditorsUtil {
* @return <code>true</code> if an editor exists
*/
public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedElement)) {
- // extension point found!
- return true;
- }
- }
- }
- return false;
+ return getDirectEditorExtensions(semanticObjectToEdit, selectedElement).size() > 0;
}
/**
- * Retrieves the preferred editor configuration for the specified type
+ * Retrieves the preferred editor extension for the specified type
*
* @param class_
* the type of element to edit
- * @return the preferred editor configuration for the specified type or <code>null</code>
+ * @return the preferred editor extension for the specified or <code>null</code>
+ * @since 3.0
*/
- public static IDirectEditorExtensionPoint getDefautDirectEditorConfiguration(Object semanticObjectToEdit, Object selectedObject) {
+ public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit) {
+ return getDefaultDirectEditorExtension(semanticObjectToEdit, semanticObjectToEdit);
+ }
+
+ /**
+ * Retrieves the preferred editor extension for the specified type
+ *
+ * @param semanticObjectToEdit
+ * the object that should be edited
+ * @param selectedObject
+ * the currently selected object
+ * @return the default editor extension for the passed elements or <code>null</code>
+ * @since 3.0
+ */
+ public static IDirectEditorExtensionPoint getDefaultDirectEditorExtension(Object semanticObjectToEdit, Object selectedObject) {
// retrieves preference for this element
String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
- if (language == null || IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
+ if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
return null;
}
- IDirectEditorExtensionPoint currentConfiguration = null;
- int currentPriority = UNKNOWN_PRIORITY;
- Collection<IDirectEditorExtensionPoint> configs = getDirectEditorConfigurations(semanticObjectToEdit, selectedObject);
-
- for (IDirectEditorExtensionPoint extensionPoint : configs) {
- if (language.equals(extensionPoint.getLanguage()) && extensionPoint.getPriority() < currentPriority) {
- currentConfiguration = extensionPoint;
- currentPriority = extensionPoint.getPriority();
- }
- }
-
- return currentConfiguration;
+ return findEditorExtension(language, semanticObjectToEdit, selectedObject);
}
/**
- * Returns the set of transformations registered in the platform for the specified kind of
- * element
+ * Return the set of editor extensions registered in the platform for the specified kind of element
*
- * @param the
- * type of element to be edited
- * @return the set of transformations registered in the platform for the specified kind of
- * element
+ * @param semanticObjectToEdit
+ * the object that should be edited
+ * @param selectedObject
+ * the currently selected object
+ * @return the set of editor extension registered in the platform for the specified elements
+ * @since 3.0
*/
- public static Collection<IDirectEditorExtensionPoint> getDirectEditorConfigurations(Object semanticObjectToEdit, Object selectedObject) {
- // list of configuration to be returned. They correspond to
- // configuration to edit the
- // specified type
- final List<IDirectEditorExtensionPoint> elementConfigurations = new ArrayList<IDirectEditorExtensionPoint>();
+ public static Collection<IDirectEditorExtensionPoint> getDirectEditorExtensions(Object semanticObjectToEdit, Object selectedObject) {
+ // list of extension points to be returned.
+ final List<IDirectEditorExtensionPoint> editorExtensionPoints = new ArrayList<IDirectEditorExtensionPoint>();
- // check each configuration in the platform and select corresponding
- // ones.
+ // check each configuration and select those satisfying the constraints
for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
// both class are compatibles ?
if (configuration.getObjectClassToEdit() != null) {
if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
if (constraint == null || constraint.appliesTo(selectedObject))
- elementConfigurations.add(configuration);
- }
- }
- }
- return elementConfigurations;
- }
-
- /**
- * Finds a editor for specific language and object to edit type with the higher priority.
- *
- * @param language
- * the language to edit
- * @param objectToEdit
- * the type of object to edit
- * @return the extension point proxy that manages this kind of editor
- */
- public static IDirectEditorConfiguration findEditorConfigurationWithPriority(String language, String objectToEdit) {
- IDirectEditorConfiguration result = null;
- int currentPrority = UNKNOWN_PRIORITY;
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- int directEditorExtensionPointPriority = directEditorExtensionPoint.getPriority() != null ? directEditorExtensionPoint.getPriority() : UNKNOWN_PRIORITY;
- if (result == null || (directEditorExtensionPointPriority < currentPrority)) {
- result = directEditorExtensionPoint.getDirectEditorConfiguration();
- currentPrority = directEditorExtensionPointPriority;
+ editorExtensionPoints.add(configuration);
}
}
}
- return result != null ? result : new DefaultDirectEditorConfiguration();
+ return editorExtensionPoints;
}
-
- /**
- * returns the list of languages that are available from extension points
- *
- * @return the list of languages that have an extended editor
- */
- public static List<String> getLanguages(String objectToEdit) {
- List<String> languages = new ArrayList<String>();
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- if (objectToEdit == null || directEditorExtensionPoint.getObjectToEdit().equals(objectToEdit)) {
- String lang = directEditorExtensionPoint.getLanguage();
- if (!languages.contains(lang)) {
- languages.add(lang);
- }
- }
- }
- return languages;
- }
-
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
index 07d83fe7dd0..29174d98032 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
@@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable.model;bundle-version="[4.0.0,
org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[4.0.0,5.0.0)"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
index 044c1d2bc36..5cc9c890bd6 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF
@@ -83,7 +83,7 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
index ed2d0f0fb02..f5dbb6900e5 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
@@ -73,7 +73,7 @@ Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3
org.eclipse.uml2.uml.edit;visibility:=reexport;bundle-version="[5.3.0,6.0.0)",
org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
index e1a4c206ec3..4131800e1c1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
@@ -52,7 +52,7 @@ Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="[1.7.0,2.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.diagram.wizards;bundle-version="[3.0.0,4.0.0)",
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/BorderItemNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/BorderItemNameEditPart.java
index 7d49b6b3d91..40b2b28204b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/BorderItemNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/BorderItemNameEditPart.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2015 CEA LIST.
+ * Copyright (c) 2015, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -47,7 +47,6 @@ import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.ICellEditorValidator;
@@ -68,6 +67,8 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
@@ -76,7 +77,6 @@ import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigu
import org.eclipse.papyrus.uml.diagram.common.locator.MultilineCellEditorLocator;
import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.BusyIndicator;
@@ -562,7 +562,7 @@ public class BorderItemNameEditPart extends FloatingLabelEditPart implements ITe
*/
protected boolean checkExtendedEditor() {
if(resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement());
}
return false;
}
@@ -585,9 +585,9 @@ public class BorderItemNameEditPart extends FloatingLabelEditPart implements ITe
if(configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
@@ -599,7 +599,7 @@ public class BorderItemNameEditPart extends FloatingLabelEditPart implements ITe
protected void updateExtendedEditorConfiguration() {
String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if(languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java
index c0f5da1403f..e748c005752 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/DirectEditNodeEditPart.java
@@ -143,9 +143,9 @@ public class DirectEditNodeEditPart {
if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
} else if (configuration == null) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, id);
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, gep.resolveSemanticElement());
} else if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { //$NON-NLS-1$
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, id);
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, gep.resolveSemanticElement());
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java
index 174b4790ed3..bba72ed2887 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java
@@ -564,7 +564,7 @@ public class EditableLabelForNodeEditPart extends PapyrusCompartmentEditPart imp
*/
protected boolean checkExtendedEditor() {
if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement());
}
return false;
}
@@ -586,9 +586,9 @@ public class EditableLabelForNodeEditPart extends PapyrusCompartmentEditPart imp
if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
@@ -601,8 +601,7 @@ public class EditableLabelForNodeEditPart extends PapyrusCompartmentEditPart imp
String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java
index de656f469f7..3c211c0e02b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ExtendedDirectEditPolicy.java
@@ -178,7 +178,7 @@ public class ExtendedDirectEditPolicy extends LabelDirectEditPolicy {
*/
protected boolean checkExtendedEditor() {
if (getUMLElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, getUMLElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, getUMLElement());
}
return false;
}
@@ -197,7 +197,7 @@ public class ExtendedDirectEditPolicy extends LabelDirectEditPolicy {
*/
protected void initExtendedEditorConfiguration() {
if (configuration == null) {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, getUMLElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, getUMLElement());
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF
index a8723440e91..5ecfc89f2e9 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF
@@ -68,7 +68,7 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-v
org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)",
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.11.0,4.0.0)",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 3.0.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
index 7ef9c34eb27..c3f1014c0e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
@@ -76,7 +76,7 @@ Require-Bundle: org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)
org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
index 71f1f5932fc..e8a2ce8148a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
@@ -73,7 +73,7 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version=
org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
index 457b65bdffe..aa1b7ceee4e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
@@ -60,7 +60,7 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-v
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF
index 3f2b6fa2ee8..cb3d748188a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF
@@ -73,7 +73,7 @@ Require-Bundle: org.eclipse.papyrus.uml.profile;bundle-version="[3.0.0,4.0.0)",
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 3.0.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
index 850f86e0047..47186ee968a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF
@@ -56,7 +56,7 @@ Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3
org.eclipse.uml2.uml.edit;visibility:=reexport;bundle-version="[5.3.0,6.0.0)",
org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.diagram.stereotype.edition,
org.eclipse.papyrus.infra.properties,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java
index 218d8f4fb9a..41d5ddb2179 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java
@@ -542,7 +542,7 @@ public abstract class BorderItemLabelEditPart extends PapyrusLabelEditPart imple
protected boolean checkExtendedEditor() {
if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement());
}
return false;
}
@@ -555,9 +555,9 @@ public abstract class BorderItemLabelEditPart extends PapyrusLabelEditPart imple
if (configuration == null) {
final String languagePreferred = UMLDiagramEditorPlugin.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
@@ -565,7 +565,7 @@ public abstract class BorderItemLabelEditPart extends PapyrusLabelEditPart imple
protected void updateExtendedEditorConfiguration() {
String languagePreferred = UMLDiagramEditorPlugin.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
index 45b1e3dd4f4..8e18a02f49c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
@@ -116,7 +116,6 @@ import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Feature;
import org.eclipse.uml2.uml.InteractionConstraint;
@@ -670,7 +669,7 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
protected boolean checkExtendedEditor() {
if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement());
}
return false;
}
@@ -683,17 +682,17 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
if (configuration == null) {
final String languagePreferred = UMLDiagramEditorPlugin.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = UMLDiagramEditorPlugin.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ String languagePreferred = UMLDiagramEditorPlugin.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement());
if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
index 223cd4888ec..e2a2b05fe1f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF
@@ -69,7 +69,7 @@ Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12
org.eclipse.uml2.uml.edit;visibility:=reexport;bundle-version="[5.3.0,6.0.0)",
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;visibility:=reexport;bundle-version="[3.0.0,4.0.0)"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
index d0a8ed742ad..a301488011f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypeMultilinePropertyEditPart.java
@@ -723,7 +723,7 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
protected boolean checkExtendedEditor() {
EObject resolveSemanticElement = resolveSemanticElement();
if (resolveSemanticElement != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement.eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement);
}
return false;
}
@@ -745,9 +745,9 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + AppliedStereotypeProperty.class.getName());
if (languagePreferred != null && !"".equals(languagePreferred)) { //$NON-NLS-1$
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, AppliedStereotypeProperty.class.getName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, AppliedStereotypeProperty.class.getName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
@@ -759,7 +759,7 @@ public class AppliedStereotypeMultilinePropertyEditPart extends CompartmentEditP
protected void updateExtendedEditorConfiguration() {
String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + AppliedStereotypeProperty.class.getName());
if (languagePreferred != null && !"".equals(languagePreferred) && languagePreferred != configuration.getLanguage()) { //$NON-NLS-1$
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, AppliedStereotypeProperty.class.getName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypePropertyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypePropertyEditPart.java
index 50b06d09848..6124ed697c1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypePropertyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/editpart/AppliedStereotypePropertyEditPart.java
@@ -67,8 +67,8 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.adapter.SemanticAdapter;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
@@ -732,7 +732,7 @@ public class AppliedStereotypePropertyEditPart extends UMLCompartmentEditPart im
*/
protected boolean checkExtendedEditor() {
if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement());
}
return false;
}
@@ -754,9 +754,9 @@ public class AppliedStereotypePropertyEditPart extends UMLCompartmentEditPart im
if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("")) {//$NON-NLS-1$
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement());
}
}
}
@@ -768,7 +768,7 @@ public class AppliedStereotypePropertyEditPart extends UMLCompartmentEditPart im
protected void updateExtendedEditorConfiguration() {
String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {//$NON-NLS-1$
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
index 3a8a859cfa9..6213c40d357 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
@@ -67,7 +67,7 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version=
org.eclipse.emf.validation;visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.tooling.runtime;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
org.eclipse.gef,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractXtextCellEditor.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractXtextCellEditor.java
index 0296470c930..b52818e7413 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractXtextCellEditor.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractXtextCellEditor.java
@@ -75,8 +75,7 @@ public abstract class AbstractXtextCellEditor extends
if (editedEObject != null && editedEObject instanceof EObject) {
IPreferenceStore store = Activator.getDefault()
.getPreferenceStore();
- String semanticClassName = ((EObject) editedEObject).eClass()
- .getInstanceClassName();
+ String semanticClassName = ((EObject) editedEObject).eClass().getInstanceClassName();
String key = IDirectEditorsIds.EDITOR_FOR_ELEMENT
+ semanticClassName;
@@ -84,8 +83,7 @@ public abstract class AbstractXtextCellEditor extends
if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$
IDirectEditorConfiguration configuration = DirectEditorsUtil
- .findEditorConfiguration(languagePreferred,
- semanticClassName);
+ .findEditorConfiguration(languagePreferred, (EObject) editedEObject);
if (configuration instanceof DefaultXtextDirectEditorConfiguration) {
DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) configuration;
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/celleditor/ValueSpecificationCellEditor.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/celleditor/ValueSpecificationCellEditor.java
index d683d442ffb..7a50137519c 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/celleditor/ValueSpecificationCellEditor.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.xtext.valuespecification/src/org/eclipse/papyrus/uml/nattable/xtext/valuespecification/celleditor/ValueSpecificationCellEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST.
+ * Copyright (c) 2015, 2017, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,12 +8,11 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ * Ansgar Radermacher (CEA) ansgar.radermacher@cea.fr - bug 528199
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.xtext.valuespecification.celleditor;
-import java.util.List;
-
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
@@ -93,21 +92,14 @@ public class ValueSpecificationCellEditor extends AbstractXtextCellEditor {
if (row instanceof EObject && column instanceof EStructuralFeature || row instanceof EStructuralFeature && column instanceof EObject) {
final EStructuralFeature feature = (EStructuralFeature) (column instanceof EStructuralFeature ? column : row);
final EObject contextElement = (EObject) (row instanceof EObject ? row : column);
- final String semanticClassName = feature.getEType().getInstanceClassName();
-
- if (contextElement instanceof EObject) {
- // allow to init the extension point and allow to get existing language for the elements
- final List<String> languages = DirectEditorsUtil.getLanguages(semanticClassName);
-
- // if we are here, the default is not a Xtext editor
- for (String currentLanguage : languages) {
- IDirectEditorConfiguration directEditorConfiguration = DirectEditorsUtil.findEditorConfigurationWithPriority(currentLanguage, semanticClassName);
- if (directEditorConfiguration instanceof DefaultXtextDirectEditorConfiguration) {
- DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) directEditorConfiguration;
- xtextConfiguration.preEditAction(((EObject) contextElement)
- .eGet((EStructuralFeature) feature));
- return xtextConfiguration;
- }
+ final Object featureValue = contextElement.eGet(feature);
+
+ if (featureValue instanceof EObject) {
+ IDirectEditorConfiguration directEditorConfiguration = DirectEditorsUtil.findEditorConfiguration(null, (EObject) featureValue);
+ if (directEditorConfiguration instanceof DefaultXtextDirectEditorConfiguration) {
+ DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) directEditorConfiguration;
+ xtextConfiguration.preEditAction(featureValue);
+ return xtextConfiguration;
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/src/org/eclipse/papyrus/uml/service/types/internal/ui/commands/InformationFlowCreateCommand.java b/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/src/org/eclipse/papyrus/uml/service/types/internal/ui/commands/InformationFlowCreateCommand.java
index 45871bdae54..fce08d01580 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/src/org/eclipse/papyrus/uml/service/types/internal/ui/commands/InformationFlowCreateCommand.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/src/org/eclipse/papyrus/uml/service/types/internal/ui/commands/InformationFlowCreateCommand.java
@@ -173,7 +173,7 @@ public class InformationFlowCreateCommand extends CreateElementCommand {
Shell currentShell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
IDirectEditorConfiguration configuration;// = new DefaultDirectEditorConfiguration();
String languagePreferred = org.eclipse.papyrus.uml.service.types.Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + infoItem.eClass().getInstanceClassName());
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, infoItem.eClass().getInstanceClassName());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, infoItem);
configuration.preEditAction(infoItem);
configuration.setInputValidator(new NameLabelValidator(Messages.InformationFlowCreateCommand_2));
ExtendedDirectEditionDialog dialog = new ExtendedDirectEditionDialog(currentShell, infoItem, infoItem.getName(), configuration);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
index 6e3217f75cd..46c904bdbfa 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/plugin.xml
@@ -2,13 +2,6 @@
<?eclipse version="3.4"?>
<plugin>
<extension
- point="org.eclipse.papyrus.uml.properties.languageEditor">
- <editor
- editor="org.eclipse.papyrus.uml.properties.xtext.XtextLanguageEditor"
- language="OCL">
- </editor>
- </extension>
- <extension
point="org.eclipse.papyrus.infra.properties.environments">
<environment
environmentModel="model/environment.xmi">
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
index f95ac1cfca9..cab2d4fc7c1 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/XtextLanguageEditor.java
@@ -234,7 +234,7 @@ public class XtextLanguageEditor implements BodyEditor, IContextElementProvider
String languagePreferred = store.getString(key);
if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$
- IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, semanticClassName);
+ IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, semanticElement);
if (configuration instanceof DefaultXtextDirectEditorConfiguration) {
DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) configuration;
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
index c950de65b6f..ac25384a907 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySection.java
@@ -241,8 +241,7 @@ public class AdvancedEditingPropertySection extends
if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$
IDirectEditorConfiguration configuration = DirectEditorsUtil
- .findEditorConfiguration(languagePreferred,
- semanticClassName);
+ .findEditorConfiguration(languagePreferred, semanticElement);
if (configuration instanceof DefaultXtextDirectEditorConfiguration) {
DefaultXtextDirectEditorConfiguration xtextConfiguration = (DefaultXtextDirectEditorConfiguration) configuration;
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
index f5a7ab295ac..0f8544adc44 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/sheet/AdvancedEditingPropertySectionFilter.java
@@ -42,11 +42,10 @@ public class AdvancedEditingPropertySectionFilter implements IFilter {
if (languagePreferred != null && !languagePreferred.equals("")) {
IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(
- languagePreferred, semanticElement.eClass()
- .getInstanceClassName());
+ languagePreferred, semanticElement);
return configuration instanceof ICustomDirectEditorConfiguration;
}
}
return false;
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
index 3a32aea0f17..32e43d633fc 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.
org.eclipse.papyrus.infra.services.validation;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.service.validation;bundle-version="[2.1.0,3.0.0)",
org.eclipse.ocl.pivot.ui;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.uml.properties.xtext;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.3.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.javaconstraint/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.javaconstraint/META-INF/MANIFEST.MF
index 38e89fcbd8b..41eaebe24bd 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.javaconstraint/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.javaconstraint/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.uml.textedit.javaconstraint
-Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)"
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
index d621c194d59..85ee688e0bb 100644
--- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Export-Package: org.eclipse.papyrus.uml.xtext.integration,
org.eclipse.papyrus.uml.xtext.integration.job
Require-Bundle: org.eclipse.xtext.ui;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.xtext.integration.core;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.service.validation;bundle-version="[2.1.0,3.0.0)",
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
index c054ee7270a..6dacc041c5a 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
@@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.semantic;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.services.navigation;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.emf.facet.util.emf.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
index 624065109d6..4b53d7ab3e1 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/META-INF/MANIFEST.MF
@@ -10,8 +10,10 @@ Require-Bundle: org.eclipse.core.runtime,
org.junit;bundle-version="4.11.0",
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.junit.utils;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)"
-Export-Package: org.eclipse.papyrus.uml.textedit.tests
+ org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)"
+Export-Package: org.eclipse.papyrus.uml.textedit.tests,
+ org.eclipse.papyrus.uml.textedit.tests.editor
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/build.properties b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/build.properties
index 9cbab3c135e..ad68327e79f 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/build.properties
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/build.properties
@@ -2,5 +2,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- about.html
+ about.html,\
+ plugin.xml,\
+ resources/
src.includes = about.html
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/plugin.xml b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/plugin.xml
new file mode 100644
index 00000000000..81df9a8b87f
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
+ <DirectEditor
+ additionalConstraint="org.eclipse.papyrus.uml.textedit.tests.editor.CppDirectEditorConstraint"
+ contributor="CEA LIST"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
+ language="Textual editor for constraint edition with C++"
+ objectToEdit="org.eclipse.uml2.uml.Constraint">
+ <popupeditor
+ editorConfiguration="org.eclipse.papyrus.uml.textedit.tests.editor.ConstraintWithCppPopupEditorConfiguration">
+ </popupeditor>
+ <Priority name="High">
+ </Priority>
+ </DirectEditor>
+ </extension>
+</plugin>
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.di b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.notation b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.notation
new file mode 100644
index 00000000000..3cadfb8ca8f
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.notation
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_WNy24OGBEeevdMKtbxkWdg" type="PapyrusUMLClassDiagram" name="Expresions" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_zfjgwOGBEeevdMKtbxkWdg" type="Comment_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_zfkH0eGBEeevdMKtbxkWdg" type="Comment_BodyLabel"/>
+ <element xmi:type="uml:Comment" href="opaqueExpressionTest.uml#_zfbk8OGBEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_zfkH0OGBEeevdMKtbxkWdg" x="60" y="220" width="361" height="61"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_LtrRoOGCEeevdMKtbxkWdg" type="Constraint_PackagedElementShape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Ltr4sOGCEeevdMKtbxkWdg" type="Constraint_NameLabel"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_Ltr4seGCEeevdMKtbxkWdg" type="Constraint_BodyLabel"/>
+ <element xmi:type="uml:Constraint" href="opaqueExpressionTest.uml#_Ltkj8OGCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_LtrRoeGCEeevdMKtbxkWdg" x="320" y="120" width="181" height="61"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_OxMtAOGCEeevdMKtbxkWdg" type="Class_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_OxNUEOGCEeevdMKtbxkWdg" type="Class_NameLabel"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_OxNUEeGCEeevdMKtbxkWdg" type="Class_FloatingNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_OxNUEuGCEeevdMKtbxkWdg" y="15"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OxN7IOGCEeevdMKtbxkWdg" visible="false" type="Class_AttributeCompartment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OxN7IeGCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OxN7IuGCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OxN7I-GCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OxN7JOGCEeevdMKtbxkWdg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OxN7JeGCEeevdMKtbxkWdg" visible="false" type="Class_OperationCompartment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OxN7JuGCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OxN7J-GCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OxN7KOGCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OxN7KeGCEeevdMKtbxkWdg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_OxN7KuGCEeevdMKtbxkWdg" visible="false" type="Class_NestedClassifierCompartment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_OxN7K-GCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_OxN7LOGCEeevdMKtbxkWdg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_OxN7LeGCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OxN7LuGCEeevdMKtbxkWdg"/>
+ </children>
+ <element xmi:type="uml:Class" href="opaqueExpressionTest.uml#_OxLe4OGCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_OxMtAeGCEeevdMKtbxkWdg" x="40" y="40" width="181" height="141"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_UI-qAOGCEeevdMKtbxkWdg" type="Constraint_PackagedElementShape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_UI_REOGCEeevdMKtbxkWdg" type="Constraint_NameLabel"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_UI_REeGCEeevdMKtbxkWdg" type="Constraint_BodyLabel"/>
+ <element xmi:type="uml:Constraint" href="opaqueExpressionTest.uml#_UI800OGCEeevdMKtbxkWdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_UI-qAeGCEeevdMKtbxkWdg" x="320" y="40" width="181"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_WNy24eGBEeevdMKtbxkWdg" name="diagram_compatibility_version" stringValue="1.3.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_WNy24uGBEeevdMKtbxkWdg"/>
+ <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_WNy24-GBEeevdMKtbxkWdg" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+ <owner xmi:type="uml:Model" href="opaqueExpressionTest.uml#_LrjAIOGBEeevdMKtbxkWdg"/>
+ </styles>
+ <element xmi:type="uml:Model" href="opaqueExpressionTest.uml#_LrjAIOGBEeevdMKtbxkWdg"/>
+ <edges xmi:type="notation:Connector" xmi:id="_U2fQQOGCEeevdMKtbxkWdg" type="Constraint_ContextEdge" source="_UI-qAOGCEeevdMKtbxkWdg" target="_OxMtAOGCEeevdMKtbxkWdg">
+ <children xmi:type="notation:DecorationNode" xmi:id="_U2f3UOGCEeevdMKtbxkWdg" type="Constraint_KeywordLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_q3gQYOGCEeevdMKtbxkWdg" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_U2f3UeGCEeevdMKtbxkWdg" x="10" y="13"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_U2fQQeGCEeevdMKtbxkWdg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_U2fQQuGCEeevdMKtbxkWdg" points="[240, 254, -643984, -643984]$[440, 200, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_U3J-oOGCEeevdMKtbxkWdg" id="(0.0,0.6666666666666666)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_U3J-oeGCEeevdMKtbxkWdg" id="(1.0,0.28368794326241137)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_5ObSoOGCEeevdMKtbxkWdg" type="Constraint_ConstrainedElementEdge" source="_LtrRoOGCEeevdMKtbxkWdg" target="_OxMtAOGCEeevdMKtbxkWdg">
+ <styles xmi:type="notation:FontStyle" xmi:id="_5ObSoeGCEeevdMKtbxkWdg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_5ObSouGCEeevdMKtbxkWdg" points="[120, 180, -643984, -643984]$[120, 121, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5OzGEOGCEeevdMKtbxkWdg" id="(0.0,0.6557377049180327)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_5OzGEeGCEeevdMKtbxkWdg" id="(1.0,0.851063829787234)"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.uml b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.uml
new file mode 100644
index 00000000000..984e91e6578
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/resources/opaqueExpressionTest.uml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_LrjAIOGBEeevdMKtbxkWdg" name="opaqueExpressionTest">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_zfbk8OGBEeevdMKtbxkWdg">
+ <body>Two opaque expressions. Test will check that the OCL editor is chosen for the first one, whereas a dummy C++ editor is chosen for the 2nd</body>
+ </ownedComment>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_QfJ5EOGBEeevdMKtbxkWdg">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_OxLe4OGCEeevdMKtbxkWdg" name="Class1">
+ <ownedRule xmi:type="uml:Constraint" xmi:id="_Ltkj8OGCEeevdMKtbxkWdg" name="ConstraintOCL" constrainedElement="_OxLe4OGCEeevdMKtbxkWdg">
+ <specification xmi:type="uml:OpaqueExpression" xmi:id="_T4AEMOGBEeevdMKtbxkWdg" name="OE_OCL">
+ <language>OCL</language>
+ <body>self.name = 'Class1'</body>
+ </specification>
+ </ownedRule>
+ <ownedRule xmi:type="uml:Constraint" xmi:id="_UI800OGCEeevdMKtbxkWdg" name="ConstraintCPP" constrainedElement="_OxLe4OGCEeevdMKtbxkWdg">
+ <specification xmi:type="uml:OpaqueExpression" xmi:id="_UI9b4OGCEeevdMKtbxkWdg" name="OE_Cpp">
+ <language>C++</language>
+ <body>a == 4;</body>
+ </specification>
+ </ownedRule>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/ConstraintWithCppPopupEditorConfiguration.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/ConstraintWithCppPopupEditorConfiguration.java
new file mode 100644
index 00000000000..bf32002e417
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/ConstraintWithCppPopupEditorConfiguration.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.tests.editor;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
+
+import com.google.inject.Injector;
+
+/**
+ * A dummy C++ editor contribution that will not work. This is intentional: test focus is to
+ * check whether right editor (contribution) is chosen
+ */
+public class ConstraintWithCppPopupEditorConfiguration extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
+
+ public ConstraintWithCppPopupEditorConfiguration() {
+ super();
+ }
+
+ @Override
+ public String getTextToEdit(Object editedObject) {
+ return "dummy"; //$NON-NLS-1$
+ }
+
+ @Override
+ public Injector getInjector() {
+ return null;
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ return null;
+ }
+}
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/CppDirectEditorConstraint.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/CppDirectEditorConstraint.java
new file mode 100644
index 00000000000..3b46e6ca376
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/CppDirectEditorConstraint.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.tests.editor;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * Assure that a C++ editor is used, if the constraint contains an opaque expression with "C++" as language
+ */
+public class CppDirectEditorConstraint implements IDirectEditorConstraint {
+
+ private static final String CPP_LANGUAGE_CONSTRAINT = "C++ Language Constraint"; //$NON-NLS-1$
+
+ private static final String CPP_LANGUAGE_BODY = "C++"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ */
+ public CppDirectEditorConstraint() {
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#getLabel()
+ *
+ * @return
+ */
+ public String getLabel() {
+ return CPP_LANGUAGE_CONSTRAINT;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint#appliesTo(java.lang.Object)
+ *
+ * @param selection
+ * @return
+ */
+ public boolean appliesTo(Object selection) {
+ boolean appliedConstraint = false;
+ EObject resolvedEObject = EMFHelper.getEObject(selection);
+ if (resolvedEObject instanceof Constraint) {
+ Constraint selectedConstraint = (Constraint) resolvedEObject;
+ appliedConstraint = checkValueSpecification(selectedConstraint.getSpecification());
+ }
+ else if (resolvedEObject instanceof ValueSpecification) {
+ appliedConstraint = checkValueSpecification((ValueSpecification) resolvedEObject);
+ }
+ return appliedConstraint;
+ }
+
+ /**
+ * check whether a value specification complies with C++ editor
+ * @param specification
+ * @return true, if either opaque-expression (empty or C++ as language) or a literal string
+ */
+ public boolean checkValueSpecification(ValueSpecification specification) {
+ if (specification instanceof OpaqueExpression) {
+ return ((OpaqueExpression) specification).getBodies().isEmpty() || ((OpaqueExpression) specification).getLanguages().contains(CPP_LANGUAGE_BODY);
+ }
+ else {
+ return specification instanceof LiteralString;
+ }
+ }
+}
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/UseRightEditorTest.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/UseRightEditorTest.java
new file mode 100644
index 00000000000..be04d7cd32d
--- /dev/null
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.tests/src/org/eclipse/papyrus/uml/textedit/tests/editor/UseRightEditorTest.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.textedit.tests.editor;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * The whether the "right" editor is used when opening an editor on a selected element
+ */
+@SuppressWarnings("nls")
+@PluginResource("resources/opaqueExpressionTest.di")
+public class UseRightEditorTest {
+
+ @Rule
+ /** The model set fixture. */
+ public final PapyrusEditorFixture modelSetFixture = new PapyrusEditorFixture();
+
+ public static final String CLASS1 = "Class1";
+
+ public static final String CONSTRAINT_OCL = "ConstraintOCL";
+
+ public static final String CONSTRAINT_CPP = "ConstraintCPP";
+
+ @Test
+ public void noMetaclassAndNoContextTest() {
+ Package model = modelSetFixture.getModel();
+ assertThat("RootElement must exist", model != null);
+
+ Class class1 = (Class) model.getPackagedElement(CLASS1);
+ assertThat(String.format("Model must contain a class named %s", CLASS1), class1 != null);
+
+ Constraint constraintOCL = class1.getOwnedRule(CONSTRAINT_OCL);
+ assertThat(String.format("%s must contain a constraint called %s", CLASS1, CONSTRAINT_OCL), constraintOCL != null);
+
+ Constraint constraintCPP = class1.getOwnedRule(CONSTRAINT_CPP);
+ assertThat(String.format("%s must contain a constraint called %s", CLASS1, CONSTRAINT_CPP), constraintCPP != null);
+
+ IDirectEditorExtensionPoint oclExtension =
+ DirectEditorsUtil.getDefaultDirectEditorExtension(constraintOCL);
+
+ assertThat(String.format("editor extension for %s must be non null", CONSTRAINT_OCL), oclExtension != null);
+ assertThat(String.format("configuration for %s must be non null", CONSTRAINT_OCL), oclExtension.getDirectEditorConfiguration() != null);
+ assertThat(String.format("language for constraint %s must be OCL", CONSTRAINT_OCL), oclExtension.getDirectEditorConfiguration().getLanguage().equals("Essential OCL constraint editor"));
+
+ IDirectEditorExtensionPoint cppExtension =
+ DirectEditorsUtil.getDefaultDirectEditorExtension(constraintCPP);
+
+ assertThat(String.format("editor extension for %s must be non null", CONSTRAINT_CPP), cppExtension != null);
+ assertThat(String.format("configuration for %s must be non null", CONSTRAINT_CPP), cppExtension.getDirectEditorConfiguration() != null);
+ assertThat(String.format("language for constraint %s must be CPP", CONSTRAINT_CPP), cppExtension.getDirectEditorConfiguration().getLanguage().equals("Textual editor for constraint edition with C++"));
+
+ // obtain constraint specification (opaque expression)
+ ValueSpecification specificationOCL = constraintOCL.getSpecification();
+ assertThat(String.format("specification of constraint %s must be an opaque expression", CONSTRAINT_OCL), specificationOCL instanceof OpaqueExpression);
+ IDirectEditorExtensionPoint oclExtensionOE =
+ DirectEditorsUtil.getDefaultDirectEditorExtension(specificationOCL);
+
+ // same tests as above, but for opaque expression
+ assertThat(String.format("editor extension for %s must be non null", CONSTRAINT_OCL), oclExtensionOE != null);
+ assertThat(String.format("configuration for %s must be non null", CONSTRAINT_OCL), oclExtensionOE.getDirectEditorConfiguration() != null);
+ assertThat(String.format("language for constraint %s must be OCL", CONSTRAINT_OCL), oclExtensionOE.getDirectEditorConfiguration().getLanguage().equals("Essential OCL constraint editor"));
+
+ ValueSpecification specificationCPP = constraintCPP.getSpecification();
+ assertThat(String.format("specification of constraint %s must be an opaque expression", CONSTRAINT_CPP), specificationCPP instanceof OpaqueExpression);
+
+ IDirectEditorExtensionPoint cppExtensionOE =
+ DirectEditorsUtil.getDefaultDirectEditorExtension(specificationCPP);
+
+ assertThat(String.format("editor extension for %s must be non null", CONSTRAINT_CPP), cppExtensionOE != null);
+ assertThat(String.format("configuration for %s must be non null", CONSTRAINT_CPP), cppExtensionOE.getDirectEditorConfiguration() != null);
+ assertThat(String.format("language for constraint %s must be CPP", CONSTRAINT_CPP), cppExtensionOE.getDirectEditorConfiguration().getLanguage().equals("Textual editor for constraint edition with C++"));
+ }
+}

Back to the top