blob: b3eff21babeb8e08412b3646fac19d0eedbdc6bb [file] [log] [blame]
/*
* 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 GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
transformation Identity(in mapModel : GMFMAP, inout gmfgenModel : GMFGEN);
main() {
var mapRoot := mapModel.rootObjects()![GMFMAP::Mapping];
var editorGen := gmfgenModel.rootObjects()![GMFGEN::GenEditorGenerator];
visualIdentity(mapRoot, editorGen.diagram);
}
-- *************************************************************************************
-- Visual ID
-- *************************************************************************************
helper visualIdentity(in mapRoot : GMFMAP::Mapping, inout genDiagram : GMFGEN::GenDiagram) {
genDiagram.visualID := 1000;
--5.range(1, genDiagram.topLevelNodes->size())->forEach(i) {
Sequence { 1..genDiagram.topLevelNodes->size() }->forEach(i) {
var n : GenTopLevelNode := genDiagram.topLevelNodes->at(i);
n.visualID := 2000 + i;
};
Sequence { 1..genDiagram.childNodes->size() }->forEach(i) {
var n : GenChildNode := genDiagram.childNodes->at(i);
n.visualID := 3000 + i;
};
Sequence { 1..genDiagram.links->size() }->forEach(i) {
var l : GenLink := genDiagram.links->at(i);
l.visualID := 4000 + i;
};
Sequence { 1..genDiagram.compartments->size() }->forEach(i) {
var c : GenCompartment := genDiagram.compartments->at(i);
c.visualID := 7000 + i;
};
Sequence { 1..genDiagram.getAllNodes().labels->size() }->forEach(i) {
var l : GenLabel := genDiagram.getAllNodes().labels->at(i);
l.visualID := 5000 + i;
};
Sequence { 1..genDiagram.links.labels->size() }->forEach(i) {
var l : GenLabel := genDiagram.links.labels->at(i);
l.visualID := 6000 + i;
};
}