| /* |
| * Copyright (c) 2007 Borland Software Corporation |
| * |
| * 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: |
| * Michael Golubev (Borland) - initial API and implementation |
| * 1. Diagram Header support |
| * 2. [210678] - Allow multi-view representation for single domain element |
| * 3. [188420] - There are only limited number of links-to-links in UML2Tools |
| */ |
| |
| «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» |
| «IMPORT "http://www.eclipse.org/emf/2002/GenModel"» |
| «IMPORT "http://www.eclipse.org/emf/2002/Ecore"» |
| «IMPORT "http://www.eclipse.org/uml2/diagram/gmfgenext/DiagramFigure/1.0"» |
| |
| «EXTENSION xpt::diagram::updater::Utils» |
| «EXTENSION aspects::xpt::diagram::updater::DiagramHeader» |
| «EXTENSION xpt::GenModelUtils» |
| |
| «AROUND checkChildElementVisualID(boolean inLoop) FOR gmfgen::GenNode-» |
| «REM» Diagram header is already added, do not't duplicate it«ENDREM»«-» |
| «IF !isDiagramHeader(this) -» |
| if (visualID == «EXPAND xpt::editor::VisualIDRegistry::visualID») { |
| result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«-» |
| «IF null != modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ELSE»childElement«ENDIF», visualID)); |
| «REM» Addition here -- if node is multi-view, add node descriptors for each of the parts«ENDREM»«-» |
| «LET ((gmfgenext::SubstitutableByAttributes)viewmap.attributes.typeSelect(gmfgenext::SubstitutableByAttributes).first()) AS group -» |
| «IF null != group && group.requiresAll -» |
| «FOREACH group.getSubstitutableByNodes() AS nextPart-» |
| result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«-» |
| «IF null != modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ELSE»childElement«ENDIF», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR nextPart»)); |
| «ENDFOREACH-» |
| «ENDIF-» |
| «ENDLET-» |
| «REM» End of added code«ENDREM»«-» |
| «IF inLoop-» |
| continue; |
| «ENDIF-» |
| } |
| «ENDIF-» |
| «ENDAROUND» |
| |
| «AROUND getSemanticChildrenMethodCall FOR gmfgen::GenContainerBase-» |
| «IF null != selectDiagramHeader(getSemanticChildren(this))-» |
| «getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».getSemanticChildren |
| «ELSE-» |
| «targetDef.proceed()-» |
| «ENDIF-» |
| «ENDAROUND» |
| |
| «AROUND getSemanticChildrenCase FOR gmfgen::GenContainerBase-» |
| «LET selectDiagramHeader(getSemanticChildren(this)) AS childHeader -» |
| «LET getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName() AS descriptorFQN -» |
| «IF null != childHeader -» |
| «EXPAND xpt::Common::caseVisualID» |
| { |
| //We have "dummy" TopLevelNode (with vid = «EXPAND xpt::editor::VisualIDRegistry::visualID FOR childHeader»). |
| //The only purpose for this node is to be a container for children (imports, etc) |
| //of the "main" diagram figure (that one shown as Canvas). |
| //Also we have modified the VisualIDRegistry#getNodeVisualID() to return |
| //VID = «EXPAND xpt::editor::VisualIDRegistry::visualID FOR childHeader», |
| //for the case when top-level view is created for the same semantic element as the canvas view. |
| |
| java.util.List resultAndHeader = new java.util.LinkedList(); |
| resultAndHeader.add(«-» |
| new «descriptorFQN»(view.getElement(), «EXPAND xpt::editor::VisualIDRegistry::visualID FOR childHeader»)); |
| resultAndHeader.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodName»(view)); |
| return resultAndHeader; |
| } |
| «ELSE-» |
| «targetDef.proceed()-» |
| «ENDIF-» |
| «ENDLET-» |
| «ENDLET-» |
| «ENDAROUND» |
| |
| «AROUND getConnectedLinks(List[gmfgen::GenLink] genLinks, String methodNameSuffix, boolean needCrossReferencer) FOR gmfgen::GenCommonBase-» |
| «IF isDiagramHeader(this)-» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static java.util.List «EXPAND xpt::diagram::updater::DiagramUpdater::linkGetterName(methodNameSuffix)»(org.eclipse.gmf.runtime.notation.View view) { |
| //no links to, from and inside the diagram header |
| return java.util.Collections.EMPTY_LIST; |
| } |
| «ELSE-» |
| «targetDef.proceed()-» |
| «ENDIF-» |
| «ENDAROUND» |
| |
| «AROUND getContainedLinks FOR gmfgen::GenCommonBase-» |
| «REM»Workaround for #188420. Safe for now as we don't yet have links-to-links«ENDREM»«-» |
| «REM»Except the only one at the Deployment Diagram.«ENDREM»«-» |
| «REM»Below is not trivial way to call instanceof«ENDREM»«-» |
| «IF !{this}.typeSelect(gmfgen::GenLink).isEmpty()-» |
| «REM»Special case: Deployment diagram link from DeploymenSpecification to DeploymentLink«ENDREM»«-» |
| «LET this.getDiagram() AS diagram -» |
| «IF diagram.editorGen.plugin.iD == "org.eclipse.uml2.diagram.deploy" && this.visualID == 4001-» |
| «targetDef.proceed()-» |
| «ELSE-» |
| «EXPAND xpt::diagram::updater::DiagramUpdater::getConnectedLinks({}, getContainedLinksMethodNameSuffix(), false)-» |
| «ENDIF-» |
| «ENDLET» |
| «ELSE-» |
| «targetDef.proceed()-» |
| «ENDIF-» |
| «ENDAROUND» |