Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 487d120e64e8e60cf29a3b777ee09fcb09502087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * 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:
 *    Artem Tikhomirov (Borland) - initial API and implementation
 */
import "http://www.eclipse.org/gmf/2005/GenModel/2.0";
import "http://www.eclipse.org/emf/2002/GenModel";
import "http://www.eclipse.org/emf/2002/Ecore";
extension xpt::GenModelUtils;

boolean standaloneDomainModel(gmfgen::GenDiagram genDiagram) :
	!genDiagram.editorGen.sameFileForDiagramAndModel && genDiagram.domainDiagramElement != null
;

boolean hasDocumentRoot(gmfgen::GenDiagram genDiagram) :
	genDiagram.getDocumentRoot() != null
;

genmodel::GenClass getDocumentRoot(gmfgen::GenDiagram genDiagram) :
	genDiagram.domainDiagramElement.genPackage.getDocumentRoot()
;

genmodel::GenFeature getDocumentRootSetFeature(gmfgen::GenDiagram genDiagram) :
	genDiagram.getDocumentRoot().genFeatures.select(f | f.isDocRootSetFeature(genDiagram.domainDiagramElement.ecoreClass)).first()
;

// const ETypedElement.UNSPECIFIED_MULTIPLICITY = -2
private boolean isDocRootSetFeature(genmodel::GenFeature gf, ecore::EClass eType) :
	(!gf.isListType() && gf.ecoreFeature.changeable) && -2 == gf.ecoreFeature.upperBound && ((EClass) gf.ecoreFeature.eType).isSuperTypeOf(eType)
	// Perhaps, makes sense to check instanceof EReference && isContainment
;

Back to the top