blob: b91c9cb85fea6dea6b50a2c9bf0836dea0976bbc [file] [log] [blame]
* Copyright (c) 2009, 2011, 2012 Borland Software Corporation & 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
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
* Guillaume Hillairet (Montages A.G.)
import Utils;
import Mappings;
import DiagramRunTimeModel;
import PropertySheet;
import PreferencePages;
import Navigator;
import Actions;
import RichClientPlatformApp;
import Audits;
import Parsers;
modeltype GMFMAP uses mappings('');
modeltype GMFGEN uses gmfgen('');
modeltype GENMODEL uses genmodel('');
transformation Map2Gen(
in mapModel: GMFMAP,
in domainGenModel: GENMODEL,
in diagramRuntimeGenModel: GENMODEL,
out gmfgenModel: GMFGEN);
configuration property rcp: Boolean;
configuration property useMapMode: Boolean;
configuration property useFullRunTime: Boolean;
configuration property useInTransformationCodeGen: Boolean;
main() {
var mapRoot := mapModel.rootObjects()![GMFMAP::Mapping];
genModel := domainGenModel.rootObjects()![GENMODEL::GenModel];
useModeledViewmaps := not useInTransformationCodeGen;
var genEditor := structure();
genEditor.diagram.palette := palette();
genEditor.domainGenModel := mapRoot.diagram.domainModel.findGenPackage().genModel;
genEditor.plugin := editorPlugin();
genEditor.editor := object GenEditorView {};
genEditor.diagramUpdater := object GenDiagramUpdater {};
genEditor.audits := audits(); -- these two should go before expression providers collection
genEditor.metrics := metrics();
if not GMFGEN::GenParserImplementation.allInstances()->isEmpty() then {
genEditor.labelParsers := createGenParsers()
} endif;
new DiagramRunTimeModel(diagramRuntimeGenModel, gmfgenModel).transform();
if not rcp then new Navigator(mapModel, gmfgenModel).transform() endif;
new PropertySheet(mapModel, gmfgenModel).transform();
new PreferencePages(mapModel, gmfgenModel).transform();
new Actions(mapModel, gmfgenModel).transform();
if rcp then new RichClientPlatformApp(mapModel, gmfgenModel).transform() endif;
-- collect orphan palette items and add them to the Default group.
var toolGroup := GMFGEN::ToolGroup.allInstances()->any(title = 'Default');
GMFGEN::ToolGroupItem.allInstances()->select(e | e.container().oclIsUndefined())->forEach(element) {
toolGroup.entries += element;
-- Editor Plugin
mapping GMFMAP::Mapping::editorPlugin() : GMFGEN::GenPlugin {
requiredPlugins := Set{'org.eclipse.gmf.tooling.runtime', 'org.eclipse.draw2d'};
if self.links->notEmpty() or GMFMAP::LabelMapping.allInstances()->notEmpty() then
requiredPlugins += 'org.eclipse.gmf.runtime.draw2d.ui'
self.diagram.diagramCanvas.figures->forEach(fg) {
if not fg.implementationBundle.oclIsUndefined() then {
result.requiredPlugins += fg.implementationBundle
} endif;