Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: dec5ea5665c3fe9d576ac0d5cc0969411688ad16 (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
<%@ jet package="org.eclipse.gmf.codegen.templates.editor" class="InitDiagramFileActionGenerator"
	imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.emf.codegen.ecore.genmodel.* java.util.* org.eclipse.gmf.common.codegen.*"
	skeleton="../common.skeleton"%>
<%
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
final GenEditorGenerator editorGen = genDiagram.getEditorGen();
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
final String pluginActivatorClass = importManager.getImportedName(editorGen.getPlugin().getActivatorQualifiedClassName());
final String modelID = editorGen.getModelID();
List genLinks = genDiagram.getLinks();

// Collecting all phantom elements
Map genClass2Phantom = new LinkedHashMap();
for (Iterator topLevelNodes = genDiagram.getTopLevelNodes().iterator(); topLevelNodes.hasNext();) {
	GenTopLevelNode nextTopLevelNode = (GenTopLevelNode) topLevelNodes.next();
	TypeModelFacet nextModelFacet = nextTopLevelNode.getModelFacet();
	if (!nextModelFacet.isPhantomElement()) {
		continue;
	}
	genClass2Phantom.put(nextModelFacet.getMetaClass(), nextTopLevelNode);
}

boolean generateGetCompartment = false;

importManager.emitPackageStatement(stringBuffer);%>

<%
importManager.addImport("java.io.IOException");
importManager.addImport("java.util.Collections");
importManager.addImport("java.util.HashMap");
importManager.addImport("java.util.Map");
importManager.addImport("org.eclipse.core.resources.IFile");
importManager.addImport("org.eclipse.core.resources.IResource");
importManager.addImport("org.eclipse.core.resources.ResourcesPlugin");
importManager.addImport("org.eclipse.core.runtime.IStatus");
importManager.addImport("org.eclipse.core.runtime.Path");
importManager.addImport("org.eclipse.emf.ecore.EClass");
importManager.addImport("org.eclipse.emf.ecore.EObject");
importManager.addImport("org.eclipse.emf.ecore.resource.Resource");
importManager.addImport("org.eclipse.gmf.runtime.emf.core.edit.MRunnable");
importManager.addImport("org.eclipse.gmf.runtime.emf.core.util.OperationUtil");
importManager.addImport("org.eclipse.gmf.runtime.emf.core.util.ResourceUtil");
importManager.addImport("org.eclipse.gmf.runtime.notation.Diagram");
importManager.addImport("org.eclipse.jface.action.IAction");
importManager.addImport("org.eclipse.jface.dialogs.IInputValidator");
importManager.addImport("org.eclipse.jface.dialogs.InputDialog");
importManager.addImport("org.eclipse.jface.dialogs.MessageDialog");
importManager.addImport("org.eclipse.jface.viewers.ISelection");
importManager.addImport("org.eclipse.jface.viewers.IStructuredSelection");
importManager.addImport("org.eclipse.swt.widgets.Shell");
importManager.addImport("org.eclipse.ui.IObjectActionDelegate");
importManager.addImport("org.eclipse.ui.IWorkbenchPart");
importManager.addImport("org.eclipse.ui.PartInitException");
importManager.addImport("org.eclipse.ui.ide.IDE");
importManager.addImport("org.eclipse.gmf.runtime.diagram.core.services.ViewService");

importManager.markImportLocation(stringBuffer);
%>

/**
 * @generated
 */
public class <%=genDiagram.getInitDiagramFileActionClassName()%> implements IObjectActionDelegate, IInputValidator {

	/**
	 * @generated
	 */
	private IWorkbenchPart myPart;
	
	/**
	 * @generated
	 */
	private IFile mySelection;
    
	/**
	 * @generated
	 */
	private Map myLinkVID2EObjectMap = new HashMap();
	
	/**
	 * @generated
	 */
	private Map myEObject2NodeMap = new HashMap();

    /**
     * @generated
     */
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
		myPart = targetPart;
	}
	
    /**
     * @generated
     */
	private Shell getShell() {
		return myPart.getSite().getShell();
	}
	
    /**
     * @generated
     */
	public void selectionChanged(IAction action, ISelection selection) {
		mySelection = null;
		action.setEnabled(false);
		if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
			return;
		}
		mySelection = (IFile) ((IStructuredSelection) selection).getFirstElement();
		action.setEnabled(true);
	}
	
    /**
     * @generated
     */	
	public String isValid(String newText) {
		IStatus status = ResourcesPlugin.getWorkspace().validateName(newText, IResource.FILE);
		if (!status.isOK()) {
			return status.getMessage();
		}
		if (mySelection.getParent().getFile(new Path(newText).addFileExtension("editorGen.getDiagramFileExtension()")).exists()) {
			return "File already exists, choose another name";
		}
		return null;
	}
	
    /**
     * @generated
     */
	public void run(IAction action) {
		final InputDialog outputFileNameDialog = new InputDialog(getShell(), "Diagram file name", "Please provide diagram file name", mySelection.getProjectRelativePath().removeFileExtension().addFileExtension("editorGen.getDiagramFileExtension()").lastSegment(), this);
		if (outputFileNameDialog.open() != InputDialog.OK) {
			return;
		}
		final EObject diagramModelObject = load();
		if (diagramModelObject == null) {
			MessageDialog.openError(getShell(), "Error", "Failed to load user model");
			return;
		}
		OperationUtil.runAsUnchecked(new MRunnable() {
			public Object run() {
				EObject diagram = create(diagramModelObject);
				if (diagram == null) {
					MessageDialog.openError(getShell(), "Error", "Failed to create diagram object");
					return null;
				}
				IFile destFile = mySelection.getParent().getFile(new Path(outputFileNameDialog.getValue()));
				save(destFile.getLocation().toOSString(), diagram);
				try {
					IDE.openEditor(myPart.getSite().getPage(), destFile);
				} catch (PartInitException ex) {
					<%=pluginActivatorClass%>.getInstance().logError("Unable to open editor", ex);
				}
				return null;
			}
		});
	}
	
    /**
     * @generated
     */
	private EObject load() {
<%if (editorGen.isSameFileForDiagramAndModel()) {%>
		<%=importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")%> resourceSet = new <%=importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")%>();
		Resource resource = resourceSet.getResource(<%=importManager.getImportedName("org.eclipse.emf.common.util.URI")%>.createPlatformResourceURI(mySelection.getFullPath().toString()), true);
		try {
			resource.load(Collections.EMPTY_MAP);
			return (EObject) resource.getContents().get(0);
		} catch (IOException ex) {
			<%=pluginActivatorClass%>.getInstance().logError("Unable to load resource: " + mySelection.getFullPath().toString(), ex);
		}
		return null;
<%} else {%>
		String resourcePath = mySelection.getLocation().toOSString();
		Resource modelResource = ResourceUtil.findResource(resourcePath);
		if (modelResource == null) {
			modelResource = ResourceUtil.create(resourcePath);
		}
		if (!modelResource.isLoaded()) {
			try {
				ResourceUtil.load(modelResource);
			} catch (Exception e) {
				<%=pluginActivatorClass%>.getInstance().logError("Unable to load resource: " + resourcePath, e);
				return null;
			}
		}
		return (EObject) modelResource.getContents().get(0);
<%}%>
	}
	
    /**
     * @generated
     */
	private void save(String filePath, EObject canvas) {
		Resource resource = ResourceUtil.create(filePath, null);
<%if (editorGen.isSameFileForDiagramAndModel()) {%>
		resource.getContents().add(((Diagram) canvas).getElement());
<%}%>
		resource.getContents().add(canvas);
		try {
			resource.save(Collections.EMPTY_MAP);
		} catch (IOException ex) {
			<%=pluginActivatorClass%>.getInstance().logError("Save operation failed for: " + filePath, ex);
		}
	}
	
    /**
     * @generated
     */
	private EObject create(EObject diagramModel) {
		int diagramVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getDiagramVisualID(diagramModel);
		if (diagramVID != <%=genDiagram.getVisualID()%>) {
			return null;
		}
<%
for (Iterator it = genLinks.iterator(); it.hasNext();) {
	GenLink nextLink = (GenLink) it.next();
%>
		myLinkVID2EObjectMap.put(new Integer(<%=nextLink.getVisualID()%>), new <%=importManager.getImportedName("java.util.LinkedList")%>());
<%
}
%>
		Diagram diagram = ViewService.createDiagram(diagramModel, "<%=modelID%>", <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
		create<%=genDiagram.getUniqueIdentifier()%>Children(diagram, diagramModel);
<%
if (!genClass2Phantom.isEmpty()) {
%>
		Resource resource = diagramModel.eResource();
		int nodeVID;
		for (Iterator it = resource.getContents().iterator(); it.hasNext();) {
			EObject nextResourceObject = (EObject) it.next();
			if (nextResourceObject == diagramModel) {
				continue;
			}
<%
	for (Iterator phantoms = genClass2Phantom.values().iterator(); phantoms.hasNext();) {
		GenTopLevelNode phantomNode = (GenTopLevelNode) phantoms.next();
%>
			nodeVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getNodeVisualID(diagram, nextResourceObject, "");
			if (<%=phantomNode.getVisualID()%> == nodeVID) {
				<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode = ViewService.createNode(diagram, nextResourceObject, null, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
				myEObject2NodeMap.put(nextResourceObject, nextNode);
				create<%=phantomNode.getUniqueIdentifier()%>Children(nextNode, nextResourceObject);
				continue;
			}
<%
	}
%>
		}
<%
}
%>		
		createLinks();
		myLinkVID2EObjectMap.clear();
		myEObject2NodeMap.clear();		
	    return diagram;
	}
	
<%
for (Iterator containers = genDiagram.getAllContainers().iterator(); containers.hasNext();) {
	GenContainerBase nextContainer = (GenContainerBase) containers.next();
%>	

    /**
     * @generated
     */
	private void create<%=nextContainer.getUniqueIdentifier()%>Children(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> viewObject, EObject modelObject) {
<%
	if (nextContainer.getContainedNodes().size() > 0) {
%>
		EObject nextValue;
		<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode;
		int nodeVID;
<%
	} else if (nextContainer instanceof GenNode && ((GenNode) nextContainer).getCompartments().size() > 0) {
%>
		<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode;
<%
	}
	
	for (Iterator children = nextContainer.getContainedNodes().iterator(); children.hasNext();) {
		GenNode nextChild = (GenNode) children.next();
		TypeModelFacet typeModelFacet = nextChild.getModelFacet();
		if (typeModelFacet.isPhantomElement()) {
// Skipping top-leve phantoms
			continue;
		}
		GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
		if (childMetaFeature.isListType()) {
%>
		for (<%=importManager.getImportedName("java.util.Iterator")%> values = <%=getFeatureValueGetter("modelObject", childMetaFeature, true, importManager)%>.iterator(); values.hasNext();) {
			nextValue = (EObject) values.next();

<%
		} else {
%>
		nextValue = <%=getFeatureValueGetter("modelObject", childMetaFeature, true, importManager)%>;
<%
		}
%>
		nodeVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getNodeVisualID(viewObject, nextValue, "");
		if (<%=nextChild.getVisualID()%> == nodeVID) {
			nextNode = ViewService.createNode(viewObject, nextValue, null, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
			myEObject2NodeMap.put(nextValue, nextNode);
			create<%=nextChild.getUniqueIdentifier()%>Children(nextNode, nextValue);
		}
<%
		if (childMetaFeature.isListType()) {
%>
		}
<%
		}
	}
	
	if (nextContainer instanceof GenNode) {
		GenNode nextNode = (GenNode) nextContainer;
		for (Iterator compartments = nextNode.getCompartments().iterator(); compartments.hasNext();) {
			GenCompartment nextCompartment = (GenCompartment) compartments.next();
			generateGetCompartment = true;
%>
		nextNode = getCompartment(viewObject, "<%=nextCompartment.getTitle()%>");
		if (nextNode != null) {
			create<%=nextCompartment.getUniqueIdentifier()%>Children(nextNode, modelObject);
		}
<%
		}
	}
%>
		storeLinks(modelObject, viewObject.getDiagram());
	}
<%
}

if (generateGetCompartment) {
%>
	
    /**
     * @generated
     */
	private <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> getCompartment(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> node, String name) {
		for (<%=importManager.getImportedName("java.util.Iterator")%> it = node.getChildren().iterator(); it.hasNext();) {
			<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> nextView = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%>) it.next();
			if (nextView instanceof <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> && name.equals(nextView.getType())) {
				return (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%>) nextView;
			}
		}
		return null;
	}
<%
}
%>

	/**
	 *@generated
	 */
	private void storeLinks(EObject container, Diagram diagram) {
		EClass containerMetaclass = container.eClass();
		storeFeatureModelFacetLinks(container, containerMetaclass, diagram);
		storeTypeModelFacetLinks(container, containerMetaclass);
	}
	
	/**
     * @generated
     */
	private void storeTypeModelFacetLinks(EObject container, EClass containerMetaclass) {	
<%
for (Iterator it = genLinks.iterator(); it.hasNext();) {
	GenLink nextLink = (GenLink) it.next();
	if (nextLink.getModelFacet() instanceof TypeLinkModelFacet) {
		TypeLinkModelFacet typeLinkModelFacet = (TypeLinkModelFacet) nextLink.getModelFacet();
		GenFeature childMetaFeature = typeLinkModelFacet.getChildMetaFeature();
%>		
		if (-1 != containerMetaclass.getFeatureID(<%=importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=childMetaFeature.getFeatureAccessorName()%>())) {
			Object featureValue = <%=getFeatureValueGetter("container", childMetaFeature, true, importManager)%>;
<%
		if (childMetaFeature.isListType()) {
%>		
			for (<%=importManager.getImportedName("java.util.Iterator")%> values = ((<%=importManager.getImportedName("java.util.Collection")%>) featureValue).iterator(); values.hasNext();) {
				EObject nextValue = ((EObject) values.next());
<%
		} else {
%>
			EObject nextValue = (EObject) featureValue;
<%		
		}
%>
			int linkVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getLinkWithClassVisualID(nextValue);
			if (<%=nextLink.getVisualID()%> == linkVID) {
				((<%=importManager.getImportedName("java.util.Collection")%>) myLinkVID2EObjectMap.get(new Integer(<%=nextLink.getVisualID()%>))).add(nextValue);
			}
<%
		if (childMetaFeature.isListType()) {
%>
			}
<%
		}
%>
		}
<%
	}
}
%>
	}

	/**
	 *@generated
	 */
	private void storeFeatureModelFacetLinks(EObject container, EClass containerMetaclass, Diagram diagram) {
<%
for (Iterator it = genLinks.iterator(); it.hasNext();) {
	GenLink nextLink = (GenLink) it.next();
	if (nextLink.getModelFacet() instanceof FeatureModelFacet) {
		FeatureModelFacet linkFMF = (FeatureModelFacet) nextLink.getModelFacet();
		GenFeature genFeature = linkFMF.getMetaFeature();
%>
		if (-1 != containerMetaclass.getFeatureID(<%=importManager.getImportedName(genFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=genFeature.getFeatureAccessorName()%>())) {
			((<%=importManager.getImportedName("java.util.Collection")%>) myLinkVID2EObjectMap.get(new Integer(<%=nextLink.getVisualID()%>))).add(container);
<%
		if (genFeature.isContains()) {
// Processing phantom elements
// TODO: separate this code into incliuded file together with part of create???Children() operation
			GenTopLevelNode phantomNode = (GenTopLevelNode) genClass2Phantom.get(genFeature.getTypeGenClass());
			if (phantomNode != null) {
				if (genFeature.isListType()) {
%>
			for (<%=importManager.getImportedName("java.util.Iterator")%> values = <%=getFeatureValueGetter("container", genFeature, true, importManager)%>.iterator(); values.hasNext();) {
				EObject nextValue = (EObject) values.next();
<%
				} else {
%>
			EObject nextValue = <%=getFeatureValueGetter("container", genFeature, true, importManager)%>;
<%
				}
%>
			int nodeVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getNodeVisualID(diagram, nextValue, "");
			if (<%=phantomNode.getVisualID()%> == nodeVID) {
				<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> nextNode = ViewService.createNode(diagram, nextValue, null, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
				myEObject2NodeMap.put(nextValue, nextNode);
				create<%=phantomNode.getUniqueIdentifier()%>Children(nextNode, nextValue);
			}
<%
				if (genFeature.isListType()) {
%>
			}
<%
				}
			}
		}
%>
		}
<%
	}
}
%>
	}

	/**
     * @generated
     */
	private void createLinks() {
<%
if (genLinks.size() > 0) {
%>
		<%=importManager.getImportedName("java.util.Collection")%> linkElements;
<%
}

for (Iterator it = genLinks.iterator(); it.hasNext();) {
	GenLink nextLink = (GenLink) it.next();
	GenFeature domainLinkTargetGenFeature;
%>
		linkElements = (<%=importManager.getImportedName("java.util.Collection")%>) myLinkVID2EObjectMap.get(new Integer(<%=nextLink.getVisualID()%>));
		for (<%=importManager.getImportedName("java.util.Iterator")%> it = linkElements.iterator(); it.hasNext();) {
			EObject linkElement = (EObject) it.next();
<%	
	if (nextLink.getModelFacet() instanceof TypeLinkModelFacet) {
		TypeLinkModelFacet typeLinkModelFacet = (TypeLinkModelFacet) nextLink.getModelFacet();
		domainLinkTargetGenFeature = typeLinkModelFacet.getTargetMetaFeature();
		if (typeLinkModelFacet.getSourceMetaFeature() != null) {
%>
			Object srcResult = <%=getFeatureValueGetter("linkElement", typeLinkModelFacet.getSourceMetaFeature(), true, importManager)%>;
			if (srcResult instanceof EObject == false) {
				continue;
			}
			EObject src = (EObject) srcResult;
<%
		} else {
%>
			EObject src = linkElement.eContainer();
<%
		}
	} else {
		domainLinkTargetGenFeature = ((FeatureModelFacet) nextLink.getModelFacet()).getMetaFeature();
%>
			EObject src = linkElement;
<%	
	}
%>
			<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> srcNode = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%>) myEObject2NodeMap.get(src);
			if (srcNode == null) {
				continue;
			}
			Object structuralFeatureResult = <%=getFeatureValueGetter("linkElement", domainLinkTargetGenFeature, true, importManager)%>;
<%
	if (nextLink.getModelFacet() instanceof TypeLinkModelFacet) {
%>
			if (structuralFeatureResult instanceof EObject == false) {
				continue;
			}
			EObject dst = (EObject) structuralFeatureResult;
<%
	} else {
		if (domainLinkTargetGenFeature.isListType()) {
%>
			if (structuralFeatureResult instanceof <%=importManager.getImportedName("java.util.Collection")%> == false) {
				continue;
			}
			for (<%=importManager.getImportedName("java.util.Iterator")%> destinations = ((<%=importManager.getImportedName("java.util.Collection")%>) structuralFeatureResult).iterator(); destinations.hasNext();) {
				EObject dst = (EObject) destinations.next();
<%	
		} else {
%>
			if (structuralFeatureResult instanceof EObject == false) {
				continue;
			}
			EObject dst = (EObject) structuralFeatureResult;
<%
		}
	}
%>
			<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> dstNode = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%>) myEObject2NodeMap.get(dst);
			if (dstNode != null) {
<%
	if (nextLink.getModelFacet() instanceof TypeLinkModelFacet) {
%>
				ViewService.createEdge(srcNode, dstNode, linkElement, null, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
			}
<%
	} else {
%>
					<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%> edge = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%>) ViewService.getInstance().createEdge(new <%=importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")%>() {
						public Object getAdapter(Class adapter) {
							if (<%=importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.IElementType")%>.class.equals(adapter)) {
								return <%=importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())%>.<%=nextLink.getUniqueIdentifier()%>;
							}
							return null;
						}
					}, srcNode.getDiagram(), "", <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.core.util.ViewUtil")%>.APPEND, <%=pluginActivatorClass%>.DIAGRAM_PREFERENCES_HINT);
					if (edge != null) {
						edge.setSource(srcNode);
						edge.setTarget(dstNode);
					}
<%
		if (domainLinkTargetGenFeature.isListType()) {
%>
				}
<%
}
%>
			}
<%	
	}
%>
		}
<%
}
%>
	}
	
}
<%importManager.emitSortedImports();%>

Back to the top