| /** |
| * Copyright (c) 2009 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: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel'); |
| modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore'); |
| modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel'); |
| |
| transformation DiagramRunTimeModel(in diagramRuntimeGenModel : GENMODEL, inout gmfgenModel : GMFGEN); |
| |
| main() { |
| var genModel = diagramRuntimeGenModel.rootObjects()![GENMODEL::GenModel]; |
| var genEditor = gmfgenModel.rootObjects()![GMFGEN::GenEditorGenerator]; |
| |
| var notationPackage = genModel.genPackages[ecorePackage.name = 'notation']; |
| var nodeClass : GENMODEL::GenClass = notationPackage.genClasses![ecoreClass.name = 'Node']; |
| var linkClass : GENMODEL::GenClass = notationPackage.genClasses![ecoreClass.name = 'Edge']; |
| var diagramClass : GENMODEL::GenClass = notationPackage.genClasses![ecoreClass.name = 'Diagram']; |
| var labelClass : GENMODEL::GenClass = nodeClass; |
| |
| var gd = genEditor.diagram; |
| gd.diagramRunTimeClass := diagramClass;-- Notation.Diagram; |
| genEditor.diagram.getAllNodes()->forEach(n) { n.diagramRunTimeClass := nodeClass }; |
| genEditor.diagram.compartments->forEach(c) { c.diagramRunTimeClass := nodeClass }; |
| genEditor.diagram.links->forEach(l) { l.diagramRunTimeClass := linkClass }; |
| genEditor.diagram.getAllNodes().labels->forEach(l) { l.diagramRunTimeClass := nodeClass }; |
| genEditor.diagram.links.labels->forEach(l) { l.diagramRunTimeClass := nodeClass }; |
| } |