Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ca7f0b81094b112649076c66d960925c61d17705 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Copyright (c) 2007 Borland Software Corp.
 * 
 * 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:
 *    bblajer (Borland) - initial API and implementation
 */

import "http://www.eclipse.org/emf/2002/Ecore";
import "http://www.eclipse.org/emf/2002/GenModel";
import "http://www.eclipse.org/gmf/2006/GenModel";
extension xpt::GenModelUtils;
extension xpt::commands::CommandUtils;

cached Collection[gmfgen::GenLink] incomingLinks(gmfgen::GenCommonBase gcb) :
	let effectiveMetaClass = gcb.getEffectiveMetaClass() :
	(effectiveMetaClass == null ? {} :
		gcb.getDiagram().links.select(e| e.incomingGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
;

Collection[gmfgen::GenLink] incomingTypeLinks(gmfgen::GenCommonBase gcb) :
	gcb.incomingLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0)
;

cached Collection[gmfgen::GenLink] outgoingLinks(gmfgen::GenCommonBase gcb) :
	let effectiveMetaClass = gcb.getEffectiveMetaClass() :
	(effectiveMetaClass == null ? {} :
		gcb.getDiagram().links.select(e| e.outgoingGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
;

cached Collection[gmfgen::GenLink] containedLinks(gmfgen::GenCommonBase gcb) :
	let effectiveMetaClass = gcb.getEffectiveMetaClass() :
		(effectiveMetaClass == null ? {} :
			gcb.getDiagram().links.select(e | e.containerGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
;

cached Collection[gmfgen::GenLink] containedTypeModelFacetLinks(gmfgen::GenCommonBase gcb) :
	gcb.containedLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0)
;

cached Collection[gmfgen::GenLink] containedFeatureModelFacetLinks(gmfgen::GenCommonBase gcb) :
	gcb.containedLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::FeatureLinkModelFacet).size() > 0)
;

cached Collection[gmfgen::GenLink] containedLinksWithSelector(gmfgen::GenCommonBase gcb) :
	gcb.containedTypeModelFacetLinks().select(e| e.modelFacet.getElementSelector() != null)
;

boolean needsSourceVisualID(gmfgen::GenCommonBase gcb) :
	gcb.containedLinks().select(e| e.modelFacet != null && e.getDiagram().getRelatedChildLabelGenNodes(e.modelFacet.getSourceType()).size() > 0).size() > 0
;

boolean needsTargetVisualID(gmfgen::GenCommonBase gcb) :
	gcb.containedLinks().select(e| e.modelFacet != null && e.getDiagram().getRelatedChildLabelGenNodes(e.modelFacet.getTargetType()).size() > 0).size() > 0
;

Collection[gmfgen::GenCommonBase] getPossibleContainers(gmfgen::GenLink link) :
	let containerClass = link.containerGenClass().ecoreClass : 
	(containerClass == null ? {} : 
		{link.getDiagram(), link.getDiagram().getAllNodes(), link.getDiagram().links}.flatten()
			.select(e| let effectiveMetaClass = ((gmfgen::GenCommonBase) e).getEffectiveMetaClass() : effectiveMetaClass == null ? false : 
				containerClass.isSuperTypeOf(effectiveMetaClass.ecoreClass))
	)
;

private gmfgen::GenConstraint getElementSelector(gmfgen::LinkModelFacet facet) :
	null
;

private gmfgen::GenConstraint getElementSelector(gmfgen::TypeLinkModelFacet facet) :
	facet.modelElementSelector
;

private genmodel::GenClass incomingGenClass(gmfgen::GenLink link) :
	link.modelFacet.incomingGenClass()
;

private genmodel::GenClass incomingGenClass(gmfgen::LinkModelFacet facet) :
	null
;

private genmodel::GenClass incomingGenClass(gmfgen::FeatureLinkModelFacet facet) :
	facet.metaFeature.getTypeGenClass()
;

private genmodel::GenClass incomingGenClass(gmfgen::TypeLinkModelFacet facet) :
	facet.targetMetaFeature.getTypeGenClass()
;

private genmodel::GenClass outgoingGenClass(gmfgen::GenLink link) :
	link.modelFacet.outgoingGenClass()
;

private genmodel::GenClass outgoingGenClass(gmfgen::LinkModelFacet facet) :
	null
;

private genmodel::GenClass outgoingGenClass(gmfgen::FeatureLinkModelFacet facet) :
	facet.metaFeature.genClass
;

private genmodel::GenClass outgoingGenClass(gmfgen::TypeLinkModelFacet facet) :
	facet.sourceMetaFeature == null ? facet.containmentMetaFeature.genClass
		: facet.sourceMetaFeature.getTypeGenClass()
;

private genmodel::GenClass getTypeGenClass(genmodel::GenFeature feature) :
	findGenClassifier(feature.genClass.genPackage.genModel, feature.ecoreFeature.eType)
;

private genmodel::GenClass containerGenClass(gmfgen::GenLink link) :
	link.modelFacet.containerGenClass()
;

private genmodel::GenClass containerGenClass(gmfgen::LinkModelFacet facet) :
	null
;

private genmodel::GenClass containerGenClass(gmfgen::TypeLinkModelFacet facet) :
	facet.containmentMetaFeature.genClass
;

private genmodel::GenClass containerGenClass(gmfgen::FeatureLinkModelFacet facet) :
	facet.metaFeature.genClass
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenCommonBase gcb) :
	null
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenDiagram diagram) :
	diagram.domainDiagramElement
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenNode node) :
	node.modelFacet.metaClass
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenLink link) :
	link.modelFacet.getEffectiveMetaClass()
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::LinkModelFacet facet) :
	null
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::TypeLinkModelFacet facet) :
	facet.metaClass
;

private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenChildLabelNode node) :
	null
;

Back to the top