Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6a3d65580e3e8abb3732e28c8b1cf1799f2d6196 (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
/******************************************************************************
 * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/ 
 * 
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors: 
 *    Alexander Shatalin (Borland) - initial API and implementation
 *    Artem Tikhomirov               moved from xpt::diagram::editpolicies to diagram::editpolicies API location
 *                                   [281014] pass semantic hints right from the CEP
 *    Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
 *****************************************************************************/

«IMPORT 'http://www.eclipse.org/papyrus/gmf/2020/GenModel'»

«DEFINE Main FOR gmfgen::GenDiagram-»
	«EXPAND xpt::Common::copyright FOR editorGen-»
package «editPoliciesPackageName»;

	«EXPAND xpt::Common::generatedClassComment»
public class «canonicalEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy {
	«REM»
		Perhaps, we need to supply implementation of refreshOnActivate() identical to that in CanonicalConnectionEditPolicy,
		if we observe troubles like in the bug 114992. Although I suspect the fact we do no check for EP being active when creating
		a connection implies we don't need this method.
	«ENDREM»

	«EXPAND impl::diagram::update::CanonicalUpdate::body-»

	«EXPAND refreshSemanticMethod-»
	«EXPAND refreshLinks-»
	«EXPAND impl::diagram::update::domain2notation::DomainToNotationClass-»
	«EXPAND additions-»
}
«ENDDEFINE»

«DEFINE refreshSemanticMethod FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
protected void refreshSemantic() {
	if (resolveSemanticElement() == null) {
		return;
	}
	«EXPAND CodeStyle::newGenericInstance('createdViews', 'java.util.LinkedList', 'org.eclipse.core.runtime.IAdaptable')»();
	«EXPAND impl::diagram::update::CanonicalUpdate::refreshSemanticChildren('createdViews', editorGen.diagramUpdater)-»

	«IF links->notEmpty()-»
		«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.core.runtime.IAdaptable')» createdConnectionViews = refreshConnections();
	«ENDIF-»

	«EXPAND impl::diagram::update::CanonicalUpdate::executeLayoutCommand('createdViews')-»

	«IF links->notEmpty()-»
		createdViews.addAll(createdConnectionViews);
	«ENDIF-»

	makeViewsImmutable(createdViews);
}
«ENDDEFINE»

«DEFINE refreshLinks FOR gmfgen::GenDiagram-»
	«IF links->notEmpty()-»
		«EXPAND refreshConnectionsMethod-»
		
		«EXPAND impl::diagram::update::CanonicalUpdate::refreshConnectionsAuxMethods-»
	«ENDIF-»
«ENDDEFINE»

«DEFINE refreshConnectionsMethod FOR gmfgen::GenDiagram-»
	«EXPAND xpt::Common::generatedMemberComment»
	private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.core.runtime.IAdaptable')» refreshConnections() {
		«EXPAND impl::diagram::update::CanonicalUpdate::refreshConnectionsBody-»
	}
«ENDDEFINE»

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

Back to the top