Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5558f9a0fe954e007065471bb22785417eaaed3e (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
/*
 * 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:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 */

«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«EXTENSION xpt::diagram::ViewmapAttributesUtils»

«DEFINE NodeViewFactory FOR gmfgen::GenNode-»
«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
package «getDiagram().notationViewFactoriesPackageName»;

«EXPAND xpt::Common::generatedClassComment»
public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory {

	«EXPAND createStyles-»
	
	«EXPAND decorateView-»
	«EXPAND additions-»
}
«ENDDEFINE»

«DEFINE createStyles FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
		java.util.List styles = new java.util.ArrayList();
		«EXPAND xpt::diagram::views::Utils::addShapeStyle('styles') FOR viewmap-»
		«EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle('styles')-»
		«EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
		return styles;
	}
«ENDDEFINE»

«DEFINE decorateView FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
			org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
		«EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
		«EXPAND addShortcut-»
		«EXPAND xpt::diagram::views::Utils::foregroundColour('view') FOR viewmap-»
		«EXPAND xpt::diagram::views::Utils::backgroundColour('view') FOR viewmap-»
		«IF labels->size() > 0 or compartments->size() > 0-»
		org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
			«EXPAND xpt::diagram::views::Utils::domainElementAdapter('eObjectAdapter') FOR modelFacet-»
			«EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
			«EXPAND xpt::diagram::views::Utils::createChildNode FOREACH compartments-»
		«ENDIF-»
	}
«ENDDEFINE»

«DEFINE addShortcut FOR gmfgen::GenNode-»
«ENDDEFINE»

«DEFINE addShortcut FOR gmfgen::GenTopLevelNode-»
	if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(
			«getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
		«EXPAND xpt::Common::addShortcutAnnotation('view') FOR getDiagram()-»
	}
«ENDDEFINE»

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

Back to the top