diff options
author | Vincent Lorenzo | 2017-05-03 12:59:08 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-05-22 18:27:31 +0000 |
commit | 883a5e399966977c972ff66998fdea157ed3ec95 (patch) | |
tree | c51027284262f8a6ffc3d8828462007767a40aa2 /plugins/uml/expressions | |
parent | cac8ea589d8c8149866680b7da4884c7ea579af1 (diff) | |
download | org.eclipse.papyrus-883a5e399966977c972ff66998fdea157ed3ec95.tar.gz org.eclipse.papyrus-883a5e399966977c972ff66998fdea157ed3ec95.tar.xz org.eclipse.papyrus-883a5e399966977c972ff66998fdea157ed3ec95.zip |
Bug 516106: [Expressions] Papyrus must provide a developer tool to generate ExpressionCatalog for Uml profile
Change-Id: I1ec67865f1d1acb6e2b1dac4ee73be02c488c31c
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/expressions')
3 files changed, 64 insertions, 2 deletions
diff --git a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/META-INF/MANIFEST.MF b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/META-INF/MANIFEST.MF index f9ef4b9d0b5..a1572e3d214 100755 --- a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/META-INF/MANIFEST.MF +++ b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.papyrus.uml.expressions.umlexpressions, org.eclipse.papyrus.uml.expressions.umlexpressions.custom, org.eclipse.papyrus.uml.expressions.umlexpressions.impl, - org.eclipse.papyrus.uml.expressions.umlexpressions.util + org.eclipse.papyrus.uml.expressions.umlexpressions.util, + org.eclipse.papyrus.uml.expressions.umlexpressions.utils Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)", org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)", org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)", diff --git a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsStereotypedWithExpression.java b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsStereotypedWithExpression.java index f6280de9505..fba185d6522 100755 --- a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsStereotypedWithExpression.java +++ b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/custom/CustomIsStereotypedWithExpression.java @@ -16,6 +16,7 @@ import java.util.Iterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.papyrus.uml.expressions.umlexpressions.impl.IsStereotypedWithExpressionImpl; +import org.eclipse.papyrus.uml.expressions.umlexpressions.utils.UMLExpressionsUtils; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Stereotype; @@ -41,7 +42,8 @@ public class CustomIsStereotypedWithExpression extends IsStereotypedWithExpressi final Stereotype current = iter.next(); if (this.stereotypeQualifiedName.equals(current.getQualifiedName())) { if (null != this.profileURI && !this.profileURI.isEmpty()) { - result = profileURI.equals(current.getProfile().getURI()); + // we use the uri of the top profile, because often the subprofiles don't have defined uri + result = profileURI.equals(UMLExpressionsUtils.getTopProfileURI(current)); } else { result = true; } diff --git a/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/utils/UMLExpressionsUtils.java b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/utils/UMLExpressionsUtils.java new file mode 100755 index 00000000000..04c01663b4f --- /dev/null +++ b/plugins/uml/expressions/org.eclipse.papyrus.uml.expressions/src/org/eclipse/papyrus/uml/expressions/umlexpressions/utils/UMLExpressionsUtils.java @@ -0,0 +1,59 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.expressions.umlexpressions.utils; + +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Profile; + +/** + * Utils methods for UML Expressions Framework + * + */ +public class UMLExpressionsUtils { + + + /** + * Constructor. + * + */ + private UMLExpressionsUtils() { + // to prevent instanciation + } + + /** + * + * @param element + * a profile + * @return + * the uri of the top profile owning the element or an empty string + * + * Warning, doesn't change this method, it is also used by the UML Expressions toolsmiths generating catalog for profile + */ + public static final String getTopProfileURI(final Element element) { + Element parent = element; + Profile topProfile = null; + if (element instanceof Profile) { + topProfile = (Profile) element; + } + + while (null != parent.getOwner()) { + parent = parent.getOwner(); + if (parent instanceof Profile) { + topProfile = (Profile) parent; + } + } + + return null != topProfile ? topProfile.getURI() : ""; //$NON-NLS-1$ + } +} |