diff options
Diffstat (limited to 'plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend')
-rw-r--r-- | plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend index 39336745449..e9aec5bb9d6 100644 --- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend +++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/diagram/editpolicies/Utils_qvto.xtend @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2007-2020 Borland Software Corporation, CEA LIST, Artal and others +/***************************************************************************** + * Copyright (c) 2007-2013, 2021 Borland Software Corporation, CEA LIST, Artal and others * * All rights reserved. This program && the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, && is available at - * https://www.eclipse.org/legal/epl-2.0/ - * + * https://www.eclipse.org/legal/epl-2.0/ + * * SPDX-License-Identifier: EPL-2.0 * - * Contributors: - * Alexander Shatalin (Borland) - initial API && implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * - #386838 - migrate to Xtend2 - * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174 + * Contributors: + * Alexander Shatalin (Borland) - initial API && implementation + * Michael Golubev (Borland) - [243151] explicit source/target for links + * - #386838 - migrate to Xtend2 + * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend *****************************************************************************/ package xpt.diagram.editpolicies @@ -35,11 +35,11 @@ import xpt.GenModelUtils_qvto } def String getContainerVariable(TypeLinkModelFacet modelFacet) { - if(modelFacet.sourceMetaFeature != null) 'container' else 'source' + if(modelFacet.sourceMetaFeature !== null) 'container' else 'source' } def Iterable<GenLinkConstraints> getValidLinkConstraints(GenDiagram diagram) { - var goodLinks = diagram.links.filter[l|l.creationConstraints != null && l.creationConstraints.isValid()]; + var goodLinks = diagram.links.filter[l|l.creationConstraints !== null && l.creationConstraints.isValid()]; return goodLinks.map[l | l.creationConstraints]; } @@ -72,7 +72,7 @@ import xpt.GenModelUtils_qvto } def boolean isCreationAllowed(GenLink link) { - link.modelFacet != null && (link.outgoingCreationAllowed || link.incomingCreationAllowed) + link.modelFacet !== null && (link.outgoingCreationAllowed || link.incomingCreationAllowed) } def boolean createStartLinkCommand(GenLink link, GenLinkEnd linkEnd) { @@ -124,9 +124,32 @@ import xpt.GenModelUtils_qvto */ def boolean isDirectlyOwned(GenChildNode child, GenNode genNode) { var childFacet = child.modelFacet; - if (childFacet == null || genNode.modelFacet == null) return false; - if (childFacet.containmentMetaFeature == null) return false; + if (childFacet === null || genNode.modelFacet === null) return false; + if (childFacet.containmentMetaFeature === null) return false; return childFacet.containmentMetaFeature.genClass.isSuperTypeOf(genNode.modelFacet.metaClass) } + + +def Boolean containsCreateStartLinkCommand(GenLinkEnd it){ + for (l : getAllPotentialLinks(it)){ + if(createStartLinkCommand(l, it)){ + return true; + } + } + + return false; +} + +def Boolean containsCreateCompleteLinkCommand(GenLinkEnd it){ + for (l : getAllPotentialLinks(it)){ + if(createCompleteLinkCommand(l, it)){ + return true; + } + } + + return false; +} + + } |