Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9eeaca8d7d76ea6ae2fda8b57d3cd162ce3b19a7 (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
/*
 * 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:
 *    bblajer (Borland) - initial API and implementation
 */

«IMPORT "http://www.eclipse.org/gmf/2006/GenModel"»
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
«EXTENSION xpt::diagram::parts::Common»
«EXTENSION xpt::diagram::policies::ClassNames»

«DEFINE LinkEditPart FOR gmfgen::GenLink-»
«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
package «getDiagram().editPartsPackageName»;

«EXPAND xpt::Common::generatedClassComment»
public class «editPartClassName» «EXPAND supertypes» {
	«EXPAND xpt::diagram::parts::Common::visualIDConstant-»

	«EXPAND xpt::diagram::parts::Common::ctors-»
	«EXPAND xpt::diagram::parts::Common::declareViewCode-»
	«EXPAND xpt::diagram::parts::Common::registerModel-»
	«EXPAND xpt::diagram::parts::Common::getModelChildren-»
	«EXPAND xpt::diagram::parts::Common::getModelSourceConnections-»
	«EXPAND xpt::diagram::parts::Common::getModelTargetConnections-»
	«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::all-»
	«EXPAND connectionAnchors-»
	«EXPAND xpt::diagram::parts::decorations::decorationManager-»
	«EXPAND createEditPolicies-»

	«EXPAND xpt::diagram::parts::requests::getPrimaryLabelEditPart-»
	«EXPAND xpt::diagram::parts::requests::performRequest-»
	«EXPAND xpt::diagram::parts::requests::getLabelEditPart-»

	«EXPAND xpt::diagram::parts::Common::getAdapter-»
	«EXPAND xpt::diagram::parts::TreeEditPart::getTreeEditPartAdapter-»
	«EXPAND xpt::diagram::parts::Common::activate-»
	«EXPAND xpt::diagram::parts::Common::deactivate-»
	«EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
	«EXPAND xpt::diagram::parts::refresh::refresher-»
	«EXPAND xpt::diagram::parts::refresh::externalRefreshers-»

	«EXPAND addNotify-»
	«EXPAND createFigure-»

	«EXPAND xpt::diagram::parts::decorations::createDecorationManager-»
	«EXPAND primCreateFigure-»
	«EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
	«EXPAND xpt::diagram::parts::TreeEditPart::TreeEditPart-»
	«EXPAND additions-»
}
«ENDDEFINE»

«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.gef.editparts.AbstractConnectionEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecoratableEditPart, org.eclipse.gef.NodeEditPart«ENDDEFINE»

«DEFINE createEditPolicies FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment»
protected void createEditPolicies() {
	installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new «getComponentEditPolicyQualifiedClassName()»());
	installEditPolicy(org.eclipse.gef.EditPolicy.CONNECTION_ENDPOINTS_ROLE, new org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy());
	installEditPolicy(org.eclipse.gef.EditPolicy.CONNECTION_BENDPOINTS_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.BendpointEditPolicy());
«IF getPrimaryLabel() != null-»
	installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.DelegatingDirectEditPolicy());
«ENDIF-»
	installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
	«EXPAND xpt::diagram::parts::Common::behaviour-»
	«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
}
«ENDDEFINE»

«DEFINE addNotify FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment»
public void addNotify() {
	super.addNotify();
	getConnectionFigure().setConnectionRouter(«EXPAND instantiateConnectionRouter»);
}
«ENDDEFINE»

«DEFINE instantiateConnectionRouter FOR gmfgen::GenLink»new org.eclipse.draw2d.BendpointConnectionRouter()«ENDDEFINE»

«DEFINE createFigure FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment»
protected org.eclipse.draw2d.IFigure createFigure() {
	org.eclipse.draw2d.Connection result = primCreateFigure();
	myDecorationManager = createDecorationManager(result);
	return result;
}
«ENDDEFINE»

«DEFINE primCreateFigure FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment("Creates figure for this edit part.\n\n" + 
"Body of this method does not depend on settings in generation model\n" + 
"so you may safely remove <i>generated</i> tag and modify it.\n")»
private org.eclipse.draw2d.Connection primCreateFigure() {
	«EXPAND primCreateFigure FOR viewmap-»
}
«ENDDEFINE»

«DEFINE primCreateFigure FOR gmfgen::Viewmap»«ERROR "Unexpected viewmap type " + this»«ENDDEFINE»

«DEFINE primCreateFigure FOR gmfgen::FigureViewmap-»
	return new «figureQualifiedClassName == null ? "org.eclipse.gmf.runtime.draw2d.PolylineConnection" : figureQualifiedClassName»();
«ENDDEFINE»

«DEFINE primCreateFigure FOR gmfgen::SnippetViewmap-»
	return «body»;
«ENDDEFINE»

«DEFINE primCreateFigure FOR gmfgen::InnerClassViewmap-»
	return new «className»();
«ENDDEFINE»

«DEFINE connectionAnchors FOR gmfgen::GenLink-»
«EXPAND xpt::Common::generatedMemberComment»
public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
	return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
}

«EXPAND xpt::Common::generatedMemberComment»
public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request) {
	return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
}

«EXPAND xpt::Common::generatedMemberComment»
public org.eclipse.draw2d.ConnectionAnchor  getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
	return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
}

«EXPAND xpt::Common::generatedMemberComment»
public org.eclipse.draw2d.ConnectionAnchor  getTargetConnectionAnchor(org.eclipse.gef.Request request) {
	return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
}
«ENDDEFINE»

«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»

Back to the top