View | Details | Raw Unified | Return to bug 144412 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/internal/codegen/lite/Generator.java (+36 lines)
Lines 29-34 Link Here
29
import org.eclipse.gmf.codegen.gmfgen.GenCompartment;
29
import org.eclipse.gmf.codegen.gmfgen.GenCompartment;
30
import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
30
import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
31
import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
31
import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
32
import org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter;
33
import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase;
34
import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderContainer;
32
import org.eclipse.gmf.codegen.gmfgen.GenLink;
35
import org.eclipse.gmf.codegen.gmfgen.GenLink;
33
import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel;
36
import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel;
34
import org.eclipse.gmf.codegen.gmfgen.GenNode;
37
import org.eclipse.gmf.codegen.gmfgen.GenNode;
Lines 135-142 Link Here
135
		internalGenerateJavaClass(myEmitters.getDiagramViewFactoryGenerator(), myDiagram.getNotationViewFactoryQualifiedClassName(), myDiagram);
138
		internalGenerateJavaClass(myEmitters.getDiagramViewFactoryGenerator(), myDiagram.getNotationViewFactoryQualifiedClassName(), myDiagram);
136
		internalGenerateJavaClass(myEmitters.getDomainElementInitializerGenerator(), myDiagram.getNotationViewFactoriesPackageName(), "DomainElementInitializer",myDiagram); // XXX: allow customization!
139
		internalGenerateJavaClass(myEmitters.getDomainElementInitializerGenerator(), myDiagram.getNotationViewFactoriesPackageName(), "DomainElementInitializer",myDiagram); // XXX: allow customization!
137
		internalGenerateJavaClass(myEmitters.getVisualIDRegistryGenerator(), myDiagram.getVisualIDRegistryQualifiedClassName(), myDiagram);
140
		internalGenerateJavaClass(myEmitters.getVisualIDRegistryGenerator(), myDiagram.getVisualIDRegistryQualifiedClassName(), myDiagram);
141
		if(myDiagram.getEditorGen().getExpressionProviders() != null) {
142
			generateExpressionProviders();
143
		}
138
	}
144
	}
139
145
146
	private void generateExpressionProviders() throws UnexpectedBehaviourException, InterruptedException {
147
		GenExpressionProviderContainer providerContainer = myEditorGen.getExpressionProviders();
148
		internalGenerateJavaClass(
149
			myEmitters.getAbstractExpressionEmitter(),
150
			providerContainer.getExpressionsPackageName(), 
151
			providerContainer.getAbstractExpressionClassName(),
152
			myDiagram
153
		);
154
155
		for (Iterator it = providerContainer.getProviders().iterator(); it.hasNext();) {
156
			GenExpressionProviderBase nextProvider = (GenExpressionProviderBase) it.next();
157
			if(nextProvider instanceof GenExpressionInterpreter) {
158
				TextEmitter providerEmitter = null;
159
				if("ocl".equals(nextProvider.getLanguage())) { //$NON-NLS-1$
160
					providerEmitter = myEmitters.getOCLExpressionFactoryEmitter();
161
				} else if("regexp".equals(nextProvider.getLanguage()) || "nregexp".equals(nextProvider.getLanguage())) { //$NON-NLS-1$ //$NON-NLS-2$
162
					providerEmitter = myEmitters.getRegexpExpressionFactoryEmitter();
163
				}
164
				GenExpressionInterpreter interpreter = (GenExpressionInterpreter)nextProvider;
165
				if(providerEmitter != null) {
166
					internalGenerateJavaClass(
167
							providerEmitter,
168
							providerContainer.getExpressionsPackageName(),
169
							interpreter.getClassName(),
170
							interpreter);
171
				}
172
			}
173
		}
174
	}
175
	
140
	private void internalGenerateJavaClass(TextEmitter emitter, String qualifiedClassName, Object argument) throws InterruptedException {
176
	private void internalGenerateJavaClass(TextEmitter emitter, String qualifiedClassName, Object argument) throws InterruptedException {
141
		internalGenerateJavaClass(emitter, CodeGenUtil.getPackageName(qualifiedClassName), CodeGenUtil.getSimpleClassName(qualifiedClassName), argument);
177
		internalGenerateJavaClass(emitter, CodeGenUtil.getPackageName(qualifiedClassName), CodeGenUtil.getSimpleClassName(qualifiedClassName), argument);
142
	}
178
	}
(-)src/org/eclipse/gmf/internal/codegen/lite/CodegenEmitters.java (+18 lines)
Lines 36-41 Link Here
36
import org.eclipse.gmf.codegen.templates.lite.editor.PluginPropertiesGenerator;
36
import org.eclipse.gmf.codegen.templates.lite.editor.PluginPropertiesGenerator;
37
import org.eclipse.gmf.codegen.templates.lite.editor.PluginXML;
37
import org.eclipse.gmf.codegen.templates.lite.editor.PluginXML;
38
import org.eclipse.gmf.codegen.templates.lite.editor.VisualIDRegistryGenerator;
38
import org.eclipse.gmf.codegen.templates.lite.editor.VisualIDRegistryGenerator;
39
import org.eclipse.gmf.codegen.templates.lite.expressions.AbstractExpressionGenerator;
40
import org.eclipse.gmf.codegen.templates.lite.expressions.OCLExpressionFactoryGenerator;
41
import org.eclipse.gmf.codegen.templates.lite.expressions.RegexpExpressionFactoryGenerator;
39
import org.eclipse.gmf.codegen.templates.lite.parts.ChildNodeEditPartGenerator;
42
import org.eclipse.gmf.codegen.templates.lite.parts.ChildNodeEditPartGenerator;
40
import org.eclipse.gmf.codegen.templates.lite.parts.CompartmentEditPartGenerator;
43
import org.eclipse.gmf.codegen.templates.lite.parts.CompartmentEditPartGenerator;
41
import org.eclipse.gmf.codegen.templates.lite.parts.DiagramEditPartGenerator;
44
import org.eclipse.gmf.codegen.templates.lite.parts.DiagramEditPartGenerator;
Lines 115-120 Link Here
115
		put(tr, "/editor/build.propertiesjet", BuildPropertiesGenerator.class);
118
		put(tr, "/editor/build.propertiesjet", BuildPropertiesGenerator.class);
116
		put(tr, "/editor/plugin.xmljet", PluginXML.class);
119
		put(tr, "/editor/plugin.xmljet", PluginXML.class);
117
		put(tr, "/editor/plugin.propertiesjet", PluginPropertiesGenerator.class);
120
		put(tr, "/editor/plugin.propertiesjet", PluginPropertiesGenerator.class);
121
		put(tr, "/expressions/AbstractExpression.javajet", AbstractExpressionGenerator.class);
122
		put(tr, "/expressions/OCLExpressionFactory.javajet", OCLExpressionFactoryGenerator.class);
123
		put(tr, "/expressions/RegexpExpressionFactory.javajet", RegexpExpressionFactoryGenerator.class);
118
		return tr;
124
		return tr;
119
	}
125
	}
120
126
Lines 238-243 Link Here
238
		return retrieve(PluginPropertiesGenerator.class);
244
		return retrieve(PluginPropertiesGenerator.class);
239
	}
245
	}
240
246
247
	public TextEmitter getAbstractExpressionEmitter() throws UnexpectedBehaviourException {
248
		return retrieve(AbstractExpressionGenerator.class);
249
	}
250
	
251
	public TextEmitter getOCLExpressionFactoryEmitter() throws UnexpectedBehaviourException {
252
		return retrieve(OCLExpressionFactoryGenerator.class);
253
	}	
254
	
255
	public TextEmitter getRegexpExpressionFactoryEmitter() throws UnexpectedBehaviourException {
256
		return retrieve(RegexpExpressionFactoryGenerator.class);
257
	}
258
241
	/**
259
	/**
242
	 * @see #retrieve(Class)
260
	 * @see #retrieve(Class)
243
	 */
261
	 */
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/editor/VisualIDRegistryGenerator.java (-57 / +291 lines)
Lines 3-8 Link Here
3
import org.eclipse.gmf.codegen.gmfgen.*;
3
import org.eclipse.gmf.codegen.gmfgen.*;
4
import java.util.*;
4
import java.util.*;
5
import org.eclipse.gmf.common.codegen.*;
5
import org.eclipse.gmf.common.codegen.*;
6
import org.eclipse.emf.codegen.ecore.genmodel.*;
6
7
7
public class VisualIDRegistryGenerator
8
public class VisualIDRegistryGenerator
8
{
9
{
Lines 20-26 Link Here
20
  protected final String TEXT_2 = NL + "/*" + NL + " * ";
21
  protected final String TEXT_2 = NL + "/*" + NL + " * ";
21
  protected final String TEXT_3 = NL + " */";
22
  protected final String TEXT_3 = NL + " */";
22
  protected final String TEXT_4 = NL + NL + "/**" + NL + " * This registry is used to determine which type of visual object should be" + NL + " * created for the corresponding Diagram, Node, ChildNode or Link represented " + NL + " * by a domain model object. Note that it only returns semantically complete objects (those who must have an element associated with them)." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class ";
23
  protected final String TEXT_4 = NL + NL + "/**" + NL + " * This registry is used to determine which type of visual object should be" + NL + " * created for the corresponding Diagram, Node, ChildNode or Link represented " + NL + " * by a domain model object. Note that it only returns semantically complete objects (those who must have an element associated with them)." + NL + " *" + NL + " * @generated" + NL + " */" + NL + "public class ";
23
  protected final String TEXT_5 = " {" + NL + "" + NL + "\tpublic static final ";
24
  protected final String TEXT_5 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
24
  protected final String TEXT_6 = " INSTANCE = new ";
25
  protected final String TEXT_6 = " INSTANCE = new ";
25
  protected final String TEXT_7 = "();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(View view) {" + NL + "\t\tif (view instanceof Diagram) {" + NL + "\t\t\tif (";
26
  protected final String TEXT_7 = "();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static int getVisualID(View view) {" + NL + "\t\tif (view instanceof Diagram) {" + NL + "\t\t\tif (";
26
  protected final String TEXT_8 = ".MODEL_ID.equals(view.getType())) {" + NL + "\t\t\t\treturn ";
27
  protected final String TEXT_8 = ".MODEL_ID.equals(view.getType())) {" + NL + "\t\t\t\treturn ";
Lines 61-89 Link Here
61
  protected final String TEXT_43 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL;
62
  protected final String TEXT_43 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedDiagramID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL;
62
  protected final String TEXT_44 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isNode";
63
  protected final String TEXT_44 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isNode";
63
  protected final String TEXT_45 = "(";
64
  protected final String TEXT_45 = "(";
64
  protected final String TEXT_46 = " element) {" + NL + "\t\treturn ElementSelectors.";
65
  protected final String TEXT_46 = " element) {" + NL + "\t\treturn ";
65
  protected final String TEXT_47 = ".matches(element);" + NL + "\t}\t";
66
  protected final String TEXT_47 = ".matches(element)";
66
  protected final String TEXT_48 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate int getUnrecognized";
67
  protected final String TEXT_48 = "true";
67
  protected final String TEXT_49 = "ChildNodeID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}";
68
  protected final String TEXT_49 = ";" + NL + "\t}";
68
  protected final String TEXT_50 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL;
69
  protected final String TEXT_50 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate int getUnrecognized";
69
  protected final String TEXT_51 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isLinkWithClass";
70
  protected final String TEXT_51 = "ChildNodeID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}";
70
  protected final String TEXT_52 = "(";
71
  protected final String TEXT_52 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to handle some specific" + NL + "\t * situations not covered by default logic." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int getUnrecognizedLinkWithClassID(EObject domainElement) {" + NL + "\t\treturn -1;" + NL + "\t}" + NL;
71
  protected final String TEXT_53 = " element) {" + NL + "\t\treturn ElementSelectors.";
72
  protected final String TEXT_53 = NL + NL + "\t/**" + NL + "\t * User can change implementation of this method to check some additional " + NL + "\t * conditions here." + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isLinkWithClass";
72
  protected final String TEXT_54 = ".matches(element);" + NL + "\t}";
73
  protected final String TEXT_54 = "(";
73
  protected final String TEXT_55 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ElementSelectors {\t";
74
  protected final String TEXT_55 = " element) {" + NL + "\t\treturn ";
74
  protected final String TEXT_56 = NL + NL + "\t\t/**" + NL + "\t\t * Element matching condition for ";
75
  protected final String TEXT_56 = ".matches(element)";
75
  protected final String TEXT_57 = "." + NL + "\t\t * <pre>language: ";
76
  protected final String TEXT_57 = "true";
76
  protected final String TEXT_58 = "</pre>\t" + NL + "\t\t * <pre>body    : ";
77
  protected final String TEXT_58 = ";" + NL + "\t}";
77
  protected final String TEXT_59 = "</pre>" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final Matcher ";
78
  protected final String TEXT_59 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate static final ";
78
  protected final String TEXT_60 = " = new Matcher(\"";
79
  protected final String TEXT_60 = " ";
79
  protected final String TEXT_61 = "\");";
80
  protected final String TEXT_61 = " = new ";
80
  protected final String TEXT_62 = NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ElementSelectors() {" + NL + "\t\t}";
81
  protected final String TEXT_62 = "(";
81
  protected final String TEXT_63 = "\t\t\t" + NL + "\t\t/**" + NL + "\t\t* @generated\t" + NL + "\t\t*/" + NL + "\t\tstatic class Matcher {" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate EClass evalContext;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate ";
82
  protected final String TEXT_63 = "null";
82
  protected final String TEXT_64 = " condition;" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tprivate String body;\t\t" + NL + "\t\t\t\t\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t" + NL + "\t\t\tMatcher(String expressionBody) {\t\t\t" + NL + "\t\t\t\tbody = expressionBody;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t\t" + NL + "\t\t\tboolean matches(EObject object) {\t\t" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tBoolean result = (object != null) ? evaluate(object) : Boolean.FALSE;" + NL + "\t\t\t\t\treturn result.booleanValue();" + NL + "\t\t\t\t} catch(IllegalArgumentException e) {" + NL + "\t\t\t\t\t";
83
  protected final String TEXT_64 = ".";
83
  protected final String TEXT_65 = ".getInstance().logError(null, e);" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t" + NL + "\t\t\tprivate Boolean evaluate(EObject context) {" + NL + "\t\t\t\tthis.evalContext = context.eClass();" + NL + "\t\t\t\tif(condition == null) {\t\t\t\t\t" + NL + "\t\t\t\t\tcondition = new ";
84
  protected final String TEXT_65 = "(\"";
84
  protected final String TEXT_66 = "(body, evalContext);" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif(condition != null) {" + NL + "\t\t\t\t\treturn booleanCast(condition.evaluate(context));" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t/**" + NL + "\t\t\t* @generated\t" + NL + "\t\t\t*/\t\t\t\t\t" + NL + "\t\t\tprivate static Boolean booleanCast(Object value) {" + NL + "\t\t\t\tif(value == null) {" + NL + "\t\t\t\t\treturn null;" + NL + "\t\t\t\t} else if(value instanceof Boolean) {" + NL + "\t\t\t\t\t return (Boolean)value;\t" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn Boolean.FALSE;" + NL + "\t\t\t}" + NL + "\t\t} // end of Matcher";
85
  protected final String TEXT_66 = "\", //$NON-NLS-1$" + NL + "\t";
85
  protected final String TEXT_67 = "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class AcceptAllMatcher {" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t" + NL + "\t\t\tstatic final AcceptAllMatcher INSTANCE = new AcceptAllMatcher();" + NL + "\t\t\t/**" + NL + "\t\t\t * @generated" + NL + "\t\t\t */\t\t\t\t\t" + NL + "\t\t\tboolean matches(Object element) {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */\t\t" + NL + "\t\tstatic AcceptAllMatcher acceptAllMatcher() {" + NL + "\t\t\treturn AcceptAllMatcher.INSTANCE;" + NL + "\t\t}" + NL + "\t} // end of ElementSelectors" + NL + "}";
86
  protected final String TEXT_67 = ", ";
86
  protected final String TEXT_68 = NL;
87
  protected final String TEXT_68 = ")";
88
  protected final String TEXT_69 = ".";
89
  protected final String TEXT_70 = "(\"";
90
  protected final String TEXT_71 = "\", //$NON-NLS-1$" + NL + "\t";
91
  protected final String TEXT_72 = ")";
92
  protected final String TEXT_73 = "new ";
93
  protected final String TEXT_74 = "(";
94
  protected final String TEXT_75 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
95
  protected final String TEXT_76 = " env) {\t" + NL + "\t\t";
96
  protected final String TEXT_77 = " self = (";
97
  protected final String TEXT_78 = ")context;";
98
  protected final String TEXT_79 = "\t" + NL + "\t\t";
99
  protected final String TEXT_80 = " ";
100
  protected final String TEXT_81 = " = (";
101
  protected final String TEXT_82 = ")env.get(\"";
102
  protected final String TEXT_83 = "\"); //$NON-NLS-1$";
103
  protected final String TEXT_84 = NL + "\t\treturn ";
104
  protected final String TEXT_85 = ".";
105
  protected final String TEXT_86 = "(self";
106
  protected final String TEXT_87 = ", ";
107
  protected final String TEXT_88 = ");" + NL + "\t}" + NL + "}";
108
  protected final String TEXT_89 = NL + ");";
109
  protected final String TEXT_90 = "\t\t\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic class ";
110
  protected final String TEXT_91 = " {" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t" + NL + "\t\tprivate ";
111
  protected final String TEXT_92 = " condition;" + NL + "\t\t\t\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t" + NL + "\t\t";
112
  protected final String TEXT_93 = "(";
113
  protected final String TEXT_94 = " conditionExpression) {\t\t\t" + NL + "\t\t\tthis.condition = conditionExpression;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated\t" + NL + "\t\t */\t\t\t\t\t\t" + NL + "\t\tboolean matches(EObject object) {" + NL + "\t\t\tObject result = condition.evaluate(object);" + NL + "\t\t\treturn result instanceof Boolean && ((Boolean)result).booleanValue();\t\t\t" + NL + "\t\t}" + NL + "\t}// ";
114
  protected final String TEXT_95 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private static class ";
115
  protected final String TEXT_96 = " {";
116
  protected final String TEXT_97 = NL;
117
  protected final String TEXT_98 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
118
  protected final String TEXT_99 = " ";
119
  protected final String TEXT_100 = "(";
120
  protected final String TEXT_101 = " self";
121
  protected final String TEXT_102 = ", ";
122
  protected final String TEXT_103 = " ";
123
  protected final String TEXT_104 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '";
124
  protected final String TEXT_105 = "' operation\"); //$NON-NLS-1$" + NL + "}";
125
  protected final String TEXT_106 = NL + "\t}// ";
126
  protected final String TEXT_107 = NL + "}" + NL + "\t";
127
  protected final String TEXT_108 = NL;
87
128
88
  public String generate(Object argument)
129
  public String generate(Object argument)
89
  {
130
  {
Lines 102-107 Link Here
102
    stringBuffer.append(TEXT_3);
143
    stringBuffer.append(TEXT_3);
103
    }
144
    }
104
    importManager.emitPackageStatement(stringBuffer);
145
    importManager.emitPackageStatement(stringBuffer);
146
147
final String matcherClassName = "Matcher";
148
final String javaMatcherContainer = "JavaMatchers";
149
importManager.registerInnerClass(matcherClassName);
150
importManager.registerInnerClass(javaMatcherContainer);
151
105
importManager.addImport("org.eclipse.emf.ecore.EClass");
152
importManager.addImport("org.eclipse.emf.ecore.EClass");
106
importManager.addImport("org.eclipse.emf.ecore.EObject");
153
importManager.addImport("org.eclipse.emf.ecore.EObject");
107
importManager.addImport("org.eclipse.gmf.runtime.notation.View");
154
importManager.addImport("org.eclipse.gmf.runtime.notation.View");
Lines 219-272 Link Here
219
    }
266
    }
220
    stringBuffer.append(TEXT_43);
267
    stringBuffer.append(TEXT_43);
221
    
268
    
222
String acceptAllMatcherAccessor = "acceptAllMatcher()"; //$NON-NLS-1$
223
for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) {
269
for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) {
224
	GenNode nextNode = (GenNode) nodes.next();
270
	GenNode nextNode = (GenNode) nodes.next();
225
	String qualifiedChildNodeInterfaceName = nextNode.getDomainMetaClass().getQualifiedInterfaceName();
271
	if (nextNode.getModelFacet() == null) {
226
	String childNodeSelector = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null ? nextNode.getUniqueIdentifier() : acceptAllMatcherAccessor;
272
		continue;
273
	}
274
	String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName());
275
	boolean callMatcher = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null;
227
276
228
    stringBuffer.append(TEXT_44);
277
    stringBuffer.append(TEXT_44);
229
    stringBuffer.append(nextNode.getUniqueIdentifier());
278
    stringBuffer.append(nextNode.getUniqueIdentifier());
230
    stringBuffer.append(TEXT_45);
279
    stringBuffer.append(TEXT_45);
231
    stringBuffer.append(importManager.getImportedName(qualifiedChildNodeInterfaceName));
280
    stringBuffer.append(childNodeInterfaceName);
232
    stringBuffer.append(TEXT_46);
281
    stringBuffer.append(TEXT_46);
233
    stringBuffer.append(childNodeSelector);
282
    if (callMatcher) {
283
    stringBuffer.append(nextNode.getUniqueIdentifier());
234
    stringBuffer.append(TEXT_47);
284
    stringBuffer.append(TEXT_47);
285
    } else {
286
    stringBuffer.append(TEXT_48);
287
    }
288
    stringBuffer.append(TEXT_49);
235
    
289
    
236
}
290
}
237
for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) {
291
for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) {
238
	GenContainerBase nextContainer = (GenContainerBase) containers.next();
292
	GenContainerBase nextContainer = (GenContainerBase) containers.next();
239
293
240
    stringBuffer.append(TEXT_48);
294
    stringBuffer.append(TEXT_50);
241
    stringBuffer.append(nextContainer.getUniqueIdentifier());
295
    stringBuffer.append(nextContainer.getUniqueIdentifier());
242
    stringBuffer.append(TEXT_49);
296
    stringBuffer.append(TEXT_51);
243
    
297
    
244
}
298
}
245
299
246
    stringBuffer.append(TEXT_50);
300
    stringBuffer.append(TEXT_52);
247
    
301
    
248
for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) {
302
for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) {
249
	GenLink genLink = (GenLink) it.next();
303
	GenLink genLink = (GenLink) it.next();
250
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
304
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
251
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
305
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
252
		String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
306
		String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
253
		String linkSelector = modelFacet.getModelElementSelector() != null ? genLink.getUniqueIdentifier() : acceptAllMatcherAccessor;		
307
		boolean callMatcher = modelFacet.getModelElementSelector() != null;		
254
308
255
    stringBuffer.append(TEXT_51);
256
    stringBuffer.append(genLink.getUniqueIdentifier());
257
    stringBuffer.append(TEXT_52);
258
    stringBuffer.append(interfaceName);
259
    stringBuffer.append(TEXT_53);
309
    stringBuffer.append(TEXT_53);
260
    stringBuffer.append(linkSelector);
310
    stringBuffer.append(genLink.getUniqueIdentifier());
261
    stringBuffer.append(TEXT_54);
311
    stringBuffer.append(TEXT_54);
312
    stringBuffer.append(interfaceName);
313
    stringBuffer.append(TEXT_55);
314
    if (callMatcher) {
315
    stringBuffer.append(genLink.getUniqueIdentifier());
316
    stringBuffer.append(TEXT_56);
317
    } else {
318
    stringBuffer.append(TEXT_57);
319
    }
320
    stringBuffer.append(TEXT_58);
262
    
321
    
263
	}
322
	}
264
}
323
}
265
324
266
    stringBuffer.append(TEXT_55);
325
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
267
    
326
final List javaSelectorFacets = new ArrayList();
327
final Map __exprEnvVariables = Collections.EMPTY_MAP;
328
final String __outEnvVarName = null; // no custom env
329
final String __javaOperationContainer = javaMatcherContainer; // put method here
330
268
int selectorCounter = 0;
331
int selectorCounter = 0;
269
for (Iterator it = genDiagram.eAllContents(); it.hasNext();) {
332
for (Iterator it = genDiagram.eAllContents(); it.hasNext() && expressionProviders != null;) {
270
	Object next = it.next();
333
	Object next = it.next();
271
	String id = null;
334
	String id = null;
272
	TypeModelFacet modelFacet = null;
335
	TypeModelFacet modelFacet = null;
Lines 277-313 Link Here
277
		id = ((GenLink) next).getUniqueIdentifier();
340
		id = ((GenLink) next).getUniqueIdentifier();
278
		modelFacet = (TypeLinkModelFacet) ((GenLink) next).getModelFacet();
341
		modelFacet = (TypeLinkModelFacet) ((GenLink) next).getModelFacet();
279
	}
342
	}
280
	if (modelFacet == null || modelFacet.getModelElementSelector() == null) {
343
	if (modelFacet == null || modelFacet.getModelElementSelector() == null || modelFacet.getMetaClass() == null) {
281
		continue;
344
		continue;
282
	}
345
	}
283
	GenConstraint selector = modelFacet.getModelElementSelector();
346
	GenConstraint selector = modelFacet.getModelElementSelector();
284
	selectorCounter++;
347
	selectorCounter++;
348
	// setup expression factory
349
	ValueExpression __genValueExpression = selector;
350
	GenClassifier __genExprContext = modelFacet.getMetaClass();
351
	GenExpressionProviderBase expressionProvider = expressionProviders.getProvider(__genValueExpression); 
352
	if(expressionProvider instanceof GenJavaExpressionProvider && !expressionProviders.isCopy(__genValueExpression)) {
353
		// skipping duplicates coming from reused node mappings 
354
		javaSelectorFacets.add(modelFacet);
355
	}
285
356
286
    stringBuffer.append(TEXT_56);
287
    stringBuffer.append(id);
288
    stringBuffer.append(TEXT_57);
289
    stringBuffer.append(selector.getLanguage());
290
    stringBuffer.append(TEXT_58);
291
    stringBuffer.append(selector.getBody());
292
    stringBuffer.append(TEXT_59);
357
    stringBuffer.append(TEXT_59);
293
    stringBuffer.append(id);
358
    stringBuffer.append(matcherClassName);
294
    stringBuffer.append(TEXT_60);
359
    stringBuffer.append(TEXT_60);
295
    stringBuffer.append(selector.getBody());
360
    stringBuffer.append(id);
296
    stringBuffer.append(TEXT_61);
361
    stringBuffer.append(TEXT_61);
297
    }
362
    stringBuffer.append(matcherClassName);
298
    stringBuffer.append(TEXT_62);
363
    stringBuffer.append(TEXT_62);
299
    if(selectorCounter > 0) { 
364
    
365
{ /*begin the scope*/
366
/*
367
ValueExpression __genValueExpression;
368
GenClassifier __genExprContext
369
java.util.Map __exprEnvVariables
370
String __outEnvVarName;
371
String __javaOperationContainer;
372
*/
373
	org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
374
	String __ctxEClassifierAccess = importManager.getImportedName(__genExprContext.getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + __genExprContext.getClassifierAccessorName()+"()";
375
	String __importedAbstractClass = __genExprProvider != null ? importManager.getImportedName(__genExprProvider.getContainer().getAbstractExpressionQualifiedClassName()) : null;
376
377
	if(__genExprProvider == null || __importedAbstractClass == null) {
378
300
    stringBuffer.append(TEXT_63);
379
    stringBuffer.append(TEXT_63);
301
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition"));
380
    
381
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
382
		org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
383
		String __expressionAccessor = interpreter.getExpressionAccessor(__genValueExpression);
384
		String providerImportedClass = importManager.getImportedName(interpreter.getQualifiedClassName());
385
		if(!__exprEnvVariables.isEmpty()) {			
386
387
    stringBuffer.append(providerImportedClass);
302
    stringBuffer.append(TEXT_64);
388
    stringBuffer.append(TEXT_64);
303
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
389
    stringBuffer.append(__expressionAccessor);
304
    stringBuffer.append(TEXT_65);
390
    stringBuffer.append(TEXT_65);
305
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition"));
391
    stringBuffer.append(__genValueExpression.getBody());
306
    stringBuffer.append(TEXT_66);
392
    stringBuffer.append(TEXT_66);
307
    }
393
    stringBuffer.append(__ctxEClassifierAccess);
308
    stringBuffer.append(TEXT_67);
394
    stringBuffer.append(TEXT_67);
309
    importManager.emitSortedImports();
395
    stringBuffer.append(__outEnvVarName);
310
    stringBuffer.append(TEXT_68);
396
    stringBuffer.append(TEXT_68);
397
    
398
		} else { 		
399
400
    stringBuffer.append(providerImportedClass);
401
    stringBuffer.append(TEXT_69);
402
    stringBuffer.append(__expressionAccessor);
403
    stringBuffer.append(TEXT_70);
404
    stringBuffer.append(__genValueExpression.getBody());
405
    stringBuffer.append(TEXT_71);
406
    stringBuffer.append(__ctxEClassifierAccess);
407
    stringBuffer.append(TEXT_72);
408
    
409
		}
410
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
411
		String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
412
		String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);	
413
414
415
    stringBuffer.append(TEXT_73);
416
    stringBuffer.append(__importedAbstractClass);
417
    stringBuffer.append(TEXT_74);
418
    stringBuffer.append(__ctxEClassifierAccess);
419
    stringBuffer.append(TEXT_75);
420
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
421
    stringBuffer.append(TEXT_76);
422
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
423
    stringBuffer.append(TEXT_77);
424
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
425
    stringBuffer.append(TEXT_78);
426
    	
427
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
428
			String nextVariableName = (String)envVarIt.next();
429
			org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
430
			String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
431
432
    stringBuffer.append(TEXT_79);
433
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
434
    stringBuffer.append(TEXT_80);
435
    stringBuffer.append(nextVariableName);
436
    stringBuffer.append(TEXT_81);
437
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
438
    stringBuffer.append(TEXT_82);
439
    stringBuffer.append(nextVariableName);
440
    stringBuffer.append(TEXT_83);
441
    		} 
442
    stringBuffer.append(TEXT_84);
443
    
444
		if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { 
445
    stringBuffer.append(__javaOperationContainer);
446
    stringBuffer.append(TEXT_85);
447
    
448
		} 
449
    stringBuffer.append(__exprJavaOperName);
450
    stringBuffer.append(TEXT_86);
451
    
452
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
453
    stringBuffer.append(TEXT_87);
454
    stringBuffer.append((String)envVarIt.next());
455
    }
456
    stringBuffer.append(TEXT_88);
457
    }
458
    } /*end of scope*/
459
    stringBuffer.append(TEXT_89);
460
    
461
} /* end of selector interation */
462
463
if(selectorCounter > 0) { 
464
    stringBuffer.append(TEXT_90);
465
    stringBuffer.append(matcherClassName);
466
    stringBuffer.append(TEXT_91);
467
    stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
468
    stringBuffer.append(TEXT_92);
469
    stringBuffer.append(matcherClassName);
470
    stringBuffer.append(TEXT_93);
471
    stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
472
    stringBuffer.append(TEXT_94);
473
    stringBuffer.append(matcherClassName);
474
    
475
	if(!javaSelectorFacets.isEmpty()) {
476
477
    stringBuffer.append(TEXT_95);
478
    stringBuffer.append(javaMatcherContainer);
479
    stringBuffer.append(TEXT_96);
480
    
481
		for(Iterator it = javaSelectorFacets.iterator(); it.hasNext();) {
482
			TypeModelFacet modelFacet = (TypeModelFacet) it.next();
483
			ValueExpression __genValueExpression = modelFacet.getModelElementSelector();
484
			GenClassifier __genExprContext = modelFacet.getMetaClass();
485
			String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$
486
487
    stringBuffer.append(TEXT_97);
488
    
489
/* 
490
ValueExpression __genValueExpression
491
java.util.Map __exprEnvVariables
492
GenClassifier __genExprContext
493
GenClassifier || String/qualifiedClassName/__genExprResultType
494
*/
495
org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
496
if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) {
497
	String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
498
	// support GenClassifier and also String based qualified java class name
499
	Object __genExprResultTypeObj = __genExprResultType;
500
	String __exprResultTypeQualifiedName = null;
501
	if(__genExprResultTypeObj instanceof String) 
502
		__exprResultTypeQualifiedName = (String)__genExprResultTypeObj;
503
	else if(__genExprResultTypeObj instanceof org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)
504
		__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
505
	String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
506
507
    stringBuffer.append(TEXT_98);
508
    stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
509
    stringBuffer.append(TEXT_99);
510
    stringBuffer.append(__exprJavaOperName);
511
    stringBuffer.append(TEXT_100);
512
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
513
    stringBuffer.append(TEXT_101);
514
    
515
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
516
		String __nextVarName = (String)envVarIt.next();
517
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(__nextVarName);
518
		String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
519
520
	
521
    stringBuffer.append(TEXT_102);
522
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
523
    stringBuffer.append(TEXT_103);
524
    stringBuffer.append(__nextVarName);
525
    	} 
526
527
    stringBuffer.append(TEXT_104);
528
    stringBuffer.append(__exprJavaOperName);
529
    stringBuffer.append(TEXT_105);
530
    
531
}
532
533
    
534
		} /* java javaSelectorFacets iteration */
535
536
    stringBuffer.append(TEXT_106);
537
    stringBuffer.append(javaMatcherContainer);
538
    
539
	} /* !javaSelectorFacets.isEmpty() */
540
} /* selectorCounter > 0 */
541
542
    stringBuffer.append(TEXT_107);
543
    importManager.emitSortedImports();
544
    stringBuffer.append(TEXT_108);
311
    return stringBuffer.toString();
545
    return stringBuffer.toString();
312
  }
546
  }
313
}
547
}
(-)templates/parts/NodeEditPart.javajet (-5 / +35 lines)
Lines 5-11 Link Here
5
GenNode genNode = (GenNode) ((Object[]) argument)[0];
5
GenNode genNode = (GenNode) ((Object[]) argument)[0];
6
GenDiagram genDiagram = genNode.getDiagram();
6
GenDiagram genDiagram = genNode.getDiagram();
7
Palette palette = genDiagram.getPalette();
7
Palette palette = genDiagram.getPalette();
8
boolean useFlowLayout = ViewmapLayoutTypeHelper.getSharedInstance().isStoringChildPositions(genNode);
8
boolean isXYLayout = ViewmapLayoutTypeHelper.getSharedInstance().isStoringChildPositions(genNode);
9
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
9
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
10
%>
10
%>
11
<%@ include file="../copyright4java.jetinc"%>
11
<%@ include file="../copyright4java.jetinc"%>
Lines 220-226 Link Here
220
		figureQualifiedClassName = "org.eclipse.draw2d.RectangleFigure";
220
		figureQualifiedClassName = "org.eclipse.draw2d.RectangleFigure";
221
	}
221
	}
222
%>
222
%>
223
		primaryShape = new <%=importManager.getImportedName(figureQualifiedClassName)%>()<%if (useFlowLayout) {%> {
223
		primaryShape = new <%=importManager.getImportedName(figureQualifiedClassName)%>()<%if (isXYLayout) {%> {
224
			protected boolean useLocalCoordinates() {
224
			protected boolean useLocalCoordinates() {
225
				return true;
225
				return true;
226
			}
226
			}
Lines 231-237 Link Here
231
 	figureQualifiedClassName = ((InnerClassViewmap) viewmap).getClassName();
231
 	figureQualifiedClassName = ((InnerClassViewmap) viewmap).getClassName();
232
%>
232
%>
233
		<%=figureQualifiedClassName%> figure = new <%=figureQualifiedClassName%>();
233
		<%=figureQualifiedClassName%> figure = new <%=figureQualifiedClassName%>();
234
 		figure.setUseLocalCoordinates(<%=useFlowLayout ? "true" : "false"%>);
234
<%if (!genNode.getChildNodes().isEmpty() && isXYLayout) { /*otherwise, leave to figure's default value*/%>
235
 		figure.setUseLocalCoordinates(true);
236
<%}%>
235
 		primaryShape = figure;
237
 		primaryShape = figure;
236
<%}%>
238
<%}%>
237
		return primaryShape;
239
		return primaryShape;
Lines 264-270 Link Here
264
	protected <%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> setupContentPane(<%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> nodeShape) {
266
	protected <%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> setupContentPane(<%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> nodeShape) {
265
		if (nodeShape.getLayoutManager() == null) {
267
		if (nodeShape.getLayoutManager() == null) {
266
<%
268
<%
267
if (!useFlowLayout) {
269
if (!isXYLayout) {
268
	String layoutClassName = importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout");
270
	String layoutClassName = importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout");
269
%>
271
%>
270
			<%=layoutClassName%> layout = new <%=layoutClassName%>();
272
			<%=layoutClassName%> layout = new <%=layoutClassName%>();
Lines 676-681 Link Here
676
	if (!outgoingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
678
	if (!outgoingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
677
		continue;
679
		continue;
678
	}
680
	}
681
	GenLinkConstraints linkConstraints = genLink.getCreationConstraints();
679
%>
682
%>
680
	/**
683
	/**
681
	 * @generated
684
	 * @generated
Lines 757-762 Link Here
757
<%
760
<%
758
				}
761
				}
759
			}
762
			}
763
{
764
	String _source = "source.getElement()";
765
	String _target = "null";
766
%>
767
<%@ include file="linkConstraints.jetinc"%>
768
<%
769
}	//local declarations for linkConstraints.jetinc
760
%>
770
%>
761
			return true;
771
			return true;
762
<%
772
<%
Lines 774-779 Link Here
774
<%@ include file="linkMultiplicity.jetinc"%>
784
<%@ include file="linkMultiplicity.jetinc"%>
775
<%
785
<%
776
		}
786
		}
787
{
788
	String _source = "source.getElement()";
789
	String _target = "null";
790
%>
791
<%@ include file="linkConstraints.jetinc"%>
792
<%
793
}	//local declarations for linkConstraints.jetinc
777
%>
794
%>
778
			return true;
795
			return true;
779
<%
796
<%
Lines 833-838 Link Here
833
	if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
850
	if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
834
		continue;
851
		continue;
835
	}
852
	}
853
	GenLinkConstraints linkConstraints = genLink.getCreationConstraints();
836
%>
854
%>
837
	/**
855
	/**
838
	 * @generated
856
	 * @generated
Lines 1005-1011 Link Here
1005
		 * @generated
1023
		 * @generated
1006
		 */
1024
		 */
1007
		public boolean canExecute() {
1025
		public boolean canExecute() {
1008
			return source != null && target != null && createdEdge != null && domainModelAddCommand != null && domainModelAddCommand.canExecute();
1026
			if (source == null || target == null || createdEdge == null || domainModelAddCommand == null || !domainModelAddCommand.canExecute()) {
1027
				return false;
1028
			}
1029
<%
1030
{
1031
	String _source = "source.getElement()";
1032
	String _target = "target.getElement()";
1033
%>
1034
<%@ include file="linkConstraints.jetinc"%>
1035
<%
1036
}	//local declarations for linkConstraints.jetinc
1037
%>
1038
			return true;
1009
		}
1039
		}
1010
		/**
1040
		/**
1011
		 * @generated
1041
		 * @generated
(-)templates/editor/VisualIDRegistry.javajet (-113 / +85 lines)
Lines 1-11 Link Here
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.editor" class="VisualIDRegistryGenerator"
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.editor" class="VisualIDRegistryGenerator"
2
	imports="org.eclipse.gmf.codegen.gmfgen.* java.util.* org.eclipse.gmf.common.codegen.*"%>
2
	imports="org.eclipse.gmf.codegen.gmfgen.* java.util.* org.eclipse.gmf.common.codegen.* org.eclipse.emf.codegen.ecore.genmodel.*"%>
3
<%
3
<%
4
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
4
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
5
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
5
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
6
%>
6
%>
7
<%@ include file="../copyright4java.jetinc"%>
7
<%@ include file="../copyright4java.jetinc"%>
8
<%importManager.emitPackageStatement(stringBuffer);
8
<%importManager.emitPackageStatement(stringBuffer);
9
10
final String matcherClassName = "Matcher";
11
final String javaMatcherContainer = "JavaMatchers";
12
importManager.registerInnerClass(matcherClassName);
13
importManager.registerInnerClass(javaMatcherContainer);
14
9
importManager.addImport("org.eclipse.emf.ecore.EClass");
15
importManager.addImport("org.eclipse.emf.ecore.EClass");
10
importManager.addImport("org.eclipse.emf.ecore.EObject");
16
importManager.addImport("org.eclipse.emf.ecore.EObject");
11
importManager.addImport("org.eclipse.gmf.runtime.notation.View");
17
importManager.addImport("org.eclipse.gmf.runtime.notation.View");
Lines 23-28 Link Here
23
 */
29
 */
24
public class <%=genDiagram.getVisualIDRegistryClassName()%> {
30
public class <%=genDiagram.getVisualIDRegistryClassName()%> {
25
31
32
	/**
33
	 * @generated
34
	 */
26
	public static final <%=genDiagram.getVisualIDRegistryClassName()%> INSTANCE = new <%=genDiagram.getVisualIDRegistryClassName()%>();
35
	public static final <%=genDiagram.getVisualIDRegistryClassName()%> INSTANCE = new <%=genDiagram.getVisualIDRegistryClassName()%>();
27
36
28
	/**
37
	/**
Lines 212-222 Link Here
212
	}
221
	}
213
222
214
<%
223
<%
215
String acceptAllMatcherAccessor = "acceptAllMatcher()"; //$NON-NLS-1$
216
for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) {
224
for (Iterator nodes = genDiagram.getAllNodes().iterator(); nodes.hasNext();) {
217
	GenNode nextNode = (GenNode) nodes.next();
225
	GenNode nextNode = (GenNode) nodes.next();
218
	String qualifiedChildNodeInterfaceName = nextNode.getDomainMetaClass().getQualifiedInterfaceName();
226
	if (nextNode.getModelFacet() == null) {
219
	String childNodeSelector = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null ? nextNode.getUniqueIdentifier() : acceptAllMatcherAccessor;
227
		continue;
228
	}
229
	String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName());
230
	boolean callMatcher = nextNode.getModelFacet() != null && nextNode.getModelFacet().getModelElementSelector() != null;
220
%>
231
%>
221
232
222
	/**
233
	/**
Lines 225-233 Link Here
225
	 *
236
	 *
226
	 * @generated
237
	 * @generated
227
	 */
238
	 */
228
	private boolean isNode<%=nextNode.getUniqueIdentifier()%>(<%=importManager.getImportedName(qualifiedChildNodeInterfaceName)%> element) {
239
	private boolean isNode<%=nextNode.getUniqueIdentifier()%>(<%=childNodeInterfaceName%> element) {
229
		return ElementSelectors.<%=childNodeSelector%>.matches(element);
240
		return <%if (callMatcher) {%><%=nextNode.getUniqueIdentifier()%>.matches(element)<%} else {%>true<%}%>;
230
	}	
241
	}
231
<%
242
<%
232
}
243
}
233
for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) {
244
for (Iterator containers = nodeContainers.iterator(); containers.hasNext();) {
Lines 263-269 Link Here
263
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
274
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
264
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
275
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
265
		String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
276
		String interfaceName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
266
		String linkSelector = modelFacet.getModelElementSelector() != null ? genLink.getUniqueIdentifier() : acceptAllMatcherAccessor;		
277
		boolean callMatcher = modelFacet.getModelElementSelector() != null;		
267
%>
278
%>
268
279
269
	/**
280
	/**
Lines 273-292 Link Here
273
	 * @generated
284
	 * @generated
274
	 */
285
	 */
275
	private boolean isLinkWithClass<%=genLink.getUniqueIdentifier()%>(<%=interfaceName%> element) {
286
	private boolean isLinkWithClass<%=genLink.getUniqueIdentifier()%>(<%=interfaceName%> element) {
276
		return ElementSelectors.<%=linkSelector%>.matches(element);
287
		return <%if (callMatcher) {%><%=genLink.getUniqueIdentifier()%>.matches(element)<%} else {%>true<%}%>;
277
	}
288
	}
278
<%
289
<%
279
	}
290
	}
280
}
291
}
281
%>
282
292
283
	/**
293
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
284
	 * @generated
294
final List javaSelectorFacets = new ArrayList();
285
	 */
295
final Map __exprEnvVariables = Collections.EMPTY_MAP;
286
	private static class ElementSelectors {	
296
final String __outEnvVarName = null; // no custom env
287
<%
297
final String __javaOperationContainer = javaMatcherContainer; // put method here
298
288
int selectorCounter = 0;
299
int selectorCounter = 0;
289
for (Iterator it = genDiagram.eAllContents(); it.hasNext();) {
300
for (Iterator it = genDiagram.eAllContents(); it.hasNext() && expressionProviders != null;) {
290
	Object next = it.next();
301
	Object next = it.next();
291
	String id = null;
302
	String id = null;
292
	TypeModelFacet modelFacet = null;
303
	TypeModelFacet modelFacet = null;
Lines 297-413 Link Here
297
		id = ((GenLink) next).getUniqueIdentifier();
308
		id = ((GenLink) next).getUniqueIdentifier();
298
		modelFacet = (TypeLinkModelFacet) ((GenLink) next).getModelFacet();
309
		modelFacet = (TypeLinkModelFacet) ((GenLink) next).getModelFacet();
299
	}
310
	}
300
	if (modelFacet == null || modelFacet.getModelElementSelector() == null) {
311
	if (modelFacet == null || modelFacet.getModelElementSelector() == null || modelFacet.getMetaClass() == null) {
301
		continue;
312
		continue;
302
	}
313
	}
303
	GenConstraint selector = modelFacet.getModelElementSelector();
314
	GenConstraint selector = modelFacet.getModelElementSelector();
304
	selectorCounter++;
315
	selectorCounter++;
316
	// setup expression factory
317
	ValueExpression __genValueExpression = selector;
318
	GenClassifier __genExprContext = modelFacet.getMetaClass();
319
	GenExpressionProviderBase expressionProvider = expressionProviders.getProvider(__genValueExpression); 
320
	if(expressionProvider instanceof GenJavaExpressionProvider && !expressionProviders.isCopy(__genValueExpression)) {
321
		// skipping duplicates coming from reused node mappings 
322
		javaSelectorFacets.add(modelFacet);
323
	}
305
%>
324
%>
306
325
307
		/**
326
		/**
308
		 * Element matching condition for <%=id%>.
309
		 * <pre>language: <%=selector.getLanguage()%></pre>	
310
		 * <pre>body    : <%=selector.getBody()%></pre>
311
		 * @generated
327
		 * @generated
312
		 */
328
		 */
313
		private static final Matcher <%=id%> = new Matcher("<%=selector.getBody()%>");
329
		private static final <%=matcherClassName%> <%=id%> = new <%=matcherClassName%>(<%@ include file="../expressions/getExpression.jetinc"%>);
314
<%}%>
330
<%
315
		
331
} /* end of selector interation */
316
		/**
332
317
		 * @generated
333
if(selectorCounter > 0) { %>			
318
		 */
334
319
		private ElementSelectors() {
335
	/**
320
		}
336
	 * @generated
321
<%if(selectorCounter > 0) { %>			
337
	 */
322
		/**
338
	static class <%=matcherClassName%> {
323
		* @generated	
324
		*/
325
		static class Matcher {
326
	
327
			/**
328
			* @generated	
329
			*/					
330
			private EClass evalContext;
331
	
332
			/**
333
			* @generated	
334
			*/						
335
			private <%=importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition")%> condition;
336
	
339
	
337
			/**
340
		/**
338
			* @generated	
341
		 * @generated	
339
			*/						
342
		 */					
340
			private String body;		
343
		private <%=importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())%> condition;
341
					
344
					
342
			/**
343
			* @generated	
344
			*/				
345
			Matcher(String expressionBody) {			
346
				body = expressionBody;
347
			}
348
	
349
			/**
350
			* @generated	
351
			*/						
352
			boolean matches(EObject object) {		
353
				try {
354
					Boolean result = (object != null) ? evaluate(object) : Boolean.FALSE;
355
					return result.booleanValue();
356
				} catch(IllegalArgumentException e) {
357
					<%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.getInstance().logError(null, e);
358
					return false;
359
				}
360
			}
361
	
362
			/**
363
			* @generated	
364
			*/		
365
			private Boolean evaluate(EObject context) {
366
				this.evalContext = context.eClass();
367
				if(condition == null) {					
368
					condition = new <%=importManager.getImportedName("org.eclipse.emf.query.ocl.conditions.OCLConstraintCondition")%>(body, evalContext);
369
				}
370
				if(condition != null) {
371
					return booleanCast(condition.evaluate(context));
372
				}
373
				return Boolean.FALSE;
374
			}
375
	
376
			/**
377
			* @generated	
378
			*/					
379
			private static Boolean booleanCast(Object value) {
380
				if(value == null) {
381
					return null;
382
				} else if(value instanceof Boolean) {
383
					 return (Boolean)value;	
384
				}
385
				return Boolean.FALSE;
386
			}
387
		} // end of Matcher
388
<%}%>		
389
		/**
345
		/**
390
		 * @generated
346
		 * @generated	
391
		 */
347
		 */				
392
		static class AcceptAllMatcher {
348
		<%=matcherClassName%>(<%=importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())%> conditionExpression) {			
393
			/**
349
			this.condition = conditionExpression;
394
			 * @generated
395
			 */		
396
			static final AcceptAllMatcher INSTANCE = new AcceptAllMatcher();
397
			/**
398
			 * @generated
399
			 */					
400
			boolean matches(Object element) {
401
				return true;
402
			}
403
		}
350
		}
404
		
351
	
405
		/**
352
		/**
406
		 * @generated
353
		 * @generated	
407
		 */		
354
		 */						
408
		static AcceptAllMatcher acceptAllMatcher() {
355
		boolean matches(EObject object) {
409
			return AcceptAllMatcher.INSTANCE;
356
			Object result = condition.evaluate(object);
357
			return result instanceof Boolean && ((Boolean)result).booleanValue();			
410
		}
358
		}
411
	} // end of ElementSelectors
359
	}// <%=matcherClassName%>
360
<%
361
	if(!javaSelectorFacets.isEmpty()) {
362
%>
363
	/**
364
	 * @generated
365
	 */
366
	 private static class <%=javaMatcherContainer%> {
367
<%
368
		for(Iterator it = javaSelectorFacets.iterator(); it.hasNext();) {
369
			TypeModelFacet modelFacet = (TypeModelFacet) it.next();
370
			ValueExpression __genValueExpression = modelFacet.getModelElementSelector();
371
			GenClassifier __genExprContext = modelFacet.getMetaClass();
372
			String __genExprResultType = "java.lang.Boolean"; //$NON-NLS-1$
373
%>
374
<%@ include file="../expressions/javaExpressionOperation.jetinc"%>
375
<%
376
		} /* java javaSelectorFacets iteration */
377
%>
378
	}// <%=javaMatcherContainer%>
379
<%
380
	} /* !javaSelectorFacets.isEmpty() */
381
} /* selectorCounter > 0 */
382
%>
412
}
383
}
384
	
413
<%importManager.emitSortedImports();%>
385
<%importManager.emitSortedImports();%>
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/parts/NodeEditPartGenerator.java (-591 / +675 lines)
Lines 153-485 Link Here
153
  protected final String TEXT_132 = ";";
153
  protected final String TEXT_132 = ";";
154
  protected final String TEXT_133 = NL + "\t\t";
154
  protected final String TEXT_133 = NL + "\t\t";
155
  protected final String TEXT_134 = " figure = new ";
155
  protected final String TEXT_134 = " figure = new ";
156
  protected final String TEXT_135 = "();" + NL + " \t\tfigure.setUseLocalCoordinates(";
156
  protected final String TEXT_135 = "();";
157
  protected final String TEXT_136 = ");" + NL + " \t\tprimaryShape = figure;";
157
  protected final String TEXT_136 = NL + " \t\tfigure.setUseLocalCoordinates(true);";
158
  protected final String TEXT_137 = NL + "\t\treturn primaryShape;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
158
  protected final String TEXT_137 = NL + " \t\tprimaryShape = figure;";
159
  protected final String TEXT_138 = " createDecorationPane() {" + NL + "\t\t";
159
  protected final String TEXT_138 = NL + "\t\treturn primaryShape;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
160
  protected final String TEXT_139 = " view = (";
160
  protected final String TEXT_139 = " createDecorationPane() {" + NL + "\t\t";
161
  protected final String TEXT_140 = ") getModel();" + NL + "\t\t";
161
  protected final String TEXT_140 = " view = (";
162
  protected final String TEXT_141 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t";
162
  protected final String TEXT_141 = ") getModel();" + NL + "\t\t";
163
  protected final String TEXT_142 = " decorationPane = new ";
163
  protected final String TEXT_142 = " annotation = view.getEAnnotation(\"Shortcut\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t";
164
  protected final String TEXT_143 = "();" + NL + "\t\tdecorationPane.setLayoutManager(new ";
164
  protected final String TEXT_143 = " decorationPane = new ";
165
  protected final String TEXT_144 = "());" + NL + "" + NL + "\t\t";
165
  protected final String TEXT_144 = "();" + NL + "\t\tdecorationPane.setLayoutManager(new ";
166
  protected final String TEXT_145 = " imageFigure = new ";
166
  protected final String TEXT_145 = "());" + NL + "" + NL + "\t\t";
167
  protected final String TEXT_146 = "(";
167
  protected final String TEXT_146 = " imageFigure = new ";
168
  protected final String TEXT_147 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"), ";
168
  protected final String TEXT_147 = "(";
169
  protected final String TEXT_148 = ".EAST);" + NL + "\t\tdecorationPane.add(imageFigure, ";
169
  protected final String TEXT_148 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"), ";
170
  protected final String TEXT_149 = ".BOTTOM);" + NL + " \t\treturn decorationPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Default implementation treats passed figure as content pane." + NL + "\t * Respects layout one may have set for generated figure." + NL + "\t * @param nodeShape instance of generated figure class" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
170
  protected final String TEXT_149 = ".EAST);" + NL + "\t\tdecorationPane.add(imageFigure, ";
171
  protected final String TEXT_150 = " setupContentPane(";
171
  protected final String TEXT_150 = ".BOTTOM);" + NL + " \t\treturn decorationPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Default implementation treats passed figure as content pane." + NL + "\t * Respects layout one may have set for generated figure." + NL + "\t * @param nodeShape instance of generated figure class" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
172
  protected final String TEXT_151 = " nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {";
172
  protected final String TEXT_151 = " setupContentPane(";
173
  protected final String TEXT_152 = NL + "\t\t\t";
173
  protected final String TEXT_152 = " nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {";
174
  protected final String TEXT_153 = " layout = new ";
174
  protected final String TEXT_153 = NL + "\t\t\t";
175
  protected final String TEXT_154 = "();" + NL + "\t\t\tlayout.setSpacing(5);" + NL + "\t\t\tnodeShape.setLayoutManager(layout);";
175
  protected final String TEXT_154 = " layout = new ";
176
  protected final String TEXT_155 = NL + "\t\tnodeShape.setLayoutManager(new ";
176
  protected final String TEXT_155 = "();" + NL + "\t\t\tlayout.setSpacing(5);" + NL + "\t\t\tnodeShape.setLayoutManager(layout);";
177
  protected final String TEXT_156 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(";
177
  protected final String TEXT_156 = NL + "\t\tnodeShape.setLayoutManager(new ";
178
  protected final String TEXT_157 = " figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
178
  protected final String TEXT_157 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(";
179
  protected final String TEXT_158 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
179
  protected final String TEXT_158 = " figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
180
  protected final String TEXT_159 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
180
  protected final String TEXT_159 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
181
  protected final String TEXT_160 = " getContentPane() {" + NL + "\t\tif (contentPane == null) {" + NL + "\t\t\treturn super.getContentPane();" + NL + "\t\t}" + NL + "\t\treturn contentPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
181
  protected final String TEXT_160 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
182
  protected final String TEXT_161 = " getDiagramNode() {" + NL + "\t\treturn (";
182
  protected final String TEXT_161 = " getContentPane() {" + NL + "\t\tif (contentPane == null) {" + NL + "\t\t\treturn super.getContentPane();" + NL + "\t\t}" + NL + "\t\treturn contentPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
183
  protected final String TEXT_162 = ") getModel();" + NL + "\t}" + NL;
183
  protected final String TEXT_162 = " getDiagramNode() {" + NL + "\t\treturn (";
184
  protected final String TEXT_163 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean addFixedChild(";
184
  protected final String TEXT_163 = ") getModel();" + NL + "\t}" + NL;
185
  protected final String TEXT_164 = " childEditPart) {";
185
  protected final String TEXT_164 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean addFixedChild(";
186
  protected final String TEXT_165 = NL + "\t\tif (childEditPart instanceof ";
186
  protected final String TEXT_165 = " childEditPart) {";
187
  protected final String TEXT_166 = ") {";
187
  protected final String TEXT_166 = NL + "\t\tif (childEditPart instanceof ";
188
  protected final String TEXT_167 = NL + "\t\t\t((";
188
  protected final String TEXT_167 = ") {";
189
  protected final String TEXT_168 = ") childEditPart).setLabel(((";
189
  protected final String TEXT_168 = NL + "\t\t\t((";
190
  protected final String TEXT_169 = ") primaryShape).getFigure";
190
  protected final String TEXT_169 = ") childEditPart).setLabel(((";
191
  protected final String TEXT_170 = "());";
191
  protected final String TEXT_170 = ") primaryShape).getFigure";
192
  protected final String TEXT_171 = NL + "\t\t\t((";
192
  protected final String TEXT_171 = "());";
193
  protected final String TEXT_172 = ") childEditPart).setLabel(new ";
193
  protected final String TEXT_172 = NL + "\t\t\t((";
194
  protected final String TEXT_173 = "());";
194
  protected final String TEXT_173 = ") childEditPart).setLabel(new ";
195
  protected final String TEXT_174 = NL + "\t\t\treturn true;" + NL + "\t\t}";
195
  protected final String TEXT_174 = "());";
196
  protected final String TEXT_175 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns the label which should be direct-edited by default." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
196
  protected final String TEXT_175 = NL + "\t\t\treturn true;" + NL + "\t\t}";
197
  protected final String TEXT_176 = " getPrimaryLabelEditPart() {";
197
  protected final String TEXT_176 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns the label which should be direct-edited by default." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
198
  protected final String TEXT_177 = NL + "\t\tfor(";
198
  protected final String TEXT_177 = " getPrimaryLabelEditPart() {";
199
  protected final String TEXT_178 = " it = getDiagramNode().getChildren().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
199
  protected final String TEXT_178 = NL + "\t\tfor(";
200
  protected final String TEXT_179 = " nextChild = (";
200
  protected final String TEXT_179 = " it = getDiagramNode().getChildren().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
201
  protected final String TEXT_180 = ")it.next();" + NL + "\t\t\tif (";
201
  protected final String TEXT_180 = " nextChild = (";
202
  protected final String TEXT_181 = ".getVisualID(nextChild) == ";
202
  protected final String TEXT_181 = ")it.next();" + NL + "\t\t\tif (";
203
  protected final String TEXT_182 = ".VISUAL_ID) {" + NL + "\t\t\t\treturn (";
203
  protected final String TEXT_182 = ".getVisualID(nextChild) == ";
204
  protected final String TEXT_183 = ") getViewer().getEditPartRegistry().get(nextChild);" + NL + "\t\t\t}" + NL + "\t\t}";
204
  protected final String TEXT_183 = ".VISUAL_ID) {" + NL + "\t\t\t\treturn (";
205
  protected final String TEXT_184 = NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void performRequest(";
205
  protected final String TEXT_184 = ") getViewer().getEditPartRegistry().get(nextChild);" + NL + "\t\t\t}" + NL + "\t\t}";
206
  protected final String TEXT_185 = " req) {" + NL + "\t\tif (";
206
  protected final String TEXT_185 = NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void performRequest(";
207
  protected final String TEXT_186 = ".REQ_DIRECT_EDIT == req.getType()) {" + NL + "\t\t\t";
207
  protected final String TEXT_186 = " req) {" + NL + "\t\tif (";
208
  protected final String TEXT_187 = " labelToEdit;" + NL + "\t\t\tif (req instanceof ";
208
  protected final String TEXT_187 = ".REQ_DIRECT_EDIT == req.getType()) {" + NL + "\t\t\t";
209
  protected final String TEXT_188 = ") {" + NL + "\t\t\t\tlabelToEdit = getLabelEditPart((";
209
  protected final String TEXT_188 = " labelToEdit;" + NL + "\t\t\tif (req instanceof ";
210
  protected final String TEXT_189 = ")req);" + NL + "\t\t\t} else {" + NL + "\t\t\t\tlabelToEdit = getPrimaryLabelEditPart();" + NL + "\t\t\t}" + NL + "\t\t\tif (labelToEdit != null) {" + NL + "\t\t\t\tlabelToEdit.performRequest(req);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
210
  protected final String TEXT_189 = ") {" + NL + "\t\t\t\tlabelToEdit = getLabelEditPart((";
211
  protected final String TEXT_190 = " getLabelEditPart(";
211
  protected final String TEXT_190 = ")req);" + NL + "\t\t\t} else {" + NL + "\t\t\t\tlabelToEdit = getPrimaryLabelEditPart();" + NL + "\t\t\t}" + NL + "\t\t\tif (labelToEdit != null) {" + NL + "\t\t\t\tlabelToEdit.performRequest(req);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
212
  protected final String TEXT_191 = " req) {" + NL + "\t\t";
212
  protected final String TEXT_191 = " getLabelEditPart(";
213
  protected final String TEXT_192 = " result = getViewer().findObjectAt(req.getLocation());" + NL + "\t\tif (result != null) {" + NL + "\t\t\t";
213
  protected final String TEXT_192 = " req) {" + NL + "\t\t";
214
  protected final String TEXT_193 = " view = (";
214
  protected final String TEXT_193 = " result = getViewer().findObjectAt(req.getLocation());" + NL + "\t\tif (result != null) {" + NL + "\t\t\t";
215
  protected final String TEXT_194 = ") result.getModel();" + NL + "\t\t\tif (getDiagramNode().getChildren().contains(view)) {" + NL + "\t\t\t\tint visualId = ";
215
  protected final String TEXT_194 = " view = (";
216
  protected final String TEXT_195 = ".getVisualID(view);" + NL + "\t\t\t\tswitch (visualId) {";
216
  protected final String TEXT_195 = ") result.getModel();" + NL + "\t\t\tif (getDiagramNode().getChildren().contains(view)) {" + NL + "\t\t\t\tint visualId = ";
217
  protected final String TEXT_196 = NL + "\t\t\t\tcase ";
217
  protected final String TEXT_196 = ".getVisualID(view);" + NL + "\t\t\t\tswitch (visualId) {";
218
  protected final String TEXT_197 = ".VISUAL_ID:" + NL + "\t\t\t\t\treturn result;";
218
  protected final String TEXT_197 = NL + "\t\t\t\tcase ";
219
  protected final String TEXT_198 = NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn getPrimaryLabelEditPart();" + NL + "\t}" + NL;
219
  protected final String TEXT_198 = ".VISUAL_ID:" + NL + "\t\t\t\t\treturn result;";
220
  protected final String TEXT_199 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
220
  protected final String TEXT_199 = NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn getPrimaryLabelEditPart();" + NL + "\t}" + NL;
221
  protected final String TEXT_200 = " childEditPart, int index) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t";
221
  protected final String TEXT_200 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
222
  protected final String TEXT_201 = " labelFigure = ((";
222
  protected final String TEXT_201 = " childEditPart, int index) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t";
223
  protected final String TEXT_202 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t} else {";
223
  protected final String TEXT_202 = " labelFigure = ((";
224
  protected final String TEXT_203 = NL + "\t\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t\t}";
224
  protected final String TEXT_203 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t} else {";
225
  protected final String TEXT_204 = NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);";
225
  protected final String TEXT_204 = NL + "\t\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t\t}";
226
  protected final String TEXT_205 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual(";
226
  protected final String TEXT_205 = NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);";
227
  protected final String TEXT_206 = " childEditPart) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t";
227
  protected final String TEXT_206 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual(";
228
  protected final String TEXT_207 = " labelFigure = ((";
228
  protected final String TEXT_207 = " childEditPart) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t";
229
  protected final String TEXT_208 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t} else {" + NL + "\t\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel(";
229
  protected final String TEXT_208 = " labelFigure = ((";
230
  protected final String TEXT_209 = " childEditPart) {";
230
  protected final String TEXT_209 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t} else {" + NL + "\t\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel(";
231
  protected final String TEXT_210 = NL + "\t\tif (childEditPart instanceof ";
231
  protected final String TEXT_210 = " childEditPart) {";
232
  protected final String TEXT_211 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}";
232
  protected final String TEXT_211 = NL + "\t\tif (childEditPart instanceof ";
233
  protected final String TEXT_212 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
233
  protected final String TEXT_212 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}";
234
  protected final String TEXT_213 = " getExternalLabelsContainer() {" + NL + "\t\t";
234
  protected final String TEXT_213 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
235
  protected final String TEXT_214 = " root = (";
235
  protected final String TEXT_214 = " getExternalLabelsContainer() {" + NL + "\t\t";
236
  protected final String TEXT_215 = ") getRoot();" + NL + "\t\treturn root.getLayer(";
236
  protected final String TEXT_215 = " root = (";
237
  protected final String TEXT_216 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL;
237
  protected final String TEXT_216 = ") getRoot();" + NL + "\t\treturn root.getLayer(";
238
  protected final String TEXT_217 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
238
  protected final String TEXT_217 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL;
239
  protected final String TEXT_218 = " childEditPart, int index) {" + NL + "\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t}" + NL + "\t}";
239
  protected final String TEXT_218 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
240
  protected final String TEXT_219 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshBounds();" + NL + "\t\trefreshBackgroundColor();" + NL + "\t\trefreshForegroundColor();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshVisibility();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisibility() {" + NL + "\t\tboolean isVisible = getDiagramNode().isVisible();" + NL + "\t\tboolean wasVisible = getFigure().isVisible();" + NL + "\t\tif (isVisible == wasVisible) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (!isVisible && (getSelected() != SELECTED_NONE)) {" + NL + "\t\t\tgetViewer().deselect(this);" + NL + "\t\t}" + NL + "" + NL + "\t\tgetFigure().setVisible(isVisible);" + NL + "\t\tgetFigure().revalidate();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshBounds() {" + NL + "\t\t";
240
  protected final String TEXT_219 = " childEditPart, int index) {" + NL + "\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t}" + NL + "\t}";
241
  protected final String TEXT_220 = " node = getDiagramNode();" + NL + "\t\tassert node.getLayoutConstraint() instanceof ";
241
  protected final String TEXT_220 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "\t\trefreshBounds();" + NL + "\t\trefreshBackgroundColor();" + NL + "\t\trefreshForegroundColor();" + NL + "\t\trefreshFont();" + NL + "\t\trefreshVisibility();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisibility() {" + NL + "\t\tboolean isVisible = getDiagramNode().isVisible();" + NL + "\t\tboolean wasVisible = getFigure().isVisible();" + NL + "\t\tif (isVisible == wasVisible) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (!isVisible && (getSelected() != SELECTED_NONE)) {" + NL + "\t\t\tgetViewer().deselect(this);" + NL + "\t\t}" + NL + "" + NL + "\t\tgetFigure().setVisible(isVisible);" + NL + "\t\tgetFigure().revalidate();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshBounds() {" + NL + "\t\t";
242
  protected final String TEXT_221 = ";" + NL + "\t\t";
242
  protected final String TEXT_221 = " node = getDiagramNode();" + NL + "\t\tassert node.getLayoutConstraint() instanceof ";
243
  protected final String TEXT_222 = " bounds = (";
243
  protected final String TEXT_222 = ";" + NL + "\t\t";
244
  protected final String TEXT_223 = ") node.getLayoutConstraint();" + NL + "\t\t((";
244
  protected final String TEXT_223 = " bounds = (";
245
  protected final String TEXT_224 = ") getParent()).setLayoutConstraint(this, getFigure(), " + NL + "\t\t\tnew ";
245
  protected final String TEXT_224 = ") node.getLayoutConstraint();" + NL + "\t\t((";
246
  protected final String TEXT_225 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
246
  protected final String TEXT_225 = ") getParent()).setLayoutConstraint(this, getFigure(), " + NL + "\t\t\tnew ";
247
  protected final String TEXT_226 = " getModelChildren() {" + NL + "\t\treturn getDiagramNode().getVisibleChildren();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
247
  protected final String TEXT_226 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
248
  protected final String TEXT_227 = " getModelSourceConnections() {" + NL + "\t\treturn getDiagramNode().getSourceEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
248
  protected final String TEXT_227 = " getModelChildren() {" + NL + "\t\treturn getDiagramNode().getVisibleChildren();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
249
  protected final String TEXT_228 = " getModelTargetConnections() {" + NL + "\t\treturn getDiagramNode().getTargetEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
249
  protected final String TEXT_228 = " getModelSourceConnections() {" + NL + "\t\treturn getDiagramNode().getSourceEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
250
  protected final String TEXT_229 = " getSourceConnectionAnchor(";
250
  protected final String TEXT_229 = " getModelTargetConnections() {" + NL + "\t\treturn getDiagramNode().getTargetEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
251
  protected final String TEXT_230 = " connection) {" + NL + "\t\treturn new ";
251
  protected final String TEXT_230 = " getSourceConnectionAnchor(";
252
  protected final String TEXT_231 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
252
  protected final String TEXT_231 = " connection) {" + NL + "\t\treturn new ";
253
  protected final String TEXT_232 = " getSourceConnectionAnchor(";
253
  protected final String TEXT_232 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
254
  protected final String TEXT_233 = " request) {" + NL + "\t\treturn new ";
254
  protected final String TEXT_233 = " getSourceConnectionAnchor(";
255
  protected final String TEXT_234 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
255
  protected final String TEXT_234 = " request) {" + NL + "\t\treturn new ";
256
  protected final String TEXT_235 = "  getTargetConnectionAnchor(";
256
  protected final String TEXT_235 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
257
  protected final String TEXT_236 = " connection) {" + NL + "\t\treturn new ";
257
  protected final String TEXT_236 = "  getTargetConnectionAnchor(";
258
  protected final String TEXT_237 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
258
  protected final String TEXT_237 = " connection) {" + NL + "\t\treturn new ";
259
  protected final String TEXT_238 = "  getTargetConnectionAnchor(";
259
  protected final String TEXT_238 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
260
  protected final String TEXT_239 = " request) {" + NL + "\t\treturn new ";
260
  protected final String TEXT_239 = "  getTargetConnectionAnchor(";
261
  protected final String TEXT_240 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key) {";
261
  protected final String TEXT_240 = " request) {" + NL + "\t\treturn new ";
262
  protected final String TEXT_241 = NL + "\t\treturn super.getAdapter(key);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void activate() {" + NL + "\t\tsuper.activate();" + NL + "\t\tgetDiagramNode().getElement().eAdapters().add(domainModelRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void deactivate() {" + NL + "\t\tgetDiagramNode().getElement().eAdapters().remove(domainModelRefresher);" + NL + "\t\tsuper.deactivate();" + NL + "\t}" + NL;
262
  protected final String TEXT_241 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key) {";
263
  protected final String TEXT_242 = NL;
263
  protected final String TEXT_242 = NL + "\t\treturn super.getAdapter(key);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void activate() {" + NL + "\t\tsuper.activate();" + NL + "\t\tgetDiagramNode().getElement().eAdapters().add(domainModelRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void deactivate() {" + NL + "\t\tgetDiagramNode().getElement().eAdapters().remove(domainModelRefresher);" + NL + "\t\tsuper.deactivate();" + NL + "\t}" + NL;
264
  protected final String TEXT_243 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate DomainModelRefresher domainModelRefresher = new DomainModelRefresher();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class DomainModelRefresher extends ";
264
  protected final String TEXT_243 = NL;
265
  protected final String TEXT_244 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
265
  protected final String TEXT_244 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate DomainModelRefresher domainModelRefresher = new DomainModelRefresher();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class DomainModelRefresher extends ";
266
  protected final String TEXT_245 = " msg) {" + NL + "\t\t\tsuper.notifyChanged(msg);" + NL + "\t\t\tif (msg.isTouch()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tRefresher refresher = getRefresher((";
266
  protected final String TEXT_245 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
267
  protected final String TEXT_246 = ") msg.getFeature(), msg);" + NL + "\t\t\tif (refresher != null) {" + NL + "\t\t\t\trefresher.refresh();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL;
267
  protected final String TEXT_246 = " msg) {" + NL + "\t\t\tsuper.notifyChanged(msg);" + NL + "\t\t\tif (msg.isTouch()) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tRefresher refresher = getRefresher((";
268
  protected final String TEXT_247 = NL;
268
  protected final String TEXT_247 = ") msg.getFeature(), msg);" + NL + "\t\t\tif (refresher != null) {" + NL + "\t\t\t\trefresher.refresh();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL;
269
  protected final String TEXT_248 = "\tpublic void addRefresher(";
269
  protected final String TEXT_248 = NL;
270
  protected final String TEXT_249 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tpublic void removeRefresher(";
270
  protected final String TEXT_249 = "\tpublic void addRefresher(";
271
  protected final String TEXT_250 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
271
  protected final String TEXT_250 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tpublic void removeRefresher(";
272
  protected final String TEXT_251 = " feature) {" + NL + "\t\tif (structuralFeatures2Refresher == null) {" + NL + "\t\t\tcreateRefreshers();" + NL + "\t\t}" + NL + "\t\tRefresher refresher = (Refresher) structuralFeatures2Refresher.get(feature);" + NL + "\t\tif (refresher instanceof CompositeRefresher) {" + NL + "\t\t\treturn (CompositeRefresher) refresher;" + NL + "\t\t}" + NL + "\t\tCompositeRefresher result = new CompositeRefresher();" + NL + "\t\tif (refresher != null) {" + NL + "\t\t\tresult.addRefresher(refresher);" + NL + "\t\t}" + NL + "\t\tstructuralFeatures2Refresher.put(feature, result);" + NL + "\t\treturn result;" + NL + "\t}" + NL;
272
  protected final String TEXT_251 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
273
  protected final String TEXT_252 = NL;
273
  protected final String TEXT_252 = " feature) {" + NL + "\t\tif (structuralFeatures2Refresher == null) {" + NL + "\t\t\tcreateRefreshers();" + NL + "\t\t}" + NL + "\t\tRefresher refresher = (Refresher) structuralFeatures2Refresher.get(feature);" + NL + "\t\tif (refresher instanceof CompositeRefresher) {" + NL + "\t\t\treturn (CompositeRefresher) refresher;" + NL + "\t\t}" + NL + "\t\tCompositeRefresher result = new CompositeRefresher();" + NL + "\t\tif (refresher != null) {" + NL + "\t\t\tresult.addRefresher(refresher);" + NL + "\t\t}" + NL + "\t\tstructuralFeatures2Refresher.put(feature, result);" + NL + "\t\treturn result;" + NL + "\t}" + NL;
274
  protected final String TEXT_253 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshFont() {" + NL + "\t\t";
274
  protected final String TEXT_253 = NL;
275
  protected final String TEXT_254 = " style =" + NL + "\t\t\t(";
275
  protected final String TEXT_254 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshFont() {" + NL + "\t\t";
276
  protected final String TEXT_255 = ") ";
276
  protected final String TEXT_255 = " style =" + NL + "\t\t\t(";
277
  protected final String TEXT_256 = ".getStyle(" + NL + "\t\t\t\t";
277
  protected final String TEXT_256 = ") ";
278
  protected final String TEXT_257 = ".eINSTANCE.getFontStyle());" + NL + "\t\t";
278
  protected final String TEXT_257 = ".getStyle(" + NL + "\t\t\t\t";
279
  protected final String TEXT_258 = " toDispose = createdFont;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tString fontName = style.getFontName();" + NL + "\t\t\tint fontHeight = style.getFontHeight();" + NL + "\t\t\tint fontStyle = ";
279
  protected final String TEXT_258 = ".eINSTANCE.getFontStyle());" + NL + "\t\t";
280
  protected final String TEXT_259 = ".NORMAL;" + NL + "\t\t\tif (style.isBold()) {" + NL + "\t\t\t\tfontStyle |= ";
280
  protected final String TEXT_259 = " toDispose = createdFont;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tString fontName = style.getFontName();" + NL + "\t\t\tint fontHeight = style.getFontHeight();" + NL + "\t\t\tint fontStyle = ";
281
  protected final String TEXT_260 = ".BOLD;" + NL + "\t\t\t}" + NL + "\t\t\tif (style.isItalic()) {" + NL + "\t\t\t\tfontStyle |= ";
281
  protected final String TEXT_260 = ".NORMAL;" + NL + "\t\t\tif (style.isBold()) {" + NL + "\t\t\t\tfontStyle |= ";
282
  protected final String TEXT_261 = ".ITALIC;" + NL + "\t\t\t}" + NL + "\t\t\t";
282
  protected final String TEXT_261 = ".BOLD;" + NL + "\t\t\t}" + NL + "\t\t\tif (style.isItalic()) {" + NL + "\t\t\t\tfontStyle |= ";
283
  protected final String TEXT_262 = " currentFont = getFigure().getFont();" + NL + "\t\t\tif (currentFont != null) {" + NL + "\t\t\t\t";
283
  protected final String TEXT_262 = ".ITALIC;" + NL + "\t\t\t}" + NL + "\t\t\t";
284
  protected final String TEXT_263 = " currentFontData = currentFont.getFontData()[0];" + NL + "\t\t\t\tif (currentFontData.getName().equals(fontName) && currentFontData.getHeight() == fontHeight && currentFontData.getStyle() == fontStyle) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tcreatedFont = new ";
284
  protected final String TEXT_263 = " currentFont = getFigure().getFont();" + NL + "\t\t\tif (currentFont != null) {" + NL + "\t\t\t\t";
285
  protected final String TEXT_264 = "(null, fontName, fontHeight, fontStyle);" + NL + "\t\t\tgetFigure().setFont(createdFont);" + NL + "\t\t} else {" + NL + "\t\t\t//revert to the default font" + NL + "\t\t\tgetFigure().setFont(getViewer().getControl().getFont());" + NL + "\t\t\tcreatedFont = null;" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The font (created by {@link #refreshFont()}) currently assigned to the label (unless the default font is assigned)." + NL + "\t * Whenever another non-default font is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
285
  protected final String TEXT_264 = " currentFontData = currentFont.getFontData()[0];" + NL + "\t\t\t\tif (currentFontData.getName().equals(fontName) && currentFontData.getHeight() == fontHeight && currentFontData.getStyle() == fontStyle) {" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tcreatedFont = new ";
286
  protected final String TEXT_265 = " createdFont;" + NL;
286
  protected final String TEXT_265 = "(null, fontName, fontHeight, fontStyle);" + NL + "\t\t\tgetFigure().setFont(createdFont);" + NL + "\t\t} else {" + NL + "\t\t\t//revert to the default font" + NL + "\t\t\tgetFigure().setFont(getViewer().getControl().getFont());" + NL + "\t\t\tcreatedFont = null;" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The font (created by {@link #refreshFont()}) currently assigned to the label (unless the default font is assigned)." + NL + "\t * Whenever another non-default font is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
287
  protected final String TEXT_266 = NL;
287
  protected final String TEXT_266 = " createdFont;" + NL;
288
  protected final String TEXT_267 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshForegroundColor() {" + NL + "\t\t";
288
  protected final String TEXT_267 = NL;
289
  protected final String TEXT_268 = " style = (";
289
  protected final String TEXT_268 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshForegroundColor() {" + NL + "\t\t";
290
  protected final String TEXT_269 = ")  ";
290
  protected final String TEXT_269 = " style = (";
291
  protected final String TEXT_270 = ".getStyle(";
291
  protected final String TEXT_270 = ")  ";
292
  protected final String TEXT_271 = ".eINSTANCE.getLineStyle());" + NL + "\t\t";
292
  protected final String TEXT_271 = ".getStyle(";
293
  protected final String TEXT_272 = " toDispose = createdForegroundColor;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tint foregroundColor = style.getLineColor();" + NL + "\t\t\tint red = foregroundColor & 0x000000FF;" + NL + "\t\t\tint green = (foregroundColor & 0x0000FF00) >> 8;" + NL + "\t\t\tint blue = (foregroundColor & 0x00FF0000) >> 16;" + NL + "\t\t\t";
293
  protected final String TEXT_272 = ".eINSTANCE.getLineStyle());" + NL + "\t\t";
294
  protected final String TEXT_273 = " currentColor = getFigure().getForegroundColor();" + NL + "\t\t\tif (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedForegroundColor = new ";
294
  protected final String TEXT_273 = " toDispose = createdForegroundColor;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tint foregroundColor = style.getLineColor();" + NL + "\t\t\tint red = foregroundColor & 0x000000FF;" + NL + "\t\t\tint green = (foregroundColor & 0x0000FF00) >> 8;" + NL + "\t\t\tint blue = (foregroundColor & 0x00FF0000) >> 16;" + NL + "\t\t\t";
295
  protected final String TEXT_274 = "(null, red, green, blue);" + NL + "\t\t\tgetFigure().setForegroundColor(createdForegroundColor);" + NL + "\t\t} else {" + NL + "\t\t\tgetFigure().setForegroundColor(getViewer().getControl().getForeground());" + NL + "\t\t\tcreatedForegroundColor = null;" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The color (created by {@link #refreshForegroundColor()}) currently assigned to the figure." + NL + "\t * Whenever another color is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
295
  protected final String TEXT_274 = " currentColor = getFigure().getForegroundColor();" + NL + "\t\t\tif (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedForegroundColor = new ";
296
  protected final String TEXT_275 = " createdForegroundColor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshBackgroundColor() {" + NL + "\t\t";
296
  protected final String TEXT_275 = "(null, red, green, blue);" + NL + "\t\t\tgetFigure().setForegroundColor(createdForegroundColor);" + NL + "\t\t} else {" + NL + "\t\t\tgetFigure().setForegroundColor(getViewer().getControl().getForeground());" + NL + "\t\t\tcreatedForegroundColor = null;" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The color (created by {@link #refreshForegroundColor()}) currently assigned to the figure." + NL + "\t * Whenever another color is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
297
  protected final String TEXT_276 = " style = (";
297
  protected final String TEXT_276 = " createdForegroundColor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshBackgroundColor() {" + NL + "\t\t";
298
  protected final String TEXT_277 = ")  ";
298
  protected final String TEXT_277 = " style = (";
299
  protected final String TEXT_278 = ".getStyle(";
299
  protected final String TEXT_278 = ")  ";
300
  protected final String TEXT_279 = ".eINSTANCE.getFillStyle());" + NL + "\t\t";
300
  protected final String TEXT_279 = ".getStyle(";
301
  protected final String TEXT_280 = " toDispose = createdBackgroundColor;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tint backgroundColor = style.getFillColor();" + NL + "\t\t\tint red = backgroundColor & 0x000000FF;" + NL + "\t\t\tint green = (backgroundColor & 0x0000FF00) >> 8;" + NL + "\t\t\tint blue = (backgroundColor & 0x00FF0000) >> 16;" + NL + "\t\t\t";
301
  protected final String TEXT_280 = ".eINSTANCE.getFillStyle());" + NL + "\t\t";
302
  protected final String TEXT_281 = " currentColor = getFigure().getBackgroundColor();" + NL + "\t\t\tif (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedBackgroundColor = new ";
302
  protected final String TEXT_281 = " toDispose = createdBackgroundColor;" + NL + "\t\tif (style != null) {" + NL + "\t\t\tint backgroundColor = style.getFillColor();" + NL + "\t\t\tint red = backgroundColor & 0x000000FF;" + NL + "\t\t\tint green = (backgroundColor & 0x0000FF00) >> 8;" + NL + "\t\t\tint blue = (backgroundColor & 0x00FF0000) >> 16;" + NL + "\t\t\t";
303
  protected final String TEXT_282 = "(null, red, green, blue);" + NL + "\t\t\tgetFigure().setBackgroundColor(createdBackgroundColor);" + NL + "\t\t} else {" + NL + "\t\t\tgetFigure().setBackgroundColor(getViewer().getControl().getBackground());" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The color (created by {@link #refreshBackgroundColor()}) currently assigned to the figure." + NL + "\t * Whenever another color is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
303
  protected final String TEXT_282 = " currentColor = getFigure().getBackgroundColor();" + NL + "\t\t\tif (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedBackgroundColor = new ";
304
  protected final String TEXT_283 = " createdBackgroundColor;" + NL;
304
  protected final String TEXT_283 = "(null, red, green, blue);" + NL + "\t\t\tgetFigure().setBackgroundColor(createdBackgroundColor);" + NL + "\t\t} else {" + NL + "\t\t\tgetFigure().setBackgroundColor(getViewer().getControl().getBackground());" + NL + "\t\t}" + NL + "\t\tif (toDispose != null) {" + NL + "\t\t\ttoDispose.dispose();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The color (created by {@link #refreshBackgroundColor()}) currently assigned to the figure." + NL + "\t * Whenever another color is assigned to it, it is safe to dispose the previous one." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
305
  protected final String TEXT_284 = NL;
305
  protected final String TEXT_284 = " createdBackgroundColor;" + NL;
306
  protected final String TEXT_285 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
306
  protected final String TEXT_285 = NL;
307
  protected final String TEXT_286 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
307
  protected final String TEXT_286 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
308
  protected final String TEXT_287 = " feature, ";
308
  protected final String TEXT_287 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
309
  protected final String TEXT_288 = " msg) {" + NL + "\t\tif (structuralFeatures2Refresher == null) {" + NL + "\t\t\tcreateRefreshers();" + NL + "\t\t}" + NL + "\t\treturn (Refresher) structuralFeatures2Refresher.get(feature);" + NL + "\t}" + NL + "" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createRefreshers() {" + NL + "\t\tstructuralFeatures2Refresher = new ";
309
  protected final String TEXT_288 = " feature, ";
310
  protected final String TEXT_289 = "();";
310
  protected final String TEXT_289 = " msg) {" + NL + "\t\tif (structuralFeatures2Refresher == null) {" + NL + "\t\t\tcreateRefreshers();" + NL + "\t\t}" + NL + "\t\treturn (Refresher) structuralFeatures2Refresher.get(feature);" + NL + "\t}" + NL + "" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createRefreshers() {" + NL + "\t\tstructuralFeatures2Refresher = new ";
311
  protected final String TEXT_290 = NL;
311
  protected final String TEXT_290 = "();";
312
  protected final String TEXT_291 = "\t\tRefresher childrenRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshChildren();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
312
  protected final String TEXT_291 = NL;
313
  protected final String TEXT_292 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
313
  protected final String TEXT_292 = "\t\tRefresher childrenRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshChildren();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
314
  protected final String TEXT_293 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);";
314
  protected final String TEXT_293 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
315
  protected final String TEXT_294 = NL;
315
  protected final String TEXT_294 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);";
316
  protected final String TEXT_295 = "\t\tRefresher boundsRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshBounds();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
316
  protected final String TEXT_295 = NL;
317
  protected final String TEXT_296 = ".eINSTANCE.getNode_LayoutConstraint(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
317
  protected final String TEXT_296 = "\t\tRefresher boundsRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshBounds();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
318
  protected final String TEXT_297 = ".eINSTANCE.getSize_Width(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
318
  protected final String TEXT_297 = ".eINSTANCE.getNode_LayoutConstraint(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
319
  protected final String TEXT_298 = ".eINSTANCE.getSize_Height(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
319
  protected final String TEXT_298 = ".eINSTANCE.getSize_Width(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
320
  protected final String TEXT_299 = ".eINSTANCE.getLocation_X(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
320
  protected final String TEXT_299 = ".eINSTANCE.getSize_Height(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
321
  protected final String TEXT_300 = ".eINSTANCE.getLocation_Y(), boundsRefresher);";
321
  protected final String TEXT_300 = ".eINSTANCE.getLocation_X(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
322
  protected final String TEXT_301 = NL;
322
  protected final String TEXT_301 = ".eINSTANCE.getLocation_Y(), boundsRefresher);";
323
  protected final String TEXT_302 = "\t\tRefresher visibilityRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshVisibility();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
323
  protected final String TEXT_302 = NL;
324
  protected final String TEXT_303 = ".eINSTANCE.getView_Visible(), visibilityRefresher);";
324
  protected final String TEXT_303 = "\t\tRefresher visibilityRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshVisibility();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
325
  protected final String TEXT_304 = NL;
325
  protected final String TEXT_304 = ".eINSTANCE.getView_Visible(), visibilityRefresher);";
326
  protected final String TEXT_305 = "\t\tRefresher sourceEdgesRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshSourceConnections();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
326
  protected final String TEXT_305 = NL;
327
  protected final String TEXT_306 = ".eINSTANCE.getView_SourceEdges(), sourceEdgesRefresher);";
327
  protected final String TEXT_306 = "\t\tRefresher sourceEdgesRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshSourceConnections();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
328
  protected final String TEXT_307 = NL;
328
  protected final String TEXT_307 = ".eINSTANCE.getView_SourceEdges(), sourceEdgesRefresher);";
329
  protected final String TEXT_308 = "\t\tRefresher targetEdgesRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshTargetConnections();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
329
  protected final String TEXT_308 = NL;
330
  protected final String TEXT_309 = ".eINSTANCE.getView_TargetEdges(), targetEdgesRefresher);";
330
  protected final String TEXT_309 = "\t\tRefresher targetEdgesRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshTargetConnections();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
331
  protected final String TEXT_310 = NL;
331
  protected final String TEXT_310 = ".eINSTANCE.getView_TargetEdges(), targetEdgesRefresher);";
332
  protected final String TEXT_311 = "\t\tRefresher fontRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshFont();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
332
  protected final String TEXT_311 = NL;
333
  protected final String TEXT_312 = ".eINSTANCE.getFontStyle_FontHeight(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
333
  protected final String TEXT_312 = "\t\tRefresher fontRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshFont();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
334
  protected final String TEXT_313 = ".eINSTANCE.getFontStyle_FontName(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
334
  protected final String TEXT_313 = ".eINSTANCE.getFontStyle_FontHeight(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
335
  protected final String TEXT_314 = ".eINSTANCE.getFontStyle_Bold(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
335
  protected final String TEXT_314 = ".eINSTANCE.getFontStyle_FontName(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
336
  protected final String TEXT_315 = ".eINSTANCE.getFontStyle_Italic(), fontRefresher);" + NL + "\t\t";
336
  protected final String TEXT_315 = ".eINSTANCE.getFontStyle_Bold(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
337
  protected final String TEXT_316 = NL;
337
  protected final String TEXT_316 = ".eINSTANCE.getFontStyle_Italic(), fontRefresher);" + NL + "\t\t";
338
  protected final String TEXT_317 = "\t\tRefresher backgroundColorRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshBackgroundColor();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
338
  protected final String TEXT_317 = NL;
339
  protected final String TEXT_318 = ".eINSTANCE.getFillStyle_FillColor(), backgroundColorRefresher);" + NL + "\t\tRefresher foregroundColorRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshForegroundColor();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
339
  protected final String TEXT_318 = "\t\tRefresher backgroundColorRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshBackgroundColor();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
340
  protected final String TEXT_319 = ".eINSTANCE.getLineStyle_LineColor(), foregroundColorRefresher);" + NL + "\t}" + NL;
340
  protected final String TEXT_319 = ".eINSTANCE.getFillStyle_FillColor(), backgroundColorRefresher);" + NL + "\t\tRefresher foregroundColorRefresher = new Refresher() {" + NL + "\t\t\tpublic void refresh() {" + NL + "\t\t\t\trefreshForegroundColor();" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t\tstructuralFeatures2Refresher.put(";
341
  protected final String TEXT_320 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
341
  protected final String TEXT_320 = ".eINSTANCE.getLineStyle_LineColor(), foregroundColorRefresher);" + NL + "\t}" + NL;
342
  protected final String TEXT_321 = "StartCommand extends ";
342
  protected final String TEXT_321 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
343
  protected final String TEXT_322 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
343
  protected final String TEXT_322 = "StartCommand extends ";
344
  protected final String TEXT_323 = " source;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
344
  protected final String TEXT_323 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
345
  protected final String TEXT_324 = "StartCommand(";
345
  protected final String TEXT_324 = " source;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
346
  protected final String TEXT_325 = ".CreateConnectionRequestEx requestEx) {" + NL + "\t\t\t//Until the mouse button is pressed, the source of the connection is in request.getTargetEditPart(), not in request.getSourceEditPart()." + NL + "\t\t\tsource = (";
346
  protected final String TEXT_325 = "StartCommand(";
347
  protected final String TEXT_326 = ")requestEx.getTargetEditPart().getModel();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean prepare() {" + NL + "\t\t\tif (source == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
347
  protected final String TEXT_326 = ".CreateConnectionRequestEx requestEx) {" + NL + "\t\t\t//Until the mouse button is pressed, the source of the connection is in request.getTargetEditPart(), not in request.getSourceEditPart()." + NL + "\t\t\tsource = (";
348
  protected final String TEXT_327 = NL + "\t\t\treturn false;";
348
  protected final String TEXT_327 = ")requestEx.getTargetEditPart().getModel();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\t//This command never gets executed" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean prepare() {" + NL + "\t\t\tif (source == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
349
  protected final String TEXT_328 = NL + "\t\t\t";
349
  protected final String TEXT_328 = NL + "\t\t\treturn false;";
350
  protected final String TEXT_329 = " container = (";
350
  protected final String TEXT_329 = NL + "\t\t\t";
351
  protected final String TEXT_330 = ")getRelationshipContainer(source.getElement(), ";
351
  protected final String TEXT_330 = " container = (";
352
  protected final String TEXT_331 = ".eINSTANCE.get";
352
  protected final String TEXT_331 = ")getRelationshipContainer(source.getElement(), ";
353
  protected final String TEXT_332 = "());" + NL + "\t\t\tif (container == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
353
  protected final String TEXT_332 = ".eINSTANCE.get";
354
  protected final String TEXT_333 = NL;
354
  protected final String TEXT_333 = "());" + NL + "\t\t\tif (container == null) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
355
  protected final String TEXT_334 = NL + "\t\tif (";
355
  protected final String TEXT_334 = NL;
356
  protected final String TEXT_335 = ".";
356
  protected final String TEXT_335 = NL + "\t\tif (";
357
  protected final String TEXT_336 = "() != null) {" + NL + "\t\t\t";
357
  protected final String TEXT_336 = ".";
358
  protected final String TEXT_337 = NL + "\t\t}";
358
  protected final String TEXT_337 = "() != null) {" + NL + "\t\t\t";
359
  protected final String TEXT_338 = NL + "\t\tif (";
359
  protected final String TEXT_338 = NL + "\t\t}";
360
  protected final String TEXT_339 = ".";
360
  protected final String TEXT_339 = NL + "\t\tif (";
361
  protected final String TEXT_340 = "().size() >= ";
361
  protected final String TEXT_340 = ".";
362
  protected final String TEXT_341 = ".eINSTANCE.get";
362
  protected final String TEXT_341 = "().size() >= ";
363
  protected final String TEXT_342 = ".getUpperBound()) {" + NL + "\t\t\t";
363
  protected final String TEXT_342 = ".eINSTANCE.get";
364
  protected final String TEXT_343 = NL + "\t\t}";
364
  protected final String TEXT_343 = ".getUpperBound()) {" + NL + "\t\t\t";
365
  protected final String TEXT_344 = NL;
365
  protected final String TEXT_344 = NL + "\t\t}";
366
  protected final String TEXT_345 = NL + "\t\tif (";
366
  protected final String TEXT_345 = NL;
367
  protected final String TEXT_346 = ".";
367
  protected final String TEXT_346 = NL + "\t\tif (";
368
  protected final String TEXT_347 = "() != null) {" + NL + "\t\t\t";
368
  protected final String TEXT_347 = ".";
369
  protected final String TEXT_348 = NL + "\t\t}";
369
  protected final String TEXT_348 = "() != null) {" + NL + "\t\t\t";
370
  protected final String TEXT_349 = NL + "\t\tif (";
370
  protected final String TEXT_349 = NL + "\t\t}";
371
  protected final String TEXT_350 = ".";
371
  protected final String TEXT_350 = NL + "\t\tif (";
372
  protected final String TEXT_351 = "().size() >= ";
372
  protected final String TEXT_351 = ".";
373
  protected final String TEXT_352 = ".eINSTANCE.get";
373
  protected final String TEXT_352 = "().size() >= ";
374
  protected final String TEXT_353 = ".getUpperBound()) {" + NL + "\t\t\t";
374
  protected final String TEXT_353 = ".eINSTANCE.get";
375
  protected final String TEXT_354 = NL + "\t\t}";
375
  protected final String TEXT_354 = ".getUpperBound()) {" + NL + "\t\t\t";
376
  protected final String TEXT_355 = NL + "\t\t\treturn true;";
376
  protected final String TEXT_355 = NL + "\t\t}";
377
  protected final String TEXT_356 = NL + "\t\t\t";
377
  protected final String TEXT_356 = NL;
378
  protected final String TEXT_357 = " domainElement = (";
378
  protected final String TEXT_357 = NL + "\t\t\tif(!";
379
  protected final String TEXT_358 = ")source.getElement();";
379
  protected final String TEXT_358 = ".canCreateLink(";
380
  protected final String TEXT_359 = NL;
380
  protected final String TEXT_359 = ", ";
381
  protected final String TEXT_360 = NL + "\t\tif (";
381
  protected final String TEXT_360 = ", false)) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
382
  protected final String TEXT_361 = ".";
382
  protected final String TEXT_361 = NL + "\t\t\treturn true;";
383
  protected final String TEXT_362 = "() != null) {" + NL + "\t\t\t";
383
  protected final String TEXT_362 = NL + "\t\t\t";
384
  protected final String TEXT_363 = NL + "\t\t}";
384
  protected final String TEXT_363 = " domainElement = (";
385
  protected final String TEXT_364 = NL + "\t\tif (";
385
  protected final String TEXT_364 = ")source.getElement();";
386
  protected final String TEXT_365 = ".";
386
  protected final String TEXT_365 = NL;
387
  protected final String TEXT_366 = "().size() >= ";
387
  protected final String TEXT_366 = NL + "\t\tif (";
388
  protected final String TEXT_367 = ".eINSTANCE.get";
388
  protected final String TEXT_367 = ".";
389
  protected final String TEXT_368 = ".getUpperBound()) {" + NL + "\t\t\t";
389
  protected final String TEXT_368 = "() != null) {" + NL + "\t\t\t";
390
  protected final String TEXT_369 = NL + "\t\t}";
390
  protected final String TEXT_369 = NL + "\t\t}";
391
  protected final String TEXT_370 = NL + "\t\t\treturn true;";
391
  protected final String TEXT_370 = NL + "\t\tif (";
392
  protected final String TEXT_371 = NL + "\t\t\treturn false;";
392
  protected final String TEXT_371 = ".";
393
  protected final String TEXT_372 = NL + "\t\t}";
393
  protected final String TEXT_372 = "().size() >= ";
394
  protected final String TEXT_373 = NL + "\t\t/**" + NL + "\t\t * Finds container element for the new relationship of the specified type." + NL + "\t\t * Default implementation goes up by containment hierarchy starting from" + NL + "\t\t * the specified element and returns the first element that is instance of" + NL + "\t\t * the specified container class." + NL + "\t\t * " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
394
  protected final String TEXT_373 = ".eINSTANCE.get";
395
  protected final String TEXT_374 = " getRelationshipContainer(";
395
  protected final String TEXT_374 = ".getUpperBound()) {" + NL + "\t\t\t";
396
  protected final String TEXT_375 = " element, ";
396
  protected final String TEXT_375 = NL + "\t\t}";
397
  protected final String TEXT_376 = " containerClass) {" + NL + "\t\t\tfor (; element != null; element = element.eContainer()) {" + NL + "\t\t\t\tif (containerClass.isSuperTypeOf(element.eClass())) {" + NL + "\t\t\t\t\treturn element;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}";
397
  protected final String TEXT_376 = NL;
398
  protected final String TEXT_377 = NL + NL + "\t}";
398
  protected final String TEXT_377 = NL + "\t\t\tif(!";
399
  protected final String TEXT_378 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
399
  protected final String TEXT_378 = ".canCreateLink(";
400
  protected final String TEXT_379 = "Command extends ";
400
  protected final String TEXT_379 = ", ";
401
  protected final String TEXT_380 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
401
  protected final String TEXT_380 = ", false)) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
402
  protected final String TEXT_381 = " source;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
402
  protected final String TEXT_381 = NL + "\t\t\treturn true;";
403
  protected final String TEXT_382 = " target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
403
  protected final String TEXT_382 = NL + "\t\t\treturn false;";
404
  protected final String TEXT_383 = " createdEdge;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
404
  protected final String TEXT_383 = NL + "\t\t}";
405
  protected final String TEXT_384 = "Command(";
405
  protected final String TEXT_384 = NL + "\t\t/**" + NL + "\t\t * Finds container element for the new relationship of the specified type." + NL + "\t\t * Default implementation goes up by containment hierarchy starting from" + NL + "\t\t * the specified element and returns the first element that is instance of" + NL + "\t\t * the specified container class." + NL + "\t\t * " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
406
  protected final String TEXT_385 = ".CreateConnectionRequestEx requestEx) {" + NL + "\t\t\tif (requestEx.getSourceEditPart().getModel() instanceof ";
406
  protected final String TEXT_385 = " getRelationshipContainer(";
407
  protected final String TEXT_386 = ") {" + NL + "\t\t\t\tsource = (";
407
  protected final String TEXT_386 = " element, ";
408
  protected final String TEXT_387 = ")requestEx.getSourceEditPart().getModel();" + NL + "\t\t\t} else {" + NL + "\t\t\t\tsource = null;" + NL + "\t\t\t}" + NL + "\t\t\tif (requestEx.getTargetEditPart().getModel() instanceof ";
408
  protected final String TEXT_387 = " containerClass) {" + NL + "\t\t\tfor (; element != null; element = element.eContainer()) {" + NL + "\t\t\t\tif (containerClass.isSuperTypeOf(element.eClass())) {" + NL + "\t\t\t\t\treturn element;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}";
409
  protected final String TEXT_388 = ") {" + NL + "\t\t\t\ttarget = (";
409
  protected final String TEXT_388 = NL + NL + "\t}";
410
  protected final String TEXT_389 = ")requestEx.getTargetEditPart().getModel();" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttarget = null;" + NL + "\t\t\t}" + NL + "\t\t\tif (source == null || target == null) {" + NL + "\t\t\t\tcreatedEdge = null;" + NL + "\t\t\t\tdomainModelAddCommand = ";
410
  protected final String TEXT_389 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
411
  protected final String TEXT_390 = ".INSTANCE;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedEdge = ";
411
  protected final String TEXT_390 = "Command extends ";
412
  protected final String TEXT_391 = ".eINSTANCE.createEdge();";
412
  protected final String TEXT_391 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
413
  protected final String TEXT_392 = NL + "\t\t\t";
413
  protected final String TEXT_392 = " source;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
414
  protected final String TEXT_393 = " createdDomainElement = ";
414
  protected final String TEXT_393 = " target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
415
  protected final String TEXT_394 = ".eINSTANCE.create";
415
  protected final String TEXT_394 = " createdEdge;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
416
  protected final String TEXT_395 = "();" + NL + "\t\t\tcreatedEdge.setElement(createdDomainElement);" + NL + "\t\t\t";
416
  protected final String TEXT_395 = "Command(";
417
  protected final String TEXT_396 = NL + "\t\t\t";
417
  protected final String TEXT_396 = ".CreateConnectionRequestEx requestEx) {" + NL + "\t\t\tif (requestEx.getSourceEditPart().getModel() instanceof ";
418
  protected final String TEXT_397 = ".";
418
  protected final String TEXT_397 = ") {" + NL + "\t\t\t\tsource = (";
419
  protected final String TEXT_398 = ".initializeElement(createdDomainElement);";
419
  protected final String TEXT_398 = ")requestEx.getSourceEditPart().getModel();" + NL + "\t\t\t} else {" + NL + "\t\t\t\tsource = null;" + NL + "\t\t\t}" + NL + "\t\t\tif (requestEx.getTargetEditPart().getModel() instanceof ";
420
  protected final String TEXT_399 = NL + "\t\t\tcreatedEdge.setElement(target.getElement());\t\t//XXX: is this correct?";
420
  protected final String TEXT_399 = ") {" + NL + "\t\t\t\ttarget = (";
421
  protected final String TEXT_400 = NL + "\t\t\t";
421
  protected final String TEXT_400 = ")requestEx.getTargetEditPart().getModel();" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttarget = null;" + NL + "\t\t\t}" + NL + "\t\t\tif (source == null || target == null) {" + NL + "\t\t\t\tcreatedEdge = null;" + NL + "\t\t\t\tdomainModelAddCommand = ";
422
  protected final String TEXT_401 = ".decorateView(createdEdge);" + NL + "\t\t\t";
422
  protected final String TEXT_401 = ".INSTANCE;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedEdge = ";
423
  protected final String TEXT_402 = " domainModelEditDomain = ";
423
  protected final String TEXT_402 = ".eINSTANCE.createEdge();";
424
  protected final String TEXT_403 = ".getEditingDomain(source.getDiagram().getElement());";
424
  protected final String TEXT_403 = NL + "\t\t\t";
425
  protected final String TEXT_404 = NL + "\t\t\torg.eclipse.emf.common.command.CompoundCommand addLinkEndsCommand = new org.eclipse.emf.common.command.CompoundCommand();";
425
  protected final String TEXT_404 = " createdDomainElement = ";
426
  protected final String TEXT_405 = NL + "\t\t\t";
426
  protected final String TEXT_405 = ".eINSTANCE.create";
427
  protected final String TEXT_406 = " container = getRelationshipContainer(source.getElement(), ";
427
  protected final String TEXT_406 = "();" + NL + "\t\t\tcreatedEdge.setElement(createdDomainElement);" + NL + "\t\t\t";
428
  protected final String TEXT_407 = ".eINSTANCE.get";
428
  protected final String TEXT_407 = NL + "\t\t\t";
429
  protected final String TEXT_408 = "());" + NL + "\t\t\tif (container == null) {" + NL + "\t\t\t\tdomainModelAddCommand = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\taddLinkEndsCommand.append(";
429
  protected final String TEXT_408 = ".";
430
  protected final String TEXT_409 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcontainer, ";
430
  protected final String TEXT_409 = ".initializeElement(createdDomainElement);";
431
  protected final String TEXT_410 = ".eINSTANCE.get";
431
  protected final String TEXT_410 = NL + "\t\t\tcreatedEdge.setElement(target.getElement());\t\t//XXX: is this correct?";
432
  protected final String TEXT_411 = "(), createdDomainElement));";
432
  protected final String TEXT_411 = NL + "\t\t\t";
433
  protected final String TEXT_412 = NL + "\t\t\taddLinkEndsCommand.append(";
433
  protected final String TEXT_412 = ".decorateView(createdEdge);" + NL + "\t\t\t";
434
  protected final String TEXT_413 = ".create(domainModelEditDomain," + NL + "\t\t\t\tcontainer, ";
434
  protected final String TEXT_413 = " domainModelEditDomain = ";
435
  protected final String TEXT_414 = ".eINSTANCE.get";
435
  protected final String TEXT_414 = ".getEditingDomain(source.getDiagram().getElement());";
436
  protected final String TEXT_415 = "(), createdDomainElement));";
436
  protected final String TEXT_415 = NL + "\t\t\torg.eclipse.emf.common.command.CompoundCommand addLinkEndsCommand = new org.eclipse.emf.common.command.CompoundCommand();";
437
  protected final String TEXT_416 = NL;
437
  protected final String TEXT_416 = NL + "\t\t\t";
438
  protected final String TEXT_417 = NL + "\t\tif (";
438
  protected final String TEXT_417 = " container = getRelationshipContainer(source.getElement(), ";
439
  protected final String TEXT_418 = ".";
439
  protected final String TEXT_418 = ".eINSTANCE.get";
440
  protected final String TEXT_419 = "() != null) {" + NL + "\t\t\t";
440
  protected final String TEXT_419 = "());" + NL + "\t\t\tif (container == null) {" + NL + "\t\t\t\tdomainModelAddCommand = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\taddLinkEndsCommand.append(";
441
  protected final String TEXT_420 = NL + "\t\t}";
441
  protected final String TEXT_420 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcontainer, ";
442
  protected final String TEXT_421 = NL + "\t\tif (";
442
  protected final String TEXT_421 = ".eINSTANCE.get";
443
  protected final String TEXT_422 = ".";
443
  protected final String TEXT_422 = "(), createdDomainElement));";
444
  protected final String TEXT_423 = "().size() >= ";
444
  protected final String TEXT_423 = NL + "\t\t\taddLinkEndsCommand.append(";
445
  protected final String TEXT_424 = ".eINSTANCE.get";
445
  protected final String TEXT_424 = ".create(domainModelEditDomain," + NL + "\t\t\t\tcontainer, ";
446
  protected final String TEXT_425 = ".getUpperBound()) {" + NL + "\t\t\t";
446
  protected final String TEXT_425 = ".eINSTANCE.get";
447
  protected final String TEXT_426 = NL + "\t\t}";
447
  protected final String TEXT_426 = "(), createdDomainElement));";
448
  protected final String TEXT_427 = NL + "\t\t\taddLinkEndsCommand.append(";
448
  protected final String TEXT_427 = NL;
449
  protected final String TEXT_428 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, ";
449
  protected final String TEXT_428 = NL + "\t\tif (";
450
  protected final String TEXT_429 = ".eINSTANCE.get";
450
  protected final String TEXT_429 = ".";
451
  protected final String TEXT_430 = "(), source.getElement()));";
451
  protected final String TEXT_430 = "() != null) {" + NL + "\t\t\t";
452
  protected final String TEXT_431 = NL;
452
  protected final String TEXT_431 = NL + "\t\t}";
453
  protected final String TEXT_432 = NL + "\t\tif (";
453
  protected final String TEXT_432 = NL + "\t\tif (";
454
  protected final String TEXT_433 = ".";
454
  protected final String TEXT_433 = ".";
455
  protected final String TEXT_434 = "() != null) {" + NL + "\t\t\t";
455
  protected final String TEXT_434 = "().size() >= ";
456
  protected final String TEXT_435 = NL + "\t\t}";
456
  protected final String TEXT_435 = ".eINSTANCE.get";
457
  protected final String TEXT_436 = NL + "\t\tif (";
457
  protected final String TEXT_436 = ".getUpperBound()) {" + NL + "\t\t\t";
458
  protected final String TEXT_437 = ".";
458
  protected final String TEXT_437 = NL + "\t\t}";
459
  protected final String TEXT_438 = "().size() >= ";
459
  protected final String TEXT_438 = NL + "\t\t\taddLinkEndsCommand.append(";
460
  protected final String TEXT_439 = ".eINSTANCE.get";
460
  protected final String TEXT_439 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, ";
461
  protected final String TEXT_440 = ".getUpperBound()) {" + NL + "\t\t\t";
461
  protected final String TEXT_440 = ".eINSTANCE.get";
462
  protected final String TEXT_441 = NL + "\t\t}";
462
  protected final String TEXT_441 = "(), source.getElement()));";
463
  protected final String TEXT_442 = NL + "\t\t\taddLinkEndsCommand.append(";
463
  protected final String TEXT_442 = NL;
464
  protected final String TEXT_443 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, ";
464
  protected final String TEXT_443 = NL + "\t\tif (";
465
  protected final String TEXT_444 = ".eINSTANCE.get";
465
  protected final String TEXT_444 = ".";
466
  protected final String TEXT_445 = "(), target.getElement()));";
466
  protected final String TEXT_445 = "() != null) {" + NL + "\t\t\t";
467
  protected final String TEXT_446 = NL + "\t\tdomainModelAddCommand = addLinkEndsCommand;";
467
  protected final String TEXT_446 = NL + "\t\t}";
468
  protected final String TEXT_447 = NL + "\t\t\tdomainModelAddCommand = ";
468
  protected final String TEXT_447 = NL + "\t\tif (";
469
  protected final String TEXT_448 = ".create(domainModelEditDomain, source.getElement(), " + NL + "\t\t\t\t";
469
  protected final String TEXT_448 = ".";
470
  protected final String TEXT_449 = ".eINSTANCE.get";
470
  protected final String TEXT_449 = "().size() >= ";
471
  protected final String TEXT_450 = "(), target.getElement());";
471
  protected final String TEXT_450 = ".eINSTANCE.get";
472
  protected final String TEXT_451 = NL + "\t\t}" + NL;
472
  protected final String TEXT_451 = ".getUpperBound()) {" + NL + "\t\t\t";
473
  protected final String TEXT_452 = NL + "\t\t/**" + NL + "\t\t * Finds container element for the new relationship of the specified type." + NL + "\t\t * Default implementation goes up by containment hierarchy starting from" + NL + "\t\t * the specified element and returns the first element that is instance of" + NL + "\t\t * the specified container class." + NL + "\t\t * " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
473
  protected final String TEXT_452 = NL + "\t\t}";
474
  protected final String TEXT_453 = " getRelationshipContainer(";
474
  protected final String TEXT_453 = NL + "\t\t\taddLinkEndsCommand.append(";
475
  protected final String TEXT_454 = " element, ";
475
  protected final String TEXT_454 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, ";
476
  protected final String TEXT_455 = " containerClass) {" + NL + "\t\t\tfor (; element != null; element = element.eContainer()) {" + NL + "\t\t\t\tif (containerClass.isSuperTypeOf(element.eClass())) {" + NL + "\t\t\t\t\treturn element;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}";
476
  protected final String TEXT_455 = ".eINSTANCE.get";
477
  protected final String TEXT_456 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\treturn source != null && target != null && createdEdge != null && domainModelAddCommand != null && domainModelAddCommand.canExecute();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn source != null && target != null && createdEdge != null && domainModelAddCommand != null && domainModelAddCommand.canUndo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t\tsource.getDiagram().insertEdge(createdEdge);" + NL + "\t\t\tcreatedEdge.setSource(source);" + NL + "\t\t\tcreatedEdge.setTarget(target);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t\tsource.getDiagram().removeEdge(createdEdge);" + NL + "\t\t\tcreatedEdge.setSource(null);" + NL + "\t\t\tcreatedEdge.setTarget(null);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
477
  protected final String TEXT_456 = "(), target.getElement()));";
478
  protected final String TEXT_457 = NL;
478
  protected final String TEXT_457 = NL + "\t\tdomainModelAddCommand = addLinkEndsCommand;";
479
  protected final String TEXT_458 = NL;
479
  protected final String TEXT_458 = NL + "\t\t\tdomainModelAddCommand = ";
480
  protected final String TEXT_459 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MapModeWorkaround {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic int DPtoLP(int dp) {" + NL + "\t\t\treturn dp;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static MapModeWorkaround INSTANCE = new MapModeWorkaround();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate MapModeWorkaround getMapMode() {" + NL + "\t\treturn MapModeWorkaround.INSTANCE;" + NL + "\t}";
480
  protected final String TEXT_459 = ".create(domainModelEditDomain, source.getElement(), " + NL + "\t\t\t\t";
481
  protected final String TEXT_460 = NL + "}";
481
  protected final String TEXT_460 = ".eINSTANCE.get";
482
  protected final String TEXT_461 = NL;
482
  protected final String TEXT_461 = "(), target.getElement());";
483
  protected final String TEXT_462 = NL + "\t\t}" + NL;
484
  protected final String TEXT_463 = NL + "\t\t/**" + NL + "\t\t * Finds container element for the new relationship of the specified type." + NL + "\t\t * Default implementation goes up by containment hierarchy starting from" + NL + "\t\t * the specified element and returns the first element that is instance of" + NL + "\t\t * the specified container class." + NL + "\t\t * " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
485
  protected final String TEXT_464 = " getRelationshipContainer(";
486
  protected final String TEXT_465 = " element, ";
487
  protected final String TEXT_466 = " containerClass) {" + NL + "\t\t\tfor (; element != null; element = element.eContainer()) {" + NL + "\t\t\t\tif (containerClass.isSuperTypeOf(element.eClass())) {" + NL + "\t\t\t\t\treturn element;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}";
488
  protected final String TEXT_467 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\tif (source == null || target == null || createdEdge == null || domainModelAddCommand == null || !domainModelAddCommand.canExecute()) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
489
  protected final String TEXT_468 = NL;
490
  protected final String TEXT_469 = NL + "\t\t\tif(!";
491
  protected final String TEXT_470 = ".canCreateLink(";
492
  protected final String TEXT_471 = ", ";
493
  protected final String TEXT_472 = ", false)) {" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}";
494
  protected final String TEXT_473 = NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn source != null && target != null && createdEdge != null && domainModelAddCommand != null && domainModelAddCommand.canUndo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t\tsource.getDiagram().insertEdge(createdEdge);" + NL + "\t\t\tcreatedEdge.setSource(source);" + NL + "\t\t\tcreatedEdge.setTarget(target);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t\tsource.getDiagram().removeEdge(createdEdge);" + NL + "\t\t\tcreatedEdge.setSource(null);" + NL + "\t\t\tcreatedEdge.setTarget(null);" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
495
  protected final String TEXT_474 = NL;
496
  protected final String TEXT_475 = NL;
497
  protected final String TEXT_476 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class MapModeWorkaround {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic int DPtoLP(int dp) {" + NL + "\t\t\treturn dp;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static MapModeWorkaround INSTANCE = new MapModeWorkaround();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate MapModeWorkaround getMapMode() {" + NL + "\t\treturn MapModeWorkaround.INSTANCE;" + NL + "\t}";
498
  protected final String TEXT_477 = NL + "}";
499
  protected final String TEXT_478 = NL;
483
500
484
  public String generate(Object argument)
501
  public String generate(Object argument)
485
  {
502
  {
Lines 488-494 Link Here
488
GenNode genNode = (GenNode) ((Object[]) argument)[0];
505
GenNode genNode = (GenNode) ((Object[]) argument)[0];
489
GenDiagram genDiagram = genNode.getDiagram();
506
GenDiagram genDiagram = genNode.getDiagram();
490
Palette palette = genDiagram.getPalette();
507
Palette palette = genDiagram.getPalette();
491
boolean useFlowLayout = ViewmapLayoutTypeHelper.getSharedInstance().isStoringChildPositions(genNode);
508
boolean isXYLayout = ViewmapLayoutTypeHelper.getSharedInstance().isStoringChildPositions(genNode);
492
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
509
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
493
510
494
    stringBuffer.append(TEXT_1);
511
    stringBuffer.append(TEXT_1);
Lines 839-845 Link Here
839
    stringBuffer.append(TEXT_127);
856
    stringBuffer.append(TEXT_127);
840
    stringBuffer.append(importManager.getImportedName(figureQualifiedClassName));
857
    stringBuffer.append(importManager.getImportedName(figureQualifiedClassName));
841
    stringBuffer.append(TEXT_128);
858
    stringBuffer.append(TEXT_128);
842
    if (useFlowLayout) {
859
    if (isXYLayout) {
843
    stringBuffer.append(TEXT_129);
860
    stringBuffer.append(TEXT_129);
844
    } /* use flow layout*/ 
861
    } /* use flow layout*/ 
845
    stringBuffer.append(TEXT_130);
862
    stringBuffer.append(TEXT_130);
Lines 855-917 Link Here
855
    stringBuffer.append(TEXT_134);
872
    stringBuffer.append(TEXT_134);
856
    stringBuffer.append(figureQualifiedClassName);
873
    stringBuffer.append(figureQualifiedClassName);
857
    stringBuffer.append(TEXT_135);
874
    stringBuffer.append(TEXT_135);
858
    stringBuffer.append(useFlowLayout ? "true" : "false");
875
    if (!genNode.getChildNodes().isEmpty() && isXYLayout) { /*otherwise, leave to figure's default value*/
859
    stringBuffer.append(TEXT_136);
876
    stringBuffer.append(TEXT_136);
860
    }
877
    }
861
    stringBuffer.append(TEXT_137);
878
    stringBuffer.append(TEXT_137);
862
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
879
    }
863
    stringBuffer.append(TEXT_138);
880
    stringBuffer.append(TEXT_138);
864
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
881
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
865
    stringBuffer.append(TEXT_139);
882
    stringBuffer.append(TEXT_139);
866
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
883
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
867
    stringBuffer.append(TEXT_140);
884
    stringBuffer.append(TEXT_140);
868
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"));
885
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
869
    stringBuffer.append(TEXT_141);
886
    stringBuffer.append(TEXT_141);
870
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
887
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation"));
871
    stringBuffer.append(TEXT_142);
888
    stringBuffer.append(TEXT_142);
872
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
889
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
873
    stringBuffer.append(TEXT_143);
890
    stringBuffer.append(TEXT_143);
874
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout"));
891
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
875
    stringBuffer.append(TEXT_144);
892
    stringBuffer.append(TEXT_144);
876
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure"));
893
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout"));
877
    stringBuffer.append(TEXT_145);
894
    stringBuffer.append(TEXT_145);
878
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure"));
895
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure"));
879
    stringBuffer.append(TEXT_146);
896
    stringBuffer.append(TEXT_146);
880
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
897
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure"));
881
    stringBuffer.append(TEXT_147);
898
    stringBuffer.append(TEXT_147);
882
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.PositionConstants"));
899
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
883
    stringBuffer.append(TEXT_148);
900
    stringBuffer.append(TEXT_148);
884
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout"));
901
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.PositionConstants"));
885
    stringBuffer.append(TEXT_149);
902
    stringBuffer.append(TEXT_149);
886
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
903
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout"));
887
    stringBuffer.append(TEXT_150);
904
    stringBuffer.append(TEXT_150);
888
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
905
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
889
    stringBuffer.append(TEXT_151);
906
    stringBuffer.append(TEXT_151);
907
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
908
    stringBuffer.append(TEXT_152);
890
    
909
    
891
if (!useFlowLayout) {
910
if (!isXYLayout) {
892
	String layoutClassName = importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout");
911
	String layoutClassName = importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout");
893
912
894
    stringBuffer.append(TEXT_152);
895
    stringBuffer.append(layoutClassName);
896
    stringBuffer.append(TEXT_153);
913
    stringBuffer.append(TEXT_153);
897
    stringBuffer.append(layoutClassName);
914
    stringBuffer.append(layoutClassName);
898
    stringBuffer.append(TEXT_154);
915
    stringBuffer.append(TEXT_154);
899
    } else {
916
    stringBuffer.append(layoutClassName);
900
    stringBuffer.append(TEXT_155);
917
    stringBuffer.append(TEXT_155);
901
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
918
    } else {
902
    stringBuffer.append(TEXT_156);
919
    stringBuffer.append(TEXT_156);
903
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
920
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
904
    stringBuffer.append(TEXT_157);
921
    stringBuffer.append(TEXT_157);
905
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
922
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
906
    stringBuffer.append(TEXT_158);
923
    stringBuffer.append(TEXT_158);
907
    }
924
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
908
    stringBuffer.append(TEXT_159);
925
    stringBuffer.append(TEXT_159);
909
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
926
    }
910
    stringBuffer.append(TEXT_160);
927
    stringBuffer.append(TEXT_160);
911
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
928
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
912
    stringBuffer.append(TEXT_161);
929
    stringBuffer.append(TEXT_161);
913
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
930
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
914
    stringBuffer.append(TEXT_162);
931
    stringBuffer.append(TEXT_162);
932
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
933
    stringBuffer.append(TEXT_163);
915
    
934
    
916
	boolean hasFixedChildren = false;
935
	boolean hasFixedChildren = false;
917
	List innerLabels = new ArrayList(genNode.getLabels().size());
936
	List innerLabels = new ArrayList(genNode.getLabels().size());
Lines 924-932 Link Here
924
	if (!innerLabels.isEmpty()) {
943
	if (!innerLabels.isEmpty()) {
925
		hasFixedChildren = true;
944
		hasFixedChildren = true;
926
945
927
    stringBuffer.append(TEXT_163);
928
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
929
    stringBuffer.append(TEXT_164);
946
    stringBuffer.append(TEXT_164);
947
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
948
    stringBuffer.append(TEXT_165);
930
    
949
    
931
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
950
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
932
			GenNodeLabel genLabel = (GenNodeLabel) it.next();
951
			GenNodeLabel genLabel = (GenNodeLabel) it.next();
Lines 945-973 Link Here
945
				isAccessor = false;
964
				isAccessor = false;
946
			}
965
			}
947
966
948
    stringBuffer.append(TEXT_165);
949
    stringBuffer.append(labelEditPart);
950
    stringBuffer.append(TEXT_166);
967
    stringBuffer.append(TEXT_166);
951
    			if (isAccessor) {
952
    stringBuffer.append(TEXT_167);
953
    stringBuffer.append(labelEditPart);
968
    stringBuffer.append(labelEditPart);
969
    stringBuffer.append(TEXT_167);
970
    			if (isAccessor) {
954
    stringBuffer.append(TEXT_168);
971
    stringBuffer.append(TEXT_168);
955
    stringBuffer.append(figureQualifiedClassName);
972
    stringBuffer.append(labelEditPart);
956
    stringBuffer.append(TEXT_169);
973
    stringBuffer.append(TEXT_169);
957
    stringBuffer.append(labelFigureClassName);
974
    stringBuffer.append(figureQualifiedClassName);
958
    stringBuffer.append(TEXT_170);
975
    stringBuffer.append(TEXT_170);
959
    			} else {
976
    stringBuffer.append(labelFigureClassName);
960
    stringBuffer.append(TEXT_171);
977
    stringBuffer.append(TEXT_171);
961
    stringBuffer.append(labelEditPart);
978
    			} else {
962
    stringBuffer.append(TEXT_172);
979
    stringBuffer.append(TEXT_172);
963
    stringBuffer.append(labelFigureClassName);
980
    stringBuffer.append(labelEditPart);
964
    stringBuffer.append(TEXT_173);
981
    stringBuffer.append(TEXT_173);
965
    			}
982
    stringBuffer.append(labelFigureClassName);
966
    stringBuffer.append(TEXT_174);
983
    stringBuffer.append(TEXT_174);
967
    		}
984
    			}
968
    stringBuffer.append(TEXT_175);
985
    stringBuffer.append(TEXT_175);
969
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
986
    		}
970
    stringBuffer.append(TEXT_176);
987
    stringBuffer.append(TEXT_176);
988
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
989
    stringBuffer.append(TEXT_177);
971
    
990
    
972
		GenNodeLabel firstEditableLabel = null;
991
		GenNodeLabel firstEditableLabel = null;
973
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
992
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
Lines 979-1023 Link Here
979
		}
998
		}
980
		if (firstEditableLabel != null) {
999
		if (firstEditableLabel != null) {
981
1000
982
    stringBuffer.append(TEXT_177);
983
    stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
984
    stringBuffer.append(TEXT_178);
1001
    stringBuffer.append(TEXT_178);
985
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1002
    stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
986
    stringBuffer.append(TEXT_179);
1003
    stringBuffer.append(TEXT_179);
987
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1004
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
988
    stringBuffer.append(TEXT_180);
1005
    stringBuffer.append(TEXT_180);
989
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
1006
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
990
    stringBuffer.append(TEXT_181);
1007
    stringBuffer.append(TEXT_181);
991
    stringBuffer.append(importManager.getImportedName(firstEditableLabel.getEditPartQualifiedClassName()));
1008
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
992
    stringBuffer.append(TEXT_182);
1009
    stringBuffer.append(TEXT_182);
993
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1010
    stringBuffer.append(importManager.getImportedName(firstEditableLabel.getEditPartQualifiedClassName()));
994
    stringBuffer.append(TEXT_183);
1011
    stringBuffer.append(TEXT_183);
1012
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1013
    stringBuffer.append(TEXT_184);
995
    
1014
    
996
		}
1015
		}
997
1016
998
    stringBuffer.append(TEXT_184);
999
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1000
    stringBuffer.append(TEXT_185);
1017
    stringBuffer.append(TEXT_185);
1001
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.RequestConstants"));
1018
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1002
    stringBuffer.append(TEXT_186);
1019
    stringBuffer.append(TEXT_186);
1003
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1020
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.RequestConstants"));
1004
    stringBuffer.append(TEXT_187);
1021
    stringBuffer.append(TEXT_187);
1005
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1022
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1006
    stringBuffer.append(TEXT_188);
1023
    stringBuffer.append(TEXT_188);
1007
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1024
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1008
    stringBuffer.append(TEXT_189);
1025
    stringBuffer.append(TEXT_189);
1009
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1010
    stringBuffer.append(TEXT_190);
1011
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1026
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1012
    stringBuffer.append(TEXT_191);
1027
    stringBuffer.append(TEXT_190);
1013
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1028
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1029
    stringBuffer.append(TEXT_191);
1030
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.DirectEditRequest"));
1014
    stringBuffer.append(TEXT_192);
1031
    stringBuffer.append(TEXT_192);
1015
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1032
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1016
    stringBuffer.append(TEXT_193);
1033
    stringBuffer.append(TEXT_193);
1017
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1034
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1018
    stringBuffer.append(TEXT_194);
1035
    stringBuffer.append(TEXT_194);
1019
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
1036
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1020
    stringBuffer.append(TEXT_195);
1037
    stringBuffer.append(TEXT_195);
1038
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
1039
    stringBuffer.append(TEXT_196);
1021
    
1040
    
1022
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
1041
		for (Iterator it = innerLabels.iterator(); it.hasNext(); ) {
1023
			GenNodeLabel genLabel = (GenNodeLabel) it.next();
1042
			GenNodeLabel genLabel = (GenNodeLabel) it.next();
Lines 1025-1037 Link Here
1025
				continue;
1044
				continue;
1026
			}
1045
			}
1027
1046
1028
    stringBuffer.append(TEXT_196);
1029
    stringBuffer.append(importManager.getImportedName(genLabel.getEditPartQualifiedClassName()));
1030
    stringBuffer.append(TEXT_197);
1047
    stringBuffer.append(TEXT_197);
1048
    stringBuffer.append(importManager.getImportedName(genLabel.getEditPartQualifiedClassName()));
1049
    stringBuffer.append(TEXT_198);
1031
    
1050
    
1032
		}
1051
		}
1033
1052
1034
    stringBuffer.append(TEXT_198);
1053
    stringBuffer.append(TEXT_199);
1035
    
1054
    
1036
	}
1055
	}
1037
1056
Lines 1046-1204 Link Here
1046
}
1065
}
1047
if (hasExternalLabels) {
1066
if (hasExternalLabels) {
1048
1067
1049
    stringBuffer.append(TEXT_199);
1050
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1051
    stringBuffer.append(TEXT_200);
1068
    stringBuffer.append(TEXT_200);
1052
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1069
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1053
    stringBuffer.append(TEXT_201);
1070
    stringBuffer.append(TEXT_201);
1054
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1071
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1055
    stringBuffer.append(TEXT_202);
1072
    stringBuffer.append(TEXT_202);
1056
    	if (hasFixedChildren) {
1073
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1057
    stringBuffer.append(TEXT_203);
1074
    stringBuffer.append(TEXT_203);
1058
    	} else {
1075
    	if (hasFixedChildren) {
1059
    stringBuffer.append(TEXT_204);
1076
    stringBuffer.append(TEXT_204);
1060
    	}
1077
    	} else {
1061
    stringBuffer.append(TEXT_205);
1078
    stringBuffer.append(TEXT_205);
1062
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1079
    	}
1063
    stringBuffer.append(TEXT_206);
1080
    stringBuffer.append(TEXT_206);
1064
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1081
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1065
    stringBuffer.append(TEXT_207);
1082
    stringBuffer.append(TEXT_207);
1066
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1083
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1067
    stringBuffer.append(TEXT_208);
1084
    stringBuffer.append(TEXT_208);
1068
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1085
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1069
    stringBuffer.append(TEXT_209);
1086
    stringBuffer.append(TEXT_209);
1087
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1088
    stringBuffer.append(TEXT_210);
1070
    
1089
    
1071
	for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) {
1090
	for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) {
1072
		GenNodeLabel label = (GenNodeLabel) labels.next();
1091
		GenNodeLabel label = (GenNodeLabel) labels.next();
1073
		if (label instanceof GenExternalNodeLabel) {
1092
		if (label instanceof GenExternalNodeLabel) {
1074
1093
1075
    stringBuffer.append(TEXT_210);
1076
    stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName()));
1077
    stringBuffer.append(TEXT_211);
1094
    stringBuffer.append(TEXT_211);
1095
    stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName()));
1096
    stringBuffer.append(TEXT_212);
1078
    
1097
    
1079
		}
1098
		}
1080
	}
1099
	}
1081
1100
1082
    stringBuffer.append(TEXT_212);
1083
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1084
    stringBuffer.append(TEXT_213);
1101
    stringBuffer.append(TEXT_213);
1085
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart"));
1102
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
1086
    stringBuffer.append(TEXT_214);
1103
    stringBuffer.append(TEXT_214);
1087
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart"));
1104
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart"));
1088
    stringBuffer.append(TEXT_215);
1105
    stringBuffer.append(TEXT_215);
1089
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
1106
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart"));
1090
    stringBuffer.append(TEXT_216);
1107
    stringBuffer.append(TEXT_216);
1108
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
1109
    stringBuffer.append(TEXT_217);
1091
    
1110
    
1092
} else {
1111
} else {
1093
	if (hasFixedChildren) {
1112
	if (hasFixedChildren) {
1094
    stringBuffer.append(TEXT_217);
1095
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1096
    stringBuffer.append(TEXT_218);
1113
    stringBuffer.append(TEXT_218);
1114
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1115
    stringBuffer.append(TEXT_219);
1097
    
1116
    
1098
	}
1117
	}
1099
}
1118
}
1100
1119
1101
    stringBuffer.append(TEXT_219);
1102
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
1103
    stringBuffer.append(TEXT_220);
1120
    stringBuffer.append(TEXT_220);
1104
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1121
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
1105
    stringBuffer.append(TEXT_221);
1122
    stringBuffer.append(TEXT_221);
1106
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1123
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1107
    stringBuffer.append(TEXT_222);
1124
    stringBuffer.append(TEXT_222);
1108
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1125
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1109
    stringBuffer.append(TEXT_223);
1126
    stringBuffer.append(TEXT_223);
1110
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1127
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
1111
    stringBuffer.append(TEXT_224);
1128
    stringBuffer.append(TEXT_224);
1112
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
1129
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1113
    stringBuffer.append(TEXT_225);
1130
    stringBuffer.append(TEXT_225);
1114
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1131
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
1115
    stringBuffer.append(TEXT_226);
1132
    stringBuffer.append(TEXT_226);
1116
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1133
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1117
    stringBuffer.append(TEXT_227);
1134
    stringBuffer.append(TEXT_227);
1118
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1135
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1119
    stringBuffer.append(TEXT_228);
1136
    stringBuffer.append(TEXT_228);
1120
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1137
    stringBuffer.append(importManager.getImportedName("java.util.List"));
1121
    stringBuffer.append(TEXT_229);
1138
    stringBuffer.append(TEXT_229);
1122
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart"));
1139
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1123
    stringBuffer.append(TEXT_230);
1140
    stringBuffer.append(TEXT_230);
1124
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1141
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart"));
1125
    stringBuffer.append(TEXT_231);
1142
    stringBuffer.append(TEXT_231);
1126
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1143
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1127
    stringBuffer.append(TEXT_232);
1144
    stringBuffer.append(TEXT_232);
1128
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1145
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1129
    stringBuffer.append(TEXT_233);
1146
    stringBuffer.append(TEXT_233);
1130
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1147
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1131
    stringBuffer.append(TEXT_234);
1148
    stringBuffer.append(TEXT_234);
1132
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1149
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1133
    stringBuffer.append(TEXT_235);
1150
    stringBuffer.append(TEXT_235);
1134
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart"));
1151
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1135
    stringBuffer.append(TEXT_236);
1152
    stringBuffer.append(TEXT_236);
1136
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1153
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart"));
1137
    stringBuffer.append(TEXT_237);
1154
    stringBuffer.append(TEXT_237);
1138
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1155
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1139
    stringBuffer.append(TEXT_238);
1156
    stringBuffer.append(TEXT_238);
1140
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1157
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor"));
1141
    stringBuffer.append(TEXT_239);
1158
    stringBuffer.append(TEXT_239);
1142
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1159
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request"));
1143
    stringBuffer.append(TEXT_240);
1160
    stringBuffer.append(TEXT_240);
1144
    /*@ include file="adapters/propertySource.javajetinc"*/
1161
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor"));
1145
    stringBuffer.append(TEXT_241);
1162
    stringBuffer.append(TEXT_241);
1163
    /*@ include file="adapters/propertySource.javajetinc"*/
1146
    stringBuffer.append(TEXT_242);
1164
    stringBuffer.append(TEXT_242);
1147
    stringBuffer.append(TEXT_243);
1165
    stringBuffer.append(TEXT_243);
1148
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.impl.AdapterImpl"));
1149
    stringBuffer.append(TEXT_244);
1166
    stringBuffer.append(TEXT_244);
1150
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
1167
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.impl.AdapterImpl"));
1151
    stringBuffer.append(TEXT_245);
1168
    stringBuffer.append(TEXT_245);
1152
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1169
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
1153
    stringBuffer.append(TEXT_246);
1170
    stringBuffer.append(TEXT_246);
1171
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1154
    stringBuffer.append(TEXT_247);
1172
    stringBuffer.append(TEXT_247);
1155
    stringBuffer.append(TEXT_248);
1173
    stringBuffer.append(TEXT_248);
1156
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1157
    stringBuffer.append(TEXT_249);
1174
    stringBuffer.append(TEXT_249);
1158
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1175
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1159
    stringBuffer.append(TEXT_250);
1176
    stringBuffer.append(TEXT_250);
1160
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1177
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1161
    stringBuffer.append(TEXT_251);
1178
    stringBuffer.append(TEXT_251);
1179
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1180
    stringBuffer.append(TEXT_252);
1162
    
1181
    
1163
	final String primaryView = "getDiagramNode()";
1182
	final String primaryView = "getDiagramNode()";
1164
1183
1165
    stringBuffer.append(TEXT_252);
1166
    stringBuffer.append(TEXT_253);
1184
    stringBuffer.append(TEXT_253);
1167
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle"));
1168
    stringBuffer.append(TEXT_254);
1185
    stringBuffer.append(TEXT_254);
1169
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle"));
1186
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle"));
1170
    stringBuffer.append(TEXT_255);
1187
    stringBuffer.append(TEXT_255);
1171
    stringBuffer.append(primaryView);
1188
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle"));
1172
    stringBuffer.append(TEXT_256);
1189
    stringBuffer.append(TEXT_256);
1173
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1190
    stringBuffer.append(primaryView);
1174
    stringBuffer.append(TEXT_257);
1191
    stringBuffer.append(TEXT_257);
1175
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1192
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1176
    stringBuffer.append(TEXT_258);
1193
    stringBuffer.append(TEXT_258);
1177
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1194
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1178
    stringBuffer.append(TEXT_259);
1195
    stringBuffer.append(TEXT_259);
1179
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1196
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1180
    stringBuffer.append(TEXT_260);
1197
    stringBuffer.append(TEXT_260);
1181
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1198
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1182
    stringBuffer.append(TEXT_261);
1199
    stringBuffer.append(TEXT_261);
1183
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1200
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT"));
1184
    stringBuffer.append(TEXT_262);
1201
    stringBuffer.append(TEXT_262);
1185
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.FontData"));
1186
    stringBuffer.append(TEXT_263);
1187
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1202
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1203
    stringBuffer.append(TEXT_263);
1204
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.FontData"));
1188
    stringBuffer.append(TEXT_264);
1205
    stringBuffer.append(TEXT_264);
1189
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1206
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1190
    stringBuffer.append(TEXT_265);
1207
    stringBuffer.append(TEXT_265);
1208
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font"));
1191
    stringBuffer.append(TEXT_266);
1209
    stringBuffer.append(TEXT_266);
1192
    stringBuffer.append(TEXT_267);
1210
    stringBuffer.append(TEXT_267);
1193
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle"));
1194
    stringBuffer.append(TEXT_268);
1211
    stringBuffer.append(TEXT_268);
1195
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle"));
1212
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle"));
1196
    stringBuffer.append(TEXT_269);
1213
    stringBuffer.append(TEXT_269);
1197
    stringBuffer.append(primaryView);
1214
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle"));
1198
    stringBuffer.append(TEXT_270);
1215
    stringBuffer.append(TEXT_270);
1199
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1216
    stringBuffer.append(primaryView);
1200
    stringBuffer.append(TEXT_271);
1217
    stringBuffer.append(TEXT_271);
1201
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1218
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1202
    stringBuffer.append(TEXT_272);
1219
    stringBuffer.append(TEXT_272);
1203
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1220
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1204
    stringBuffer.append(TEXT_273);
1221
    stringBuffer.append(TEXT_273);
Lines 1206-1220 Link Here
1206
    stringBuffer.append(TEXT_274);
1223
    stringBuffer.append(TEXT_274);
1207
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1224
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1208
    stringBuffer.append(TEXT_275);
1225
    stringBuffer.append(TEXT_275);
1209
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle"));
1226
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1210
    stringBuffer.append(TEXT_276);
1227
    stringBuffer.append(TEXT_276);
1211
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle"));
1228
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle"));
1212
    stringBuffer.append(TEXT_277);
1229
    stringBuffer.append(TEXT_277);
1213
    stringBuffer.append(primaryView);
1230
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle"));
1214
    stringBuffer.append(TEXT_278);
1231
    stringBuffer.append(TEXT_278);
1215
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1232
    stringBuffer.append(primaryView);
1216
    stringBuffer.append(TEXT_279);
1233
    stringBuffer.append(TEXT_279);
1217
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1234
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1218
    stringBuffer.append(TEXT_280);
1235
    stringBuffer.append(TEXT_280);
1219
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1236
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1220
    stringBuffer.append(TEXT_281);
1237
    stringBuffer.append(TEXT_281);
Lines 1222-1246 Link Here
1222
    stringBuffer.append(TEXT_282);
1239
    stringBuffer.append(TEXT_282);
1223
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1240
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1224
    stringBuffer.append(TEXT_283);
1241
    stringBuffer.append(TEXT_283);
1242
    stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color"));
1225
    stringBuffer.append(TEXT_284);
1243
    stringBuffer.append(TEXT_284);
1226
    stringBuffer.append(TEXT_285);
1244
    stringBuffer.append(TEXT_285);
1227
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
1228
    stringBuffer.append(TEXT_286);
1245
    stringBuffer.append(TEXT_286);
1229
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1246
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
1230
    stringBuffer.append(TEXT_287);
1247
    stringBuffer.append(TEXT_287);
1231
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
1248
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
1232
    stringBuffer.append(TEXT_288);
1249
    stringBuffer.append(TEXT_288);
1233
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
1250
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
1234
    stringBuffer.append(TEXT_289);
1251
    stringBuffer.append(TEXT_289);
1252
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
1235
    stringBuffer.append(TEXT_290);
1253
    stringBuffer.append(TEXT_290);
1236
    stringBuffer.append(TEXT_291);
1254
    stringBuffer.append(TEXT_291);
1237
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1238
    stringBuffer.append(TEXT_292);
1255
    stringBuffer.append(TEXT_292);
1239
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1256
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1240
    stringBuffer.append(TEXT_293);
1257
    stringBuffer.append(TEXT_293);
1258
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1241
    stringBuffer.append(TEXT_294);
1259
    stringBuffer.append(TEXT_294);
1242
    stringBuffer.append(TEXT_295);
1260
    stringBuffer.append(TEXT_295);
1243
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1244
    stringBuffer.append(TEXT_296);
1261
    stringBuffer.append(TEXT_296);
1245
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1262
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1246
    stringBuffer.append(TEXT_297);
1263
    stringBuffer.append(TEXT_297);
Lines 1250-1270 Link Here
1250
    stringBuffer.append(TEXT_299);
1267
    stringBuffer.append(TEXT_299);
1251
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1268
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1252
    stringBuffer.append(TEXT_300);
1269
    stringBuffer.append(TEXT_300);
1270
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1253
    stringBuffer.append(TEXT_301);
1271
    stringBuffer.append(TEXT_301);
1254
    stringBuffer.append(TEXT_302);
1272
    stringBuffer.append(TEXT_302);
1255
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1256
    stringBuffer.append(TEXT_303);
1273
    stringBuffer.append(TEXT_303);
1274
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1257
    stringBuffer.append(TEXT_304);
1275
    stringBuffer.append(TEXT_304);
1258
    stringBuffer.append(TEXT_305);
1276
    stringBuffer.append(TEXT_305);
1259
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1260
    stringBuffer.append(TEXT_306);
1277
    stringBuffer.append(TEXT_306);
1278
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1261
    stringBuffer.append(TEXT_307);
1279
    stringBuffer.append(TEXT_307);
1262
    stringBuffer.append(TEXT_308);
1280
    stringBuffer.append(TEXT_308);
1263
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1264
    stringBuffer.append(TEXT_309);
1281
    stringBuffer.append(TEXT_309);
1282
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1265
    stringBuffer.append(TEXT_310);
1283
    stringBuffer.append(TEXT_310);
1266
    stringBuffer.append(TEXT_311);
1284
    stringBuffer.append(TEXT_311);
1267
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1268
    stringBuffer.append(TEXT_312);
1285
    stringBuffer.append(TEXT_312);
1269
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1286
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1270
    stringBuffer.append(TEXT_313);
1287
    stringBuffer.append(TEXT_313);
Lines 1272-1283 Link Here
1272
    stringBuffer.append(TEXT_314);
1289
    stringBuffer.append(TEXT_314);
1273
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1290
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1274
    stringBuffer.append(TEXT_315);
1291
    stringBuffer.append(TEXT_315);
1292
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1275
    stringBuffer.append(TEXT_316);
1293
    stringBuffer.append(TEXT_316);
1276
    stringBuffer.append(TEXT_317);
1294
    stringBuffer.append(TEXT_317);
1277
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1278
    stringBuffer.append(TEXT_318);
1295
    stringBuffer.append(TEXT_318);
1279
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1296
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1280
    stringBuffer.append(TEXT_319);
1297
    stringBuffer.append(TEXT_319);
1298
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
1299
    stringBuffer.append(TEXT_320);
1281
    /*XXX: probably, this should go to a separate jet-template along with GraphicalNodeEditPolicy*/
1300
    /*XXX: probably, this should go to a separate jet-template along with GraphicalNodeEditPolicy*/
1282
    if (palette != null) {
1301
    if (palette != null) {
1283
    
1302
    
Lines 1304-1377 Link Here
1304
	if (!outgoingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
1323
	if (!outgoingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
1305
		continue;
1324
		continue;
1306
	}
1325
	}
1326
	GenLinkConstraints linkConstraints = genLink.getCreationConstraints();
1307
1327
1308
    stringBuffer.append(TEXT_320);
1328
    stringBuffer.append(TEXT_321);
1309
    stringBuffer.append(createCommandNameInfix);
1329
    stringBuffer.append(createCommandNameInfix);
1310
    stringBuffer.append(genLink.getVisualID());
1330
    stringBuffer.append(genLink.getVisualID());
1311
    stringBuffer.append(TEXT_321);
1312
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
1313
    stringBuffer.append(TEXT_322);
1331
    stringBuffer.append(TEXT_322);
1314
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1332
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
1315
    stringBuffer.append(TEXT_323);
1333
    stringBuffer.append(TEXT_323);
1334
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1335
    stringBuffer.append(TEXT_324);
1316
    stringBuffer.append(createCommandNameInfix);
1336
    stringBuffer.append(createCommandNameInfix);
1317
    stringBuffer.append(genLink.getVisualID());
1337
    stringBuffer.append(genLink.getVisualID());
1318
    stringBuffer.append(TEXT_324);
1319
    stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
1320
    stringBuffer.append(TEXT_325);
1338
    stringBuffer.append(TEXT_325);
1321
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1339
    stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
1322
    stringBuffer.append(TEXT_326);
1340
    stringBuffer.append(TEXT_326);
1341
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1342
    stringBuffer.append(TEXT_327);
1323
    
1343
    
1324
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1344
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1325
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1345
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1326
		GenFeature containmentFeature = modelFacet.getContainmentMetaFeature();
1346
		GenFeature containmentFeature = modelFacet.getContainmentMetaFeature();
1327
		if (containmentFeature == null) {
1347
		if (containmentFeature == null) {
1328
1348
1329
    stringBuffer.append(TEXT_327);
1349
    stringBuffer.append(TEXT_328);
1330
    
1350
    
1331
		} else {
1351
		} else {
1332
1352
1333
    stringBuffer.append(TEXT_328);
1334
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getQualifiedInterfaceName()));
1335
    stringBuffer.append(TEXT_329);
1353
    stringBuffer.append(TEXT_329);
1336
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getQualifiedInterfaceName()));
1354
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getQualifiedInterfaceName()));
1337
    stringBuffer.append(TEXT_330);
1355
    stringBuffer.append(TEXT_330);
1338
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getGenPackage().getQualifiedPackageInterfaceName()));
1356
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getQualifiedInterfaceName()));
1339
    stringBuffer.append(TEXT_331);
1357
    stringBuffer.append(TEXT_331);
1340
    stringBuffer.append(containmentFeature.getGenClass().getClassifierAccessorName());
1358
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getGenPackage().getQualifiedPackageInterfaceName()));
1341
    stringBuffer.append(TEXT_332);
1359
    stringBuffer.append(TEXT_332);
1360
    stringBuffer.append(containmentFeature.getGenClass().getClassifierAccessorName());
1361
    stringBuffer.append(TEXT_333);
1342
    
1362
    
1343
			{
1363
			{
1344
				GenFeature _feature = containmentFeature;
1364
				GenFeature _feature = containmentFeature;
1345
				String _ownerInstance = "container";
1365
				String _ownerInstance = "container";
1346
				String _exceedsUpperBound = "return false;";
1366
				String _exceedsUpperBound = "return false;";
1347
1367
1348
    stringBuffer.append(TEXT_333);
1368
    stringBuffer.append(TEXT_334);
1349
    
1369
    
1350
int upperBound = _feature.getEcoreFeature().getUpperBound();
1370
int upperBound = _feature.getEcoreFeature().getUpperBound();
1351
if (upperBound > 0) {
1371
if (upperBound > 0) {
1352
	if (upperBound == 1) {
1372
	if (upperBound == 1) {
1353
1373
1354
    stringBuffer.append(TEXT_334);
1355
    stringBuffer.append(_ownerInstance);
1356
    stringBuffer.append(TEXT_335);
1374
    stringBuffer.append(TEXT_335);
1357
    stringBuffer.append(_feature.getGetAccessor());
1375
    stringBuffer.append(_ownerInstance);
1358
    stringBuffer.append(TEXT_336);
1376
    stringBuffer.append(TEXT_336);
1359
    stringBuffer.append(_exceedsUpperBound);
1377
    stringBuffer.append(_feature.getGetAccessor());
1360
    stringBuffer.append(TEXT_337);
1378
    stringBuffer.append(TEXT_337);
1379
    stringBuffer.append(_exceedsUpperBound);
1380
    stringBuffer.append(TEXT_338);
1361
    
1381
    
1362
	} else {
1382
	} else {
1363
1383
1364
    stringBuffer.append(TEXT_338);
1365
    stringBuffer.append(_ownerInstance);
1366
    stringBuffer.append(TEXT_339);
1384
    stringBuffer.append(TEXT_339);
1367
    stringBuffer.append(_feature.getGetAccessor());
1385
    stringBuffer.append(_ownerInstance);
1368
    stringBuffer.append(TEXT_340);
1386
    stringBuffer.append(TEXT_340);
1369
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1387
    stringBuffer.append(_feature.getGetAccessor());
1370
    stringBuffer.append(TEXT_341);
1388
    stringBuffer.append(TEXT_341);
1371
    stringBuffer.append(_feature.getFeatureAccessorName());
1389
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1372
    stringBuffer.append(TEXT_342);
1390
    stringBuffer.append(TEXT_342);
1373
    stringBuffer.append(_exceedsUpperBound);
1391
    stringBuffer.append(_feature.getFeatureAccessorName());
1374
    stringBuffer.append(TEXT_343);
1392
    stringBuffer.append(TEXT_343);
1393
    stringBuffer.append(_exceedsUpperBound);
1394
    stringBuffer.append(TEXT_344);
1375
    
1395
    
1376
	}
1396
	}
1377
}
1397
}
Lines 1385-1417 Link Here
1385
					String _ownerInstance = "container";
1405
					String _ownerInstance = "container";
1386
					String _exceedsUpperBound = "return false;";
1406
					String _exceedsUpperBound = "return false;";
1387
1407
1388
    stringBuffer.append(TEXT_344);
1408
    stringBuffer.append(TEXT_345);
1389
    
1409
    
1390
int upperBound = _feature.getEcoreFeature().getUpperBound();
1410
int upperBound = _feature.getEcoreFeature().getUpperBound();
1391
if (upperBound > 0) {
1411
if (upperBound > 0) {
1392
	if (upperBound == 1) {
1412
	if (upperBound == 1) {
1393
1413
1394
    stringBuffer.append(TEXT_345);
1395
    stringBuffer.append(_ownerInstance);
1396
    stringBuffer.append(TEXT_346);
1414
    stringBuffer.append(TEXT_346);
1397
    stringBuffer.append(_feature.getGetAccessor());
1415
    stringBuffer.append(_ownerInstance);
1398
    stringBuffer.append(TEXT_347);
1416
    stringBuffer.append(TEXT_347);
1399
    stringBuffer.append(_exceedsUpperBound);
1417
    stringBuffer.append(_feature.getGetAccessor());
1400
    stringBuffer.append(TEXT_348);
1418
    stringBuffer.append(TEXT_348);
1419
    stringBuffer.append(_exceedsUpperBound);
1420
    stringBuffer.append(TEXT_349);
1401
    
1421
    
1402
	} else {
1422
	} else {
1403
1423
1404
    stringBuffer.append(TEXT_349);
1405
    stringBuffer.append(_ownerInstance);
1406
    stringBuffer.append(TEXT_350);
1424
    stringBuffer.append(TEXT_350);
1407
    stringBuffer.append(_feature.getGetAccessor());
1425
    stringBuffer.append(_ownerInstance);
1408
    stringBuffer.append(TEXT_351);
1426
    stringBuffer.append(TEXT_351);
1409
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1427
    stringBuffer.append(_feature.getGetAccessor());
1410
    stringBuffer.append(TEXT_352);
1428
    stringBuffer.append(TEXT_352);
1411
    stringBuffer.append(_feature.getFeatureAccessorName());
1429
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1412
    stringBuffer.append(TEXT_353);
1430
    stringBuffer.append(TEXT_353);
1413
    stringBuffer.append(_exceedsUpperBound);
1431
    stringBuffer.append(_feature.getFeatureAccessorName());
1414
    stringBuffer.append(TEXT_354);
1432
    stringBuffer.append(TEXT_354);
1433
    stringBuffer.append(_exceedsUpperBound);
1434
    stringBuffer.append(TEXT_355);
1415
    
1435
    
1416
	}
1436
	}
1417
}
1437
}
Lines 1419-1499 Link Here
1419
    
1439
    
1420
				}
1440
				}
1421
			}
1441
			}
1442
{
1443
	String _source = "source.getElement()";
1444
	String _target = "null";
1422
1445
1423
    stringBuffer.append(TEXT_355);
1446
    stringBuffer.append(TEXT_356);
1447
    
1448
			if (linkConstraints != null) {
1449
1450
    stringBuffer.append(TEXT_357);
1451
    stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")+"."+genDiagram.getLinkCreationConstraintsClassName()+"."+linkConstraints.getConstraintsInstanceFieldName());
1452
    stringBuffer.append(TEXT_358);
1453
    stringBuffer.append(_source);
1454
    stringBuffer.append(TEXT_359);
1455
    stringBuffer.append(_target);
1456
    stringBuffer.append(TEXT_360);
1457
    
1458
			}
1459
1460
    
1461
}	//local declarations for linkConstraints.jetinc
1462
1463
    stringBuffer.append(TEXT_361);
1424
    
1464
    
1425
		}
1465
		}
1426
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1466
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1427
		GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature();
1467
		GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature();
1428
1468
1429
    stringBuffer.append(TEXT_356);
1469
    stringBuffer.append(TEXT_362);
1430
    stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
1470
    stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
1431
    stringBuffer.append(TEXT_357);
1471
    stringBuffer.append(TEXT_363);
1432
    stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
1472
    stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
1433
    stringBuffer.append(TEXT_358);
1473
    stringBuffer.append(TEXT_364);
1434
    
1474
    
1435
		{
1475
		{
1436
			GenFeature _feature = metaFeature;
1476
			GenFeature _feature = metaFeature;
1437
			String _ownerInstance = "domainElement";
1477
			String _ownerInstance = "domainElement";
1438
			String _exceedsUpperBound = "return false;";
1478
			String _exceedsUpperBound = "return false;";
1439
1479
1440
    stringBuffer.append(TEXT_359);
1480
    stringBuffer.append(TEXT_365);
1441
    
1481
    
1442
int upperBound = _feature.getEcoreFeature().getUpperBound();
1482
int upperBound = _feature.getEcoreFeature().getUpperBound();
1443
if (upperBound > 0) {
1483
if (upperBound > 0) {
1444
	if (upperBound == 1) {
1484
	if (upperBound == 1) {
1445
1485
1446
    stringBuffer.append(TEXT_360);
1486
    stringBuffer.append(TEXT_366);
1447
    stringBuffer.append(_ownerInstance);
1487
    stringBuffer.append(_ownerInstance);
1448
    stringBuffer.append(TEXT_361);
1488
    stringBuffer.append(TEXT_367);
1449
    stringBuffer.append(_feature.getGetAccessor());
1489
    stringBuffer.append(_feature.getGetAccessor());
1450
    stringBuffer.append(TEXT_362);
1490
    stringBuffer.append(TEXT_368);
1451
    stringBuffer.append(_exceedsUpperBound);
1491
    stringBuffer.append(_exceedsUpperBound);
1452
    stringBuffer.append(TEXT_363);
1492
    stringBuffer.append(TEXT_369);
1453
    
1493
    
1454
	} else {
1494
	} else {
1455
1495
1456
    stringBuffer.append(TEXT_364);
1496
    stringBuffer.append(TEXT_370);
1457
    stringBuffer.append(_ownerInstance);
1497
    stringBuffer.append(_ownerInstance);
1458
    stringBuffer.append(TEXT_365);
1498
    stringBuffer.append(TEXT_371);
1459
    stringBuffer.append(_feature.getGetAccessor());
1499
    stringBuffer.append(_feature.getGetAccessor());
1460
    stringBuffer.append(TEXT_366);
1500
    stringBuffer.append(TEXT_372);
1461
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1501
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1462
    stringBuffer.append(TEXT_367);
1502
    stringBuffer.append(TEXT_373);
1463
    stringBuffer.append(_feature.getFeatureAccessorName());
1503
    stringBuffer.append(_feature.getFeatureAccessorName());
1464
    stringBuffer.append(TEXT_368);
1504
    stringBuffer.append(TEXT_374);
1465
    stringBuffer.append(_exceedsUpperBound);
1505
    stringBuffer.append(_exceedsUpperBound);
1466
    stringBuffer.append(TEXT_369);
1506
    stringBuffer.append(TEXT_375);
1467
    
1507
    
1468
	}
1508
	}
1469
}
1509
}
1470
1510
1471
    
1511
    
1472
		}
1512
		}
1513
{
1514
	String _source = "source.getElement()";
1515
	String _target = "null";
1516
1517
    stringBuffer.append(TEXT_376);
1518
    
1519
			if (linkConstraints != null) {
1520
1521
    stringBuffer.append(TEXT_377);
1522
    stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")+"."+genDiagram.getLinkCreationConstraintsClassName()+"."+linkConstraints.getConstraintsInstanceFieldName());
1523
    stringBuffer.append(TEXT_378);
1524
    stringBuffer.append(_source);
1525
    stringBuffer.append(TEXT_379);
1526
    stringBuffer.append(_target);
1527
    stringBuffer.append(TEXT_380);
1528
    
1529
			}
1473
1530
1474
    stringBuffer.append(TEXT_370);
1531
    
1532
}	//local declarations for linkConstraints.jetinc
1533
1534
    stringBuffer.append(TEXT_381);
1475
    
1535
    
1476
	} else {
1536
	} else {
1477
1537
1478
    stringBuffer.append(TEXT_371);
1538
    stringBuffer.append(TEXT_382);
1479
    
1539
    
1480
	}
1540
	}
1481
1541
1482
    stringBuffer.append(TEXT_372);
1542
    stringBuffer.append(TEXT_383);
1483
    
1543
    
1484
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1544
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1485
1545
1486
    stringBuffer.append(TEXT_373);
1546
    stringBuffer.append(TEXT_384);
1487
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1547
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1488
    stringBuffer.append(TEXT_374);
1548
    stringBuffer.append(TEXT_385);
1489
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1549
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1490
    stringBuffer.append(TEXT_375);
1550
    stringBuffer.append(TEXT_386);
1491
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
1551
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
1492
    stringBuffer.append(TEXT_376);
1552
    stringBuffer.append(TEXT_387);
1493
    
1553
    
1494
	}
1554
	}
1495
1555
1496
    stringBuffer.append(TEXT_377);
1556
    stringBuffer.append(TEXT_388);
1497
    
1557
    
1498
}	//outgoing links
1558
}	//outgoing links
1499
1559
Lines 1519-1590 Link Here
1519
	if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
1579
	if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) {
1520
		continue;
1580
		continue;
1521
	}
1581
	}
1582
	GenLinkConstraints linkConstraints = genLink.getCreationConstraints();
1522
1583
1523
    stringBuffer.append(TEXT_378);
1584
    stringBuffer.append(TEXT_389);
1524
    stringBuffer.append(createCommandNameInfix);
1585
    stringBuffer.append(createCommandNameInfix);
1525
    stringBuffer.append(genLink.getVisualID());
1586
    stringBuffer.append(genLink.getVisualID());
1526
    stringBuffer.append(TEXT_379);
1587
    stringBuffer.append(TEXT_390);
1527
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
1588
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
1528
    stringBuffer.append(TEXT_380);
1589
    stringBuffer.append(TEXT_391);
1529
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1590
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1530
    stringBuffer.append(TEXT_381);
1591
    stringBuffer.append(TEXT_392);
1531
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1592
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1532
    stringBuffer.append(TEXT_382);
1593
    stringBuffer.append(TEXT_393);
1533
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge"));
1594
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge"));
1534
    stringBuffer.append(TEXT_383);
1595
    stringBuffer.append(TEXT_394);
1535
    stringBuffer.append(createCommandNameInfix);
1596
    stringBuffer.append(createCommandNameInfix);
1536
    stringBuffer.append(genLink.getVisualID());
1597
    stringBuffer.append(genLink.getVisualID());
1537
    stringBuffer.append(TEXT_384);
1598
    stringBuffer.append(TEXT_395);
1538
    stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
1599
    stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
1539
    stringBuffer.append(TEXT_385);
1600
    stringBuffer.append(TEXT_396);
1540
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1601
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1541
    stringBuffer.append(TEXT_386);
1602
    stringBuffer.append(TEXT_397);
1542
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1603
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1543
    stringBuffer.append(TEXT_387);
1604
    stringBuffer.append(TEXT_398);
1544
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1605
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1545
    stringBuffer.append(TEXT_388);
1606
    stringBuffer.append(TEXT_399);
1546
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1607
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
1547
    stringBuffer.append(TEXT_389);
1608
    stringBuffer.append(TEXT_400);
1548
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.UnexecutableCommand"));
1609
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.UnexecutableCommand"));
1549
    stringBuffer.append(TEXT_390);
1610
    stringBuffer.append(TEXT_401);
1550
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
1611
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
1551
    stringBuffer.append(TEXT_391);
1612
    stringBuffer.append(TEXT_402);
1552
    
1613
    
1553
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1614
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1554
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1615
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1555
		GenClass linkClass = modelFacet.getMetaClass();
1616
		GenClass linkClass = modelFacet.getMetaClass();
1556
1617
1557
    stringBuffer.append(TEXT_392);
1618
    stringBuffer.append(TEXT_403);
1558
    stringBuffer.append(importManager.getImportedName(importManager.getImportedName(linkClass.getQualifiedInterfaceName())));
1619
    stringBuffer.append(importManager.getImportedName(importManager.getImportedName(linkClass.getQualifiedInterfaceName())));
1559
    stringBuffer.append(TEXT_393);
1620
    stringBuffer.append(TEXT_404);
1560
    stringBuffer.append(importManager.getImportedName(linkClass.getGenPackage().getQualifiedFactoryInterfaceName()));
1621
    stringBuffer.append(importManager.getImportedName(linkClass.getGenPackage().getQualifiedFactoryInterfaceName()));
1561
    stringBuffer.append(TEXT_394);
1622
    stringBuffer.append(TEXT_405);
1562
    stringBuffer.append(linkClass.getClassifierAccessorName());
1623
    stringBuffer.append(linkClass.getClassifierAccessorName());
1563
    stringBuffer.append(TEXT_395);
1624
    stringBuffer.append(TEXT_406);
1564
    /*XXX: Class name DomainElementInitializer should be user-customizable*/
1625
    /*XXX: Class name DomainElementInitializer should be user-customizable*/
1565
    stringBuffer.append(TEXT_396);
1626
    stringBuffer.append(TEXT_407);
1566
    stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
1627
    stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
1567
    stringBuffer.append(TEXT_397);
1628
    stringBuffer.append(TEXT_408);
1568
    stringBuffer.append(genLink.getUniqueIdentifier());
1629
    stringBuffer.append(genLink.getUniqueIdentifier());
1569
    stringBuffer.append(TEXT_398);
1630
    stringBuffer.append(TEXT_409);
1570
    
1631
    
1571
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1632
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1572
1633
1573
    stringBuffer.append(TEXT_399);
1634
    stringBuffer.append(TEXT_410);
1574
    
1635
    
1575
	}
1636
	}
1576
1637
1577
    stringBuffer.append(TEXT_400);
1638
    stringBuffer.append(TEXT_411);
1578
    stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName()));
1639
    stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName()));
1579
    stringBuffer.append(TEXT_401);
1640
    stringBuffer.append(TEXT_412);
1580
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
1641
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
1581
    stringBuffer.append(TEXT_402);
1642
    stringBuffer.append(TEXT_413);
1582
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
1643
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
1583
    stringBuffer.append(TEXT_403);
1644
    stringBuffer.append(TEXT_414);
1584
    
1645
    
1585
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1646
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1586
1647
1587
    stringBuffer.append(TEXT_404);
1648
    stringBuffer.append(TEXT_415);
1588
    
1649
    
1589
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1650
		TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet();
1590
		GenFeature sourceFeature = modelFacet.getSourceMetaFeature();
1651
		GenFeature sourceFeature = modelFacet.getSourceMetaFeature();
Lines 1611-1640 Link Here
1611
				}
1672
				}
1612
			}
1673
			}
1613
1674
1614
    stringBuffer.append(TEXT_405);
1675
    stringBuffer.append(TEXT_416);
1615
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1676
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1616
    stringBuffer.append(TEXT_406);
1677
    stringBuffer.append(TEXT_417);
1617
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getGenPackage().getQualifiedPackageInterfaceName()));
1678
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getGenPackage().getQualifiedPackageInterfaceName()));
1618
    stringBuffer.append(TEXT_407);
1679
    stringBuffer.append(TEXT_418);
1619
    stringBuffer.append(containmentFeature.getGenClass().getClassifierAccessorName());
1680
    stringBuffer.append(containmentFeature.getGenClass().getClassifierAccessorName());
1620
    stringBuffer.append(TEXT_408);
1681
    stringBuffer.append(TEXT_419);
1621
    stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1682
    stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1622
    stringBuffer.append(TEXT_409);
1683
    stringBuffer.append(TEXT_420);
1623
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1684
    stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1624
    stringBuffer.append(TEXT_410);
1685
    stringBuffer.append(TEXT_421);
1625
    stringBuffer.append(containmentFeature.getFeatureAccessorName());
1686
    stringBuffer.append(containmentFeature.getFeatureAccessorName());
1626
    stringBuffer.append(TEXT_411);
1687
    stringBuffer.append(TEXT_422);
1627
    
1688
    
1628
		}
1689
		}
1629
		if (addChild) {
1690
		if (addChild) {
1630
1691
1631
    stringBuffer.append(TEXT_412);
1692
    stringBuffer.append(TEXT_423);
1632
    stringBuffer.append(importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1693
    stringBuffer.append(importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1633
    stringBuffer.append(TEXT_413);
1694
    stringBuffer.append(TEXT_424);
1634
    stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1695
    stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1635
    stringBuffer.append(TEXT_414);
1696
    stringBuffer.append(TEXT_425);
1636
    stringBuffer.append(childFeature.getFeatureAccessorName());
1697
    stringBuffer.append(childFeature.getFeatureAccessorName());
1637
    stringBuffer.append(TEXT_415);
1698
    stringBuffer.append(TEXT_426);
1638
    
1699
    
1639
		}
1700
		}
1640
		if (addSource) {
1701
		if (addSource) {
Lines 1643-1675 Link Here
1643
				String _ownerInstance = "createdDomainElement";
1704
				String _ownerInstance = "createdDomainElement";
1644
				String _exceedsUpperBound = "domainModelAddCommand = null;\nreturn;";
1705
				String _exceedsUpperBound = "domainModelAddCommand = null;\nreturn;";
1645
1706
1646
    stringBuffer.append(TEXT_416);
1707
    stringBuffer.append(TEXT_427);
1647
    
1708
    
1648
int upperBound = _feature.getEcoreFeature().getUpperBound();
1709
int upperBound = _feature.getEcoreFeature().getUpperBound();
1649
if (upperBound > 0) {
1710
if (upperBound > 0) {
1650
	if (upperBound == 1) {
1711
	if (upperBound == 1) {
1651
1712
1652
    stringBuffer.append(TEXT_417);
1713
    stringBuffer.append(TEXT_428);
1653
    stringBuffer.append(_ownerInstance);
1714
    stringBuffer.append(_ownerInstance);
1654
    stringBuffer.append(TEXT_418);
1715
    stringBuffer.append(TEXT_429);
1655
    stringBuffer.append(_feature.getGetAccessor());
1716
    stringBuffer.append(_feature.getGetAccessor());
1656
    stringBuffer.append(TEXT_419);
1717
    stringBuffer.append(TEXT_430);
1657
    stringBuffer.append(_exceedsUpperBound);
1718
    stringBuffer.append(_exceedsUpperBound);
1658
    stringBuffer.append(TEXT_420);
1719
    stringBuffer.append(TEXT_431);
1659
    
1720
    
1660
	} else {
1721
	} else {
1661
1722
1662
    stringBuffer.append(TEXT_421);
1723
    stringBuffer.append(TEXT_432);
1663
    stringBuffer.append(_ownerInstance);
1724
    stringBuffer.append(_ownerInstance);
1664
    stringBuffer.append(TEXT_422);
1725
    stringBuffer.append(TEXT_433);
1665
    stringBuffer.append(_feature.getGetAccessor());
1726
    stringBuffer.append(_feature.getGetAccessor());
1666
    stringBuffer.append(TEXT_423);
1727
    stringBuffer.append(TEXT_434);
1667
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1728
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1668
    stringBuffer.append(TEXT_424);
1729
    stringBuffer.append(TEXT_435);
1669
    stringBuffer.append(_feature.getFeatureAccessorName());
1730
    stringBuffer.append(_feature.getFeatureAccessorName());
1670
    stringBuffer.append(TEXT_425);
1731
    stringBuffer.append(TEXT_436);
1671
    stringBuffer.append(_exceedsUpperBound);
1732
    stringBuffer.append(_exceedsUpperBound);
1672
    stringBuffer.append(TEXT_426);
1733
    stringBuffer.append(TEXT_437);
1673
    
1734
    
1674
	}
1735
	}
1675
}
1736
}
Lines 1677-1689 Link Here
1677
    
1738
    
1678
			}
1739
			}
1679
1740
1680
    stringBuffer.append(TEXT_427);
1741
    stringBuffer.append(TEXT_438);
1681
    stringBuffer.append(importManager.getImportedName(sourceFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1742
    stringBuffer.append(importManager.getImportedName(sourceFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1682
    stringBuffer.append(TEXT_428);
1743
    stringBuffer.append(TEXT_439);
1683
    stringBuffer.append(importManager.getImportedName(sourceFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1744
    stringBuffer.append(importManager.getImportedName(sourceFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1684
    stringBuffer.append(TEXT_429);
1745
    stringBuffer.append(TEXT_440);
1685
    stringBuffer.append(sourceFeature.getFeatureAccessorName());
1746
    stringBuffer.append(sourceFeature.getFeatureAccessorName());
1686
    stringBuffer.append(TEXT_430);
1747
    stringBuffer.append(TEXT_441);
1687
    
1748
    
1688
		}
1749
		}
1689
		if (addTarget) {
1750
		if (addTarget) {
Lines 1692-1724 Link Here
1692
				String _ownerInstance = "createdDomainElement";
1753
				String _ownerInstance = "createdDomainElement";
1693
				String _exceedsUpperBound = "domainModelAddCommand = null;\nreturn;";
1754
				String _exceedsUpperBound = "domainModelAddCommand = null;\nreturn;";
1694
1755
1695
    stringBuffer.append(TEXT_431);
1756
    stringBuffer.append(TEXT_442);
1696
    
1757
    
1697
int upperBound = _feature.getEcoreFeature().getUpperBound();
1758
int upperBound = _feature.getEcoreFeature().getUpperBound();
1698
if (upperBound > 0) {
1759
if (upperBound > 0) {
1699
	if (upperBound == 1) {
1760
	if (upperBound == 1) {
1700
1761
1701
    stringBuffer.append(TEXT_432);
1762
    stringBuffer.append(TEXT_443);
1702
    stringBuffer.append(_ownerInstance);
1763
    stringBuffer.append(_ownerInstance);
1703
    stringBuffer.append(TEXT_433);
1764
    stringBuffer.append(TEXT_444);
1704
    stringBuffer.append(_feature.getGetAccessor());
1765
    stringBuffer.append(_feature.getGetAccessor());
1705
    stringBuffer.append(TEXT_434);
1766
    stringBuffer.append(TEXT_445);
1706
    stringBuffer.append(_exceedsUpperBound);
1767
    stringBuffer.append(_exceedsUpperBound);
1707
    stringBuffer.append(TEXT_435);
1768
    stringBuffer.append(TEXT_446);
1708
    
1769
    
1709
	} else {
1770
	} else {
1710
1771
1711
    stringBuffer.append(TEXT_436);
1772
    stringBuffer.append(TEXT_447);
1712
    stringBuffer.append(_ownerInstance);
1773
    stringBuffer.append(_ownerInstance);
1713
    stringBuffer.append(TEXT_437);
1774
    stringBuffer.append(TEXT_448);
1714
    stringBuffer.append(_feature.getGetAccessor());
1775
    stringBuffer.append(_feature.getGetAccessor());
1715
    stringBuffer.append(TEXT_438);
1776
    stringBuffer.append(TEXT_449);
1716
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1777
    stringBuffer.append(importManager.getImportedName(_feature.getGenPackage().getQualifiedPackageInterfaceName()));
1717
    stringBuffer.append(TEXT_439);
1778
    stringBuffer.append(TEXT_450);
1718
    stringBuffer.append(_feature.getFeatureAccessorName());
1779
    stringBuffer.append(_feature.getFeatureAccessorName());
1719
    stringBuffer.append(TEXT_440);
1780
    stringBuffer.append(TEXT_451);
1720
    stringBuffer.append(_exceedsUpperBound);
1781
    stringBuffer.append(_exceedsUpperBound);
1721
    stringBuffer.append(TEXT_441);
1782
    stringBuffer.append(TEXT_452);
1722
    
1783
    
1723
	}
1784
	}
1724
}
1785
}
Lines 1726-1771 Link Here
1726
    
1787
    
1727
			}
1788
			}
1728
1789
1729
    stringBuffer.append(TEXT_442);
1790
    stringBuffer.append(TEXT_453);
1730
    stringBuffer.append(importManager.getImportedName(targetFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1791
    stringBuffer.append(importManager.getImportedName(targetFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1731
    stringBuffer.append(TEXT_443);
1792
    stringBuffer.append(TEXT_454);
1732
    stringBuffer.append(importManager.getImportedName(targetFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1793
    stringBuffer.append(importManager.getImportedName(targetFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1733
    stringBuffer.append(TEXT_444);
1794
    stringBuffer.append(TEXT_455);
1734
    stringBuffer.append(targetFeature.getFeatureAccessorName());
1795
    stringBuffer.append(targetFeature.getFeatureAccessorName());
1735
    stringBuffer.append(TEXT_445);
1796
    stringBuffer.append(TEXT_456);
1736
    
1797
    
1737
		}
1798
		}
1738
1799
1739
    stringBuffer.append(TEXT_446);
1800
    stringBuffer.append(TEXT_457);
1740
    
1801
    
1741
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1802
	} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
1742
		GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature();
1803
		GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature();
1743
1804
1744
    stringBuffer.append(TEXT_447);
1805
    stringBuffer.append(TEXT_458);
1745
    stringBuffer.append(importManager.getImportedName(metaFeature.getEcoreFeature().isMany()? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1806
    stringBuffer.append(importManager.getImportedName(metaFeature.getEcoreFeature().isMany()? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
1746
    stringBuffer.append(TEXT_448);
1807
    stringBuffer.append(TEXT_459);
1747
    stringBuffer.append(importManager.getImportedName(metaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1808
    stringBuffer.append(importManager.getImportedName(metaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
1748
    stringBuffer.append(TEXT_449);
1809
    stringBuffer.append(TEXT_460);
1749
    stringBuffer.append(metaFeature.getFeatureAccessorName());
1810
    stringBuffer.append(metaFeature.getFeatureAccessorName());
1750
    stringBuffer.append(TEXT_450);
1811
    stringBuffer.append(TEXT_461);
1751
    
1812
    
1752
	}
1813
	}
1753
1814
1754
    stringBuffer.append(TEXT_451);
1815
    stringBuffer.append(TEXT_462);
1755
    
1816
    
1756
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1817
	if (genLink.getModelFacet() instanceof TypeLinkModelFacet) {
1757
1818
1758
    stringBuffer.append(TEXT_452);
1819
    stringBuffer.append(TEXT_463);
1759
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1820
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1760
    stringBuffer.append(TEXT_453);
1821
    stringBuffer.append(TEXT_464);
1761
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1822
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
1762
    stringBuffer.append(TEXT_454);
1823
    stringBuffer.append(TEXT_465);
1763
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
1824
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
1764
    stringBuffer.append(TEXT_455);
1825
    stringBuffer.append(TEXT_466);
1765
    
1826
    
1766
	}
1827
	}
1767
1828
1768
    stringBuffer.append(TEXT_456);
1829
    stringBuffer.append(TEXT_467);
1830
    
1831
{
1832
	String _source = "source.getElement()";
1833
	String _target = "target.getElement()";
1834
1835
    stringBuffer.append(TEXT_468);
1836
    
1837
			if (linkConstraints != null) {
1838
1839
    stringBuffer.append(TEXT_469);
1840
    stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")+"."+genDiagram.getLinkCreationConstraintsClassName()+"."+linkConstraints.getConstraintsInstanceFieldName());
1841
    stringBuffer.append(TEXT_470);
1842
    stringBuffer.append(_source);
1843
    stringBuffer.append(TEXT_471);
1844
    stringBuffer.append(_target);
1845
    stringBuffer.append(TEXT_472);
1846
    
1847
			}
1848
1849
    
1850
}	//local declarations for linkConstraints.jetinc
1851
1852
    stringBuffer.append(TEXT_473);
1769
    
1853
    
1770
}
1854
}
1771
1855
Lines 1774-1795 Link Here
1774
if (genNode.getViewmap() instanceof InnerClassViewmap) {
1858
if (genNode.getViewmap() instanceof InnerClassViewmap) {
1775
	String classBody = ((InnerClassViewmap) genNode.getViewmap()).getClassBody();
1859
	String classBody = ((InnerClassViewmap) genNode.getViewmap()).getClassBody();
1776
1860
1777
    stringBuffer.append(TEXT_457);
1861
    stringBuffer.append(TEXT_474);
1778
    stringBuffer.append(classBody);
1862
    stringBuffer.append(classBody);
1779
    stringBuffer.append(TEXT_458);
1863
    stringBuffer.append(TEXT_475);
1780
    
1864
    
1781
if (classBody.indexOf("DPtoLP") != -1) {
1865
if (classBody.indexOf("DPtoLP") != -1) {
1782
1866
1783
    stringBuffer.append(TEXT_459);
1867
    stringBuffer.append(TEXT_476);
1784
    
1868
    
1785
}
1869
}
1786
1870
1787
    
1871
    
1788
}
1872
}
1789
1873
1790
    stringBuffer.append(TEXT_460);
1874
    stringBuffer.append(TEXT_477);
1791
    importManager.emitSortedImports();
1875
    importManager.emitSortedImports();
1792
    stringBuffer.append(TEXT_461);
1876
    stringBuffer.append(TEXT_478);
1793
    return stringBuffer.toString();
1877
    return stringBuffer.toString();
1794
  }
1878
  }
1795
}
1879
}
(-)templates/providers/DomainElementInitializer.javajet (-35 / +234 lines)
Lines 1-11 Link Here
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.providers"  class="DomainElementInitializerGenerator"
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.providers"  class="DomainElementInitializerGenerator"
2
	imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.* java.util.*"%>
2
	imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.* java.util.* org.eclipse.emf.codegen.ecore.genmodel.*"%>
3
<%
3
<%
4
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
4
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
5
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
5
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
6
%>
6
%>
7
<%@ include file="../copyright4java.jetinc"%>
7
<%@ include file="../copyright4java.jetinc"%>
8
<%
8
<%
9
final String javaExprContainer = "JavaInitializers";
10
importManager.registerInnerClass(javaExprContainer);
11
final String javaConstraintsContainer = "JavaConstraints";
12
importManager.registerInnerClass(javaExprContainer);
13
importManager.registerInnerClass(genDiagram.getLinkCreationConstraintsClassName());
14
9
importManager.emitPackageStatement(stringBuffer);
15
importManager.emitPackageStatement(stringBuffer);
10
16
11
importManager.markImportLocation(stringBuffer);
17
importManager.markImportLocation(stringBuffer);
Lines 23-30 Link Here
23
	}
29
	}
24
30
25
<%
31
<%
32
{	//start local block that separates initializers and constraints
26
boolean needsNullInitializer = false;
33
boolean needsNullInitializer = false;
27
boolean needsOCLInitializer = false;
34
boolean needsObjectInitializer = false;
35
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
36
final Map javaInitializers = new HashMap();
37
final Map __exprEnvVariables = Collections.EMPTY_MAP;
38
final String __outEnvVarName = ""; // no env to setup;
39
final String __javaOperationContainer = javaExprContainer; // place java expression methods here
28
for (Iterator it = genDiagram.eAllContents(); it.hasNext(); ) {
40
for (Iterator it = genDiagram.eAllContents(); it.hasNext(); ) {
29
	Object next = it.next();
41
	Object next = it.next();
30
	String id = null;
42
	String id = null;
Lines 40-46 Link Here
40
		continue;
52
		continue;
41
	}
53
	}
42
	GenElementInitializer elementInitializer = modelFacet.getModelElementInitializer();
54
	GenElementInitializer elementInitializer = modelFacet.getModelElementInitializer();
43
	if (elementInitializer instanceof GenFeatureSeqInitializer == false) {
55
	if (elementInitializer instanceof GenFeatureSeqInitializer == false || expressionProviders == null) {
44
		if (!needsNullInitializer) {
56
		if (!needsNullInitializer) {
45
			needsNullInitializer = true;
57
			needsNullInitializer = true;
46
%>
58
%>
Lines 62-68 Link Here
62
<%
74
<%
63
		continue;
75
		continue;
64
	}
76
	}
65
	needsOCLInitializer = true;
77
	needsObjectInitializer = true;
66
	GenFeatureSeqInitializer ftInitializer = (GenFeatureSeqInitializer) elementInitializer;
78
	GenFeatureSeqInitializer ftInitializer = (GenFeatureSeqInitializer) elementInitializer;
67
%>
79
%>
68
80
Lines 71-90 Link Here
71
	 */
83
	 */
72
	public static IElementInitializer <%=id%> = new ObjectInitializer(new FeatureInitializer[] {
84
	public static IElementInitializer <%=id%> = new ObjectInitializer(new FeatureInitializer[] {
73
<%
85
<%
74
		for(Iterator featInitIt = ftInitializer.getInitializers().iterator(); featInitIt.hasNext();) { 
86
		GenClassifier __genExprContext = ftInitializer.getTypeModelFacet().getMetaClass();
75
			GenFeatureValueSpec featureValSpec = (GenFeatureValueSpec)featInitIt.next();%>
87
		for(Iterator featInitIt = ftInitializer.getInitializers().iterator(); featInitIt.hasNext();) {		 
76
			new FeatureInitializer("<%=featureValSpec.getBody()%>", //$NON-NLS-1$
88
			GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)featInitIt.next();
77
						<%=importManager.getImportedName(ftInitializer.getElementQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=ftInitializer.getElementClassAccessorName()%>(),
89
			String metaFeatureAccess = importManager.getImportedName(__genValueExpression.getFeatureQualifiedPackageInterfaceName())+".eINSTANCE.get"+__genValueExpression.getFeature().getFeatureAccessorName()+"()"; 
78
						<%=importManager.getImportedName(featureValSpec.getFeatureQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=featureValSpec.getFeature().getFeatureAccessorName()
90
%>
79
						%>())<%if (featInitIt.hasNext()) {%>, <%}%>
91
			new FeatureInitializer(
80
92
				<%@ include file="../expressions/getExpression.jetinc"%>,
93
				<%=metaFeatureAccess%>)<%=featInitIt.hasNext() ? "," : ""%>
81
<%
94
<%
95
			if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider && !expressionProviders.isCopy(__genValueExpression)) {
96
				javaInitializers.put(__genValueExpression, __genExprContext);
97
			}
82
		} // end of GenFeatureValueSpec iteration
98
		} // end of GenFeatureValueSpec iteration
83
%>
99
%>
84
	});
100
		});
85
<%
101
<%
86
}
102
}
87
if (needsOCLInitializer) {
103
if (needsObjectInitializer) {
88
%>
104
%>
89
	/**
105
	/**
90
	 * @generated
106
	 * @generated
Lines 108-114 Link Here
108
		public void initializeElement(<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> instance) {
124
		public void initializeElement(<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> instance) {
109
			for (int i = 0; i < initExpressions.length; i++) {
125
			for (int i = 0; i < initExpressions.length; i++) {
110
				FeatureInitializer nextExpr = initExpressions[i];
126
				FeatureInitializer nextExpr = initExpressions[i];
111
				nextExpr.init(instance);
127
				try {
128
					nextExpr.init(instance);
129
				} catch (RuntimeException e) {
130
					<%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.getInstance().logError("Feature initialization failed", e);	//$NON-NLS-1$
131
				}
112
			}
132
			}
113
		}
133
		}
114
	}
134
	}
Lines 120-167 Link Here
120
		/**
140
		/**
121
		 * @generated
141
		 * @generated
122
		 */
142
		 */
123
		private <%=importManager.getImportedName("org.eclipse.emf.ecore.EClass")%> contextClass;
124
		/**
125
		 * @generated
126
		 */
127
		private <%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> sFeature;
143
		private <%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> sFeature;
144
128
		/**
145
		/**
129
		 * @generated
146
		 * @generated
130
		 */
147
		 */
131
		private <%=importManager.getImportedName("java.lang.String")%> expressionBody;
148
		private <%=importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())%> expression;		
132
		/**
149
133
		 * @generated
134
		 */
135
		private <%=importManager.getImportedName("org.eclipse.emf.ocl.query.Query")%> query;
136
		/**
150
		/**
137
		 * @generated
151
		 * @generated
138
		 */
152
		 */
139
		FeatureInitializer(<%=importManager.getImportedName("java.lang.String")%> expression, 
153
		FeatureInitializer(<%=importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName())%> expression, 
140
			<%=importManager.getImportedName("org.eclipse.emf.ecore.EClass")%> context, 
141
			<%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> sFeature) {
154
			<%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> sFeature) {
142
			this.sFeature = sFeature;
155
			this.sFeature = sFeature;
143
			this.expressionBody = expression;
156
			this.expression = expression;
144
			this.contextClass	= context;
145
		}
157
		}
146
		/**
158
159
		/** 
147
		 * @generated
160
		 * @generated
148
		 */
161
		 */
149
		void init(<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> contextInstance) {
162
		void init(<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> contextInstance) {
150
			if(this.query == null) {
163
			Object value = expression.evaluate(contextInstance);
151
				this.query = <%=importManager.getImportedName("org.eclipse.emf.ocl.query.QueryFactory")%>.eINSTANCE.createQuery(expressionBody, contextClass);
164
			if (sFeature.getEType() instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.EEnum")%> && 
152
			}
153
			Object value = query.evaluate(contextInstance);
154
			if(sFeature.getEType() instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.EEnum")%> && 
155
				value instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral")%>) {
165
				value instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral")%>) {
156
				value = ((<%=importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral")%>)value).getInstance();
166
				value = ((<%=importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral")%>)value).getInstance();
157
			} else if(value != null && sFeature.isMany()) {
167
			} else if(sFeature.isMany() && value instanceof <%=importManager.getImportedName("java.util.Collection")%>) {
158
				value = new <%=importManager.getImportedName("org.eclipse.emf.common.util.BasicEList")%>((<%=importManager.getImportedName("java.util.Collection")%>)value);
168
				<%=importManager.getImportedName("java.util.Collection")%> destCollection = (<%=importManager.getImportedName("java.util.Collection")%>) contextInstance.eGet(sFeature);
169
				destCollection.clear();
170
				<%=importManager.getImportedName("java.util.Collection")%> valueCollection = (<%=importManager.getImportedName("java.util.Collection")%>) value;
171
				for (<%=importManager.getImportedName("java.util.Iterator")%> it = valueCollection.iterator(); it.hasNext();) {
172
					destCollection.add(it.next());
173
				}  
174
				return;
159
			}
175
			}
160
			contextInstance.eSet(sFeature, value);
176
			contextInstance.eSet(sFeature, value);
161
		}
177
		}
162
	}
178
	}
163
<%
179
<%
180
	if(!javaInitializers.isEmpty()) {
181
%>
182
		/** 
183
		 * @generated
184
		 */
185
		static class <%=javaExprContainer%> {
186
<%
187
		for(Iterator javaExprIt = javaInitializers.keySet().iterator(); javaExprIt.hasNext();) {
188
			GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)javaExprIt.next();
189
			GenClassifier __genExprContext = (GenClassifier)javaInitializers.get(__genValueExpression);
190
			GenExpressionProviderBase provider = expressionProviders.getProvider(__genValueExpression);
191
			if(!(provider instanceof GenJavaExpressionProvider)) continue;
192
			String __genExprResultType = provider.getQualifiedInstanceClassName(__genValueExpression.getFeature());
193
%>
194
<%@ include file="../expressions/javaExpressionOperation.jetinc"%>
195
<%
196
		}
197
%>
198
		} //<%=javaExprContainer%>
199
<%	} /* end of javaInitializers */ %>
200
<%
164
}
201
}
202
}	//end local block that separates initializers and constraints
203
%>
204
205
<%
206
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
207
if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) {
208
	String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName());
209
	String importedAbstractExprCls = importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName());
210
	boolean hasJavaConstraints = false;
211
%>
212
	/**
213
	 * @generated
214
	 */
215
	public static class <%=genDiagram.getLinkCreationConstraintsClassName()%> {
216
<%
217
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
218
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
219
		if(linkConstraints == null) continue;
220
		if(linkConstraints.getSourceEndContextClass() == null || linkConstraints.getTargetEndContextClass() == null) continue;
221
		hasJavaConstraints |= (linkConstraints.getSourceEnd() != null && expressionProviders.getProvider(linkConstraints.getSourceEnd()) instanceof GenJavaExpressionProvider) ||
222
							(linkConstraints.getTargetEnd() != null && expressionProviders.getProvider(linkConstraints.getTargetEnd()) instanceof GenJavaExpressionProvider);
223
%>
224
		/**
225
		 * @generated 
226
		 */
227
		public static final <%=genDiagram.getLinkCreationConstraintsClassName()%> <%=linkConstraints.getConstraintsInstanceFieldName()%> = create<%=linkConstraints.getConstraintsInstanceFieldName()%>();
228
<%
229
	} // end of link iteration
230
%>
231
232
<%
233
	final String oppositeEndVarName = "oppositeEnd";
234
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
235
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
236
		if(linkConstraints == null) continue;
237
		GenClass srcContext = linkConstraints.getSourceEndContextClass();
238
		GenClass targetContext = linkConstraints.getTargetEndContextClass();
239
		if(srcContext == null || targetContext == null) continue;
240
%>
241
		/**
242
		 * @generated 
243
		 */
244
		private static <%=genDiagram.getLinkCreationConstraintsClassName()%> create<%=linkConstraints.getConstraintsInstanceFieldName()%>() {
245
<%
246
		String __javaOperationContainer = javaConstraintsContainer;
247
		Map __exprEnvVariables = new java.util.HashMap();
248
		String __outEnvVarName = "sourceEnv";
249
		GenClassifier __genExprContext = srcContext;
250
		ValueExpression __genValueExpression = linkConstraints.getSourceEnd();
251
		__exprEnvVariables.put(oppositeEndVarName, targetContext); //$NON-NLS-1$
252
253
%><%@ include file="../expressions/initEnv.jetinc"%>
254
			<%=importedAbstractExprCls%> sourceExpression = <%
255
		if(linkConstraints.getSourceEnd() != null) {
256
%><%@ include file="../expressions/getExpression.jetinc"%><%
257
		} else %>null<%;%>;
258
<%
259
		__outEnvVarName = "targetEnv";
260
		__genExprContext = targetContext;
261
		__genValueExpression = linkConstraints.getTargetEnd();			
262
		__exprEnvVariables.put(oppositeEndVarName, srcContext); //$NON-NLS-1$
263
%><%@ include file="../expressions/initEnv.jetinc"%>
264
			<%=importedAbstractExprCls%> targetExpression = <%
265
		if(linkConstraints.getTargetEnd() != null) {
266
%><%@ include file="../expressions/getExpression.jetinc"%><%
267
		} else %>null<%;%>;
268
			return new <%=genDiagram.getLinkCreationConstraintsClassName()%>(sourceExpression, targetExpression);
269
		}
270
<%
271
	} // end of link iteration
165
%>
272
%>
273
		/**
274
		 * @generated 
275
		 */	
276
		private static final String OPPOSITE_END_VAR = "oppositeEnd"; //$NON-NLS-1$
277
		/**
278
		 * @generated 
279
		 */	
280
		private <%=importedAbstractExprCls%> srcEndInv;
281
		/**
282
		 * @generated 
283
		 */	
284
		private <%=importedAbstractExprCls%> targetEndInv;
285
		/**
286
		 * @generated 
287
		 */		
288
		public <%=genDiagram.getLinkCreationConstraintsClassName()%>(<%=importedAbstractExprCls%> sourceEnd, <%=importedAbstractExprCls%> targetEnd) {
289
			this.srcEndInv = sourceEnd;			
290
			this.targetEndInv = targetEnd;			
291
		}
292
		
293
		/**
294
		 * @generated 
295
		 */	
296
		public boolean canCreateLink(Object source, Object target, boolean isBackDirected) {
297
			if (source != null) {
298
				<%=importedAbstractExprCls%> sourceConstraint = isBackDirected ? targetEndInv : srcEndInv;
299
				if (sourceConstraint != null && !evaluate(sourceConstraint, source, target, false)) {
300
					return false;
301
				}
302
			}
303
			if (target != null) {
304
				<%=importedAbstractExprCls%> targetConstraint = isBackDirected ? srcEndInv : targetEndInv;
305
				if (targetConstraint != null && !evaluate(targetConstraint, source, target, true)) {
306
					return false;
307
				}
308
			}
309
			return true;
310
		}
311
	
312
		/**
313
		 * @generated 
314
		 */
315
		private static boolean evaluate(<%=importedAbstractExprCls%> constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {
316
			<%=importManager.getImportedName("java.util.Map")%> evalEnv = <%=importManager.getImportedName("java.util.Collections")%>.singletonMap(OPPOSITE_END_VAR, oppositeEnd);			
317
			try {
318
				Object val = constraint.evaluate(sourceEnd, evalEnv);
319
				return (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;
320
			} catch(Exception e) {	
321
				<%=pluginActivatorClass%>.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
322
				return false;
323
			}
324
		}
325
<%
326
if(hasJavaConstraints) {
327
%>		
328
	/**
329
	 * @generated
330
	 */
331
	private static class <%=javaConstraintsContainer%> {
332
<%
333
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
334
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
335
		if(linkConstraints == null) continue;
336
		GenClass srcContext = linkConstraints.getSourceEndContextClass();
337
		GenClass targetContext = linkConstraints.getTargetEndContextClass();
338
		if(srcContext == null || targetContext == null) continue;
339
		String __genExprResultType = "java.lang.Boolean";
340
		Map __exprEnvVariables = new java.util.HashMap();
341
		GenClassifier __genExprContext = srcContext;
342
		ValueExpression __genValueExpression = linkConstraints.getSourceEnd();
343
		if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider) {				
344
			__exprEnvVariables.put(oppositeEndVarName, targetContext);
345
%>
346
<%@ include file="../expressions/javaExpressionOperation.jetinc"%>
347
<%
348
		}
349
		__genValueExpression = linkConstraints.getTargetEnd();
350
		if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider) {		
351
			__genExprContext = targetContext;
352
			__exprEnvVariables.put(oppositeEndVarName, srcContext);
353
%>
354
<%@ include file="../expressions/javaExpressionOperation.jetinc"%>
355
<%
356
		}
357
	} /*java constraints iteration*/
358
%>
359
	} // <%=javaConstraintsContainer%>
360
<%
361
} /* end of hasJavaConstraints */
362
%>		
363
	}
364
<%} /*end of hasLinkCreationConstraints()*/ %>	
166
}
365
}
167
<%importManager.emitSortedImports();%>
366
<%importManager.emitSortedImports();%>
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/providers/DomainElementInitializerGenerator.java (-63 / +892 lines)
Lines 3-8 Link Here
3
import org.eclipse.gmf.codegen.gmfgen.*;
3
import org.eclipse.gmf.codegen.gmfgen.*;
4
import org.eclipse.gmf.common.codegen.*;
4
import org.eclipse.gmf.common.codegen.*;
5
import java.util.*;
5
import java.util.*;
6
import org.eclipse.emf.codegen.ecore.genmodel.*;
6
7
7
public class DomainElementInitializerGenerator
8
public class DomainElementInitializerGenerator
8
{
9
{
Lines 28-60 Link Here
28
  protected final String TEXT_10 = " = NULL_INITIALIZER;";
29
  protected final String TEXT_10 = " = NULL_INITIALIZER;";
29
  protected final String TEXT_11 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static IElementInitializer ";
30
  protected final String TEXT_11 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static IElementInitializer ";
30
  protected final String TEXT_12 = " = new ObjectInitializer(new FeatureInitializer[] {";
31
  protected final String TEXT_12 = " = new ObjectInitializer(new FeatureInitializer[] {";
31
  protected final String TEXT_13 = NL + "\t\t\tnew FeatureInitializer(\"";
32
  protected final String TEXT_13 = NL + "\t\t\tnew FeatureInitializer(" + NL + "\t\t\t\t";
32
  protected final String TEXT_14 = "\", //$NON-NLS-1$" + NL + "\t\t\t\t\t\t";
33
  protected final String TEXT_14 = "null";
33
  protected final String TEXT_15 = ".eINSTANCE.get";
34
  protected final String TEXT_15 = ".";
34
  protected final String TEXT_16 = "()," + NL + "\t\t\t\t\t\t";
35
  protected final String TEXT_16 = "(\"";
35
  protected final String TEXT_17 = ".eINSTANCE.get";
36
  protected final String TEXT_17 = "\", //$NON-NLS-1$" + NL + "\t";
36
  protected final String TEXT_18 = "())";
37
  protected final String TEXT_18 = ", ";
37
  protected final String TEXT_19 = ", ";
38
  protected final String TEXT_19 = ")";
38
  protected final String TEXT_20 = NL;
39
  protected final String TEXT_20 = ".";
39
  protected final String TEXT_21 = NL + "\t});";
40
  protected final String TEXT_21 = "(\"";
40
  protected final String TEXT_22 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ObjectInitializer implements IElementInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate FeatureInitializer[] initExpressions;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tObjectInitializer(FeatureInitializer[] initExpressions) {" + NL + "\t\t\tthis.initExpressions = initExpressions;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void initializeElement(";
41
  protected final String TEXT_22 = "\", //$NON-NLS-1$" + NL + "\t";
41
  protected final String TEXT_23 = " instance) {" + NL + "\t\t\tfor (int i = 0; i < initExpressions.length; i++) {" + NL + "\t\t\t\tFeatureInitializer nextExpr = initExpressions[i];" + NL + "\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic class FeatureInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
42
  protected final String TEXT_23 = ")";
42
  protected final String TEXT_24 = " contextClass;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
43
  protected final String TEXT_24 = "new ";
43
  protected final String TEXT_25 = " sFeature;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
44
  protected final String TEXT_25 = "(";
44
  protected final String TEXT_26 = " expressionBody;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
45
  protected final String TEXT_26 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
45
  protected final String TEXT_27 = " query;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tFeatureInitializer(";
46
  protected final String TEXT_27 = " env) {\t" + NL + "\t\t";
46
  protected final String TEXT_28 = " expression, " + NL + "\t\t\t";
47
  protected final String TEXT_28 = " self = (";
47
  protected final String TEXT_29 = " context, " + NL + "\t\t\t";
48
  protected final String TEXT_29 = ")context;";
48
  protected final String TEXT_30 = " sFeature) {" + NL + "\t\t\tthis.sFeature = sFeature;" + NL + "\t\t\tthis.expressionBody = expression;" + NL + "\t\t\tthis.contextClass\t= context;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tvoid init(";
49
  protected final String TEXT_30 = "\t" + NL + "\t\t";
49
  protected final String TEXT_31 = " contextInstance) {" + NL + "\t\t\tif(this.query == null) {" + NL + "\t\t\t\tthis.query = ";
50
  protected final String TEXT_31 = " ";
50
  protected final String TEXT_32 = ".eINSTANCE.createQuery(expressionBody, contextClass);" + NL + "\t\t\t}" + NL + "\t\t\tObject value = query.evaluate(contextInstance);" + NL + "\t\t\tif(sFeature.getEType() instanceof ";
51
  protected final String TEXT_32 = " = (";
51
  protected final String TEXT_33 = " && " + NL + "\t\t\t\tvalue instanceof ";
52
  protected final String TEXT_33 = ")env.get(\"";
52
  protected final String TEXT_34 = ") {" + NL + "\t\t\t\tvalue = ((";
53
  protected final String TEXT_34 = "\"); //$NON-NLS-1$";
53
  protected final String TEXT_35 = ")value).getInstance();" + NL + "\t\t\t} else if(value != null && sFeature.isMany()) {" + NL + "\t\t\t\tvalue = new ";
54
  protected final String TEXT_35 = NL + "\t\treturn ";
54
  protected final String TEXT_36 = "((";
55
  protected final String TEXT_36 = ".";
55
  protected final String TEXT_37 = ")value);" + NL + "\t\t\t}" + NL + "\t\t\tcontextInstance.eSet(sFeature, value);" + NL + "\t\t}" + NL + "\t}";
56
  protected final String TEXT_37 = "(self";
56
  protected final String TEXT_38 = NL + "}";
57
  protected final String TEXT_38 = ", ";
57
  protected final String TEXT_39 = NL;
58
  protected final String TEXT_39 = ");" + NL + "\t}" + NL + "}";
59
  protected final String TEXT_40 = NL + "," + NL + "\t\t\t\t";
60
  protected final String TEXT_41 = ")";
61
  protected final String TEXT_42 = NL + "\t\t});";
62
  protected final String TEXT_43 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ObjectInitializer implements IElementInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate FeatureInitializer[] initExpressions;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tObjectInitializer(FeatureInitializer[] initExpressions) {" + NL + "\t\t\tthis.initExpressions = initExpressions;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void initializeElement(";
63
  protected final String TEXT_44 = " instance) {" + NL + "\t\t\tfor (int i = 0; i < initExpressions.length; i++) {" + NL + "\t\t\t\tFeatureInitializer nextExpr = initExpressions[i];" + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\tnextExpr.init(instance);" + NL + "\t\t\t\t} catch (RuntimeException e) {" + NL + "\t\t\t\t\t";
64
  protected final String TEXT_45 = ".getInstance().logError(\"Feature initialization failed\", e);\t//$NON-NLS-1$" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tstatic class FeatureInitializer {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
65
  protected final String TEXT_46 = " sFeature;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
66
  protected final String TEXT_47 = " expression;\t\t" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tFeatureInitializer(";
67
  protected final String TEXT_48 = " expression, " + NL + "\t\t\t";
68
  protected final String TEXT_49 = " sFeature) {" + NL + "\t\t\tthis.sFeature = sFeature;" + NL + "\t\t\tthis.expression = expression;" + NL + "\t\t}" + NL + "" + NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tvoid init(";
69
  protected final String TEXT_50 = " contextInstance) {" + NL + "\t\t\tObject value = expression.evaluate(contextInstance);" + NL + "\t\t\tif (sFeature.getEType() instanceof ";
70
  protected final String TEXT_51 = " && " + NL + "\t\t\t\tvalue instanceof ";
71
  protected final String TEXT_52 = ") {" + NL + "\t\t\t\tvalue = ((";
72
  protected final String TEXT_53 = ")value).getInstance();" + NL + "\t\t\t} else if(sFeature.isMany() && value instanceof ";
73
  protected final String TEXT_54 = ") {" + NL + "\t\t\t\t";
74
  protected final String TEXT_55 = " destCollection = (";
75
  protected final String TEXT_56 = ") contextInstance.eGet(sFeature);" + NL + "\t\t\t\tdestCollection.clear();" + NL + "\t\t\t\t";
76
  protected final String TEXT_57 = " valueCollection = (";
77
  protected final String TEXT_58 = ") value;" + NL + "\t\t\t\tfor (";
78
  protected final String TEXT_59 = " it = valueCollection.iterator(); it.hasNext();) {" + NL + "\t\t\t\t\tdestCollection.add(it.next());" + NL + "\t\t\t\t}  " + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t\tcontextInstance.eSet(sFeature, value);" + NL + "\t\t}" + NL + "\t}";
79
  protected final String TEXT_60 = NL + "\t\t/** " + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tstatic class ";
80
  protected final String TEXT_61 = " {";
81
  protected final String TEXT_62 = NL;
82
  protected final String TEXT_63 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
83
  protected final String TEXT_64 = " ";
84
  protected final String TEXT_65 = "(";
85
  protected final String TEXT_66 = " self";
86
  protected final String TEXT_67 = ", ";
87
  protected final String TEXT_68 = " ";
88
  protected final String TEXT_69 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '";
89
  protected final String TEXT_70 = "' operation\"); //$NON-NLS-1$" + NL + "}";
90
  protected final String TEXT_71 = NL + "\t\t} //";
91
  protected final String TEXT_72 = NL;
92
  protected final String TEXT_73 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class ";
93
  protected final String TEXT_74 = " {";
94
  protected final String TEXT_75 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic static final ";
95
  protected final String TEXT_76 = " ";
96
  protected final String TEXT_77 = " = create";
97
  protected final String TEXT_78 = "();";
98
  protected final String TEXT_79 = NL;
99
  protected final String TEXT_80 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static ";
100
  protected final String TEXT_81 = " create";
101
  protected final String TEXT_82 = "() {";
102
  protected final String TEXT_83 = NL;
103
  protected final String TEXT_84 = " ";
104
  protected final String TEXT_85 = " = new ";
105
  protected final String TEXT_86 = "(3);";
106
  protected final String TEXT_87 = ".put(\"";
107
  protected final String TEXT_88 = "\", ";
108
  protected final String TEXT_89 = "); //$NON-NLS-1$";
109
  protected final String TEXT_90 = NL + "\t\t\t";
110
  protected final String TEXT_91 = " sourceExpression = ";
111
  protected final String TEXT_92 = "null";
112
  protected final String TEXT_93 = ".";
113
  protected final String TEXT_94 = "(\"";
114
  protected final String TEXT_95 = "\", //$NON-NLS-1$" + NL + "\t";
115
  protected final String TEXT_96 = ", ";
116
  protected final String TEXT_97 = ")";
117
  protected final String TEXT_98 = ".";
118
  protected final String TEXT_99 = "(\"";
119
  protected final String TEXT_100 = "\", //$NON-NLS-1$" + NL + "\t";
120
  protected final String TEXT_101 = ")";
121
  protected final String TEXT_102 = "new ";
122
  protected final String TEXT_103 = "(";
123
  protected final String TEXT_104 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
124
  protected final String TEXT_105 = " env) {\t" + NL + "\t\t";
125
  protected final String TEXT_106 = " self = (";
126
  protected final String TEXT_107 = ")context;";
127
  protected final String TEXT_108 = "\t" + NL + "\t\t";
128
  protected final String TEXT_109 = " ";
129
  protected final String TEXT_110 = " = (";
130
  protected final String TEXT_111 = ")env.get(\"";
131
  protected final String TEXT_112 = "\"); //$NON-NLS-1$";
132
  protected final String TEXT_113 = NL + "\t\treturn ";
133
  protected final String TEXT_114 = ".";
134
  protected final String TEXT_115 = "(self";
135
  protected final String TEXT_116 = ", ";
136
  protected final String TEXT_117 = ");" + NL + "\t}" + NL + "}";
137
  protected final String TEXT_118 = "null";
138
  protected final String TEXT_119 = ";";
139
  protected final String TEXT_120 = NL;
140
  protected final String TEXT_121 = " ";
141
  protected final String TEXT_122 = " = new ";
142
  protected final String TEXT_123 = "(3);";
143
  protected final String TEXT_124 = ".put(\"";
144
  protected final String TEXT_125 = "\", ";
145
  protected final String TEXT_126 = "); //$NON-NLS-1$";
146
  protected final String TEXT_127 = NL + "\t\t\t";
147
  protected final String TEXT_128 = " targetExpression = ";
148
  protected final String TEXT_129 = "null";
149
  protected final String TEXT_130 = ".";
150
  protected final String TEXT_131 = "(\"";
151
  protected final String TEXT_132 = "\", //$NON-NLS-1$" + NL + "\t";
152
  protected final String TEXT_133 = ", ";
153
  protected final String TEXT_134 = ")";
154
  protected final String TEXT_135 = ".";
155
  protected final String TEXT_136 = "(\"";
156
  protected final String TEXT_137 = "\", //$NON-NLS-1$" + NL + "\t";
157
  protected final String TEXT_138 = ")";
158
  protected final String TEXT_139 = "new ";
159
  protected final String TEXT_140 = "(";
160
  protected final String TEXT_141 = ") {" + NL + "\tprotected Object doEvaluate(Object context, ";
161
  protected final String TEXT_142 = " env) {\t" + NL + "\t\t";
162
  protected final String TEXT_143 = " self = (";
163
  protected final String TEXT_144 = ")context;";
164
  protected final String TEXT_145 = "\t" + NL + "\t\t";
165
  protected final String TEXT_146 = " ";
166
  protected final String TEXT_147 = " = (";
167
  protected final String TEXT_148 = ")env.get(\"";
168
  protected final String TEXT_149 = "\"); //$NON-NLS-1$";
169
  protected final String TEXT_150 = NL + "\t\treturn ";
170
  protected final String TEXT_151 = ".";
171
  protected final String TEXT_152 = "(self";
172
  protected final String TEXT_153 = ", ";
173
  protected final String TEXT_154 = ");" + NL + "\t}" + NL + "}";
174
  protected final String TEXT_155 = "null";
175
  protected final String TEXT_156 = ";" + NL + "\t\t\treturn new ";
176
  protected final String TEXT_157 = "(sourceExpression, targetExpression);" + NL + "\t\t}";
177
  protected final String TEXT_158 = NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate static final String OPPOSITE_END_VAR = \"oppositeEnd\"; //$NON-NLS-1$" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate ";
178
  protected final String TEXT_159 = " srcEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tprivate ";
179
  protected final String TEXT_160 = " targetEndInv;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tpublic ";
180
  protected final String TEXT_161 = "(";
181
  protected final String TEXT_162 = " sourceEnd, ";
182
  protected final String TEXT_163 = " targetEnd) {" + NL + "\t\t\tthis.srcEndInv = sourceEnd;\t\t\t" + NL + "\t\t\tthis.targetEndInv = targetEnd;\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t" + NL + "\t\tpublic boolean canCreateLink(Object source, Object target, boolean isBackDirected) {" + NL + "\t\t\tif (source != null) {" + NL + "\t\t\t\t";
183
  protected final String TEXT_164 = " sourceConstraint = isBackDirected ? targetEndInv : srcEndInv;" + NL + "\t\t\t\tif (sourceConstraint != null && !evaluate(sourceConstraint, source, target, false)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tif (target != null) {" + NL + "\t\t\t\t";
184
  protected final String TEXT_165 = " targetConstraint = isBackDirected ? srcEndInv : targetEndInv;" + NL + "\t\t\t\tif (targetConstraint != null && !evaluate(targetConstraint, source, target, true)) {" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate static boolean evaluate(";
185
  protected final String TEXT_166 = " constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {" + NL + "\t\t\t";
186
  protected final String TEXT_167 = " evalEnv = ";
187
  protected final String TEXT_168 = ".singletonMap(OPPOSITE_END_VAR, oppositeEnd);\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tObject val = constraint.evaluate(sourceEnd, evalEnv);" + NL + "\t\t\t\treturn (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;" + NL + "\t\t\t} catch(Exception e) {\t" + NL + "\t\t\t\t";
188
  protected final String TEXT_169 = ".getInstance().logError(\"Link constraint evaluation error\", e); //$NON-NLS-1$" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}";
189
  protected final String TEXT_170 = "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class ";
190
  protected final String TEXT_171 = " {";
191
  protected final String TEXT_172 = NL;
192
  protected final String TEXT_173 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
193
  protected final String TEXT_174 = " ";
194
  protected final String TEXT_175 = "(";
195
  protected final String TEXT_176 = " self";
196
  protected final String TEXT_177 = ", ";
197
  protected final String TEXT_178 = " ";
198
  protected final String TEXT_179 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '";
199
  protected final String TEXT_180 = "' operation\"); //$NON-NLS-1$" + NL + "}";
200
  protected final String TEXT_181 = NL;
201
  protected final String TEXT_182 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "private static ";
202
  protected final String TEXT_183 = " ";
203
  protected final String TEXT_184 = "(";
204
  protected final String TEXT_185 = " self";
205
  protected final String TEXT_186 = ", ";
206
  protected final String TEXT_187 = " ";
207
  protected final String TEXT_188 = ") {" + NL + "\t// TODO: implement this method" + NL + "\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t" + NL + "\tthrow new UnsupportedOperationException(\"No user implementation provided in '";
208
  protected final String TEXT_189 = "' operation\"); //$NON-NLS-1$" + NL + "}";
209
  protected final String TEXT_190 = NL + "\t} // ";
210
  protected final String TEXT_191 = "\t\t" + NL + "\t}";
211
  protected final String TEXT_192 = "\t" + NL + "}";
212
  protected final String TEXT_193 = NL;
58
213
59
  public String generate(Object argument)
214
  public String generate(Object argument)
60
  {
215
  {
Lines 73-78 Link Here
73
    stringBuffer.append(TEXT_3);
228
    stringBuffer.append(TEXT_3);
74
    }
229
    }
75
    
230
    
231
final String javaExprContainer = "JavaInitializers";
232
importManager.registerInnerClass(javaExprContainer);
233
final String javaConstraintsContainer = "JavaConstraints";
234
importManager.registerInnerClass(javaExprContainer);
235
importManager.registerInnerClass(genDiagram.getLinkCreationConstraintsClassName());
236
76
importManager.emitPackageStatement(stringBuffer);
237
importManager.emitPackageStatement(stringBuffer);
77
238
78
importManager.markImportLocation(stringBuffer);
239
importManager.markImportLocation(stringBuffer);
Lines 83-90 Link Here
83
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
244
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
84
    stringBuffer.append(TEXT_6);
245
    stringBuffer.append(TEXT_6);
85
    
246
    
247
{	//start local block that separates initializers and constraints
86
boolean needsNullInitializer = false;
248
boolean needsNullInitializer = false;
87
boolean needsOCLInitializer = false;
249
boolean needsObjectInitializer = false;
250
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
251
final Map javaInitializers = new HashMap();
252
final Map __exprEnvVariables = Collections.EMPTY_MAP;
253
final String __outEnvVarName = ""; // no env to setup;
254
final String __javaOperationContainer = javaExprContainer; // place java expression methods here
88
for (Iterator it = genDiagram.eAllContents(); it.hasNext(); ) {
255
for (Iterator it = genDiagram.eAllContents(); it.hasNext(); ) {
89
	Object next = it.next();
256
	Object next = it.next();
90
	String id = null;
257
	String id = null;
Lines 100-106 Link Here
100
		continue;
267
		continue;
101
	}
268
	}
102
	GenElementInitializer elementInitializer = modelFacet.getModelElementInitializer();
269
	GenElementInitializer elementInitializer = modelFacet.getModelElementInitializer();
103
	if (elementInitializer instanceof GenFeatureSeqInitializer == false) {
270
	if (elementInitializer instanceof GenFeatureSeqInitializer == false || expressionProviders == null) {
104
		if (!needsNullInitializer) {
271
		if (!needsNullInitializer) {
105
			needsNullInitializer = true;
272
			needsNullInitializer = true;
106
273
Lines 116-191 Link Here
116
    
283
    
117
		continue;
284
		continue;
118
	}
285
	}
119
	needsOCLInitializer = true;
286
	needsObjectInitializer = true;
120
	GenFeatureSeqInitializer ftInitializer = (GenFeatureSeqInitializer) elementInitializer;
287
	GenFeatureSeqInitializer ftInitializer = (GenFeatureSeqInitializer) elementInitializer;
121
288
122
    stringBuffer.append(TEXT_11);
289
    stringBuffer.append(TEXT_11);
123
    stringBuffer.append(id);
290
    stringBuffer.append(id);
124
    stringBuffer.append(TEXT_12);
291
    stringBuffer.append(TEXT_12);
125
    
292
    
126
		for(Iterator featInitIt = ftInitializer.getInitializers().iterator(); featInitIt.hasNext();) { 
293
		GenClassifier __genExprContext = ftInitializer.getTypeModelFacet().getMetaClass();
127
			GenFeatureValueSpec featureValSpec = (GenFeatureValueSpec)featInitIt.next();
294
		for(Iterator featInitIt = ftInitializer.getInitializers().iterator(); featInitIt.hasNext();) {		 
295
			GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)featInitIt.next();
296
			String metaFeatureAccess = importManager.getImportedName(__genValueExpression.getFeatureQualifiedPackageInterfaceName())+".eINSTANCE.get"+__genValueExpression.getFeature().getFeatureAccessorName()+"()"; 
297
128
    stringBuffer.append(TEXT_13);
298
    stringBuffer.append(TEXT_13);
129
    stringBuffer.append(featureValSpec.getBody());
299
    
300
{ /*begin the scope*/
301
/*
302
ValueExpression __genValueExpression;
303
GenClassifier __genExprContext
304
java.util.Map __exprEnvVariables
305
String __outEnvVarName;
306
String __javaOperationContainer;
307
*/
308
	org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
309
	String __ctxEClassifierAccess = importManager.getImportedName(__genExprContext.getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + __genExprContext.getClassifierAccessorName()+"()";
310
	String __importedAbstractClass = __genExprProvider != null ? importManager.getImportedName(__genExprProvider.getContainer().getAbstractExpressionQualifiedClassName()) : null;
311
312
	if(__genExprProvider == null || __importedAbstractClass == null) {
313
130
    stringBuffer.append(TEXT_14);
314
    stringBuffer.append(TEXT_14);
131
    stringBuffer.append(importManager.getImportedName(ftInitializer.getElementQualifiedPackageInterfaceName()));
315
    
316
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
317
		org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
318
		String __expressionAccessor = interpreter.getExpressionAccessor(__genValueExpression);
319
		String providerImportedClass = importManager.getImportedName(interpreter.getQualifiedClassName());
320
		if(!__exprEnvVariables.isEmpty()) {			
321
322
    stringBuffer.append(providerImportedClass);
132
    stringBuffer.append(TEXT_15);
323
    stringBuffer.append(TEXT_15);
133
    stringBuffer.append(ftInitializer.getElementClassAccessorName());
324
    stringBuffer.append(__expressionAccessor);
134
    stringBuffer.append(TEXT_16);
325
    stringBuffer.append(TEXT_16);
135
    stringBuffer.append(importManager.getImportedName(featureValSpec.getFeatureQualifiedPackageInterfaceName()));
326
    stringBuffer.append(__genValueExpression.getBody());
136
    stringBuffer.append(TEXT_17);
327
    stringBuffer.append(TEXT_17);
137
    stringBuffer.append(featureValSpec.getFeature().getFeatureAccessorName()
328
    stringBuffer.append(__ctxEClassifierAccess);
138
						);
139
    stringBuffer.append(TEXT_18);
329
    stringBuffer.append(TEXT_18);
140
    if (featInitIt.hasNext()) {
330
    stringBuffer.append(__outEnvVarName);
141
    stringBuffer.append(TEXT_19);
331
    stringBuffer.append(TEXT_19);
142
    }
143
    stringBuffer.append(TEXT_20);
144
    
332
    
145
		} // end of GenFeatureValueSpec iteration
333
		} else { 		
146
334
335
    stringBuffer.append(providerImportedClass);
336
    stringBuffer.append(TEXT_20);
337
    stringBuffer.append(__expressionAccessor);
147
    stringBuffer.append(TEXT_21);
338
    stringBuffer.append(TEXT_21);
148
    
339
    stringBuffer.append(__genValueExpression.getBody());
149
}
150
if (needsOCLInitializer) {
151
152
    stringBuffer.append(TEXT_22);
340
    stringBuffer.append(TEXT_22);
153
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
341
    stringBuffer.append(__ctxEClassifierAccess);
154
    stringBuffer.append(TEXT_23);
342
    stringBuffer.append(TEXT_23);
155
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
343
    
344
		}
345
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
346
		String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
347
		String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);	
348
349
156
    stringBuffer.append(TEXT_24);
350
    stringBuffer.append(TEXT_24);
157
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
351
    stringBuffer.append(__importedAbstractClass);
158
    stringBuffer.append(TEXT_25);
352
    stringBuffer.append(TEXT_25);
159
    stringBuffer.append(importManager.getImportedName("java.lang.String"));
353
    stringBuffer.append(__ctxEClassifierAccess);
160
    stringBuffer.append(TEXT_26);
354
    stringBuffer.append(TEXT_26);
161
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ocl.query.Query"));
355
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
162
    stringBuffer.append(TEXT_27);
356
    stringBuffer.append(TEXT_27);
163
    stringBuffer.append(importManager.getImportedName("java.lang.String"));
357
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
164
    stringBuffer.append(TEXT_28);
358
    stringBuffer.append(TEXT_28);
165
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
359
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
166
    stringBuffer.append(TEXT_29);
360
    stringBuffer.append(TEXT_29);
167
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
361
    	
362
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
363
			String nextVariableName = (String)envVarIt.next();
364
			org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
365
			String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
366
168
    stringBuffer.append(TEXT_30);
367
    stringBuffer.append(TEXT_30);
169
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
368
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
170
    stringBuffer.append(TEXT_31);
369
    stringBuffer.append(TEXT_31);
171
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ocl.query.QueryFactory"));
370
    stringBuffer.append(nextVariableName);
172
    stringBuffer.append(TEXT_32);
371
    stringBuffer.append(TEXT_32);
173
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnum"));
372
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
174
    stringBuffer.append(TEXT_33);
373
    stringBuffer.append(TEXT_33);
175
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral"));
374
    stringBuffer.append(nextVariableName);
176
    stringBuffer.append(TEXT_34);
375
    stringBuffer.append(TEXT_34);
177
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral"));
376
    		} 
178
    stringBuffer.append(TEXT_35);
377
    stringBuffer.append(TEXT_35);
179
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.BasicEList"));
378
    
379
		if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { 
380
    stringBuffer.append(__javaOperationContainer);
180
    stringBuffer.append(TEXT_36);
381
    stringBuffer.append(TEXT_36);
181
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
382
    
383
		} 
384
    stringBuffer.append(__exprJavaOperName);
182
    stringBuffer.append(TEXT_37);
385
    stringBuffer.append(TEXT_37);
183
    
386
    
387
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
388
    stringBuffer.append(TEXT_38);
389
    stringBuffer.append((String)envVarIt.next());
390
    }
391
    stringBuffer.append(TEXT_39);
392
    }
393
    } /*end of scope*/
394
    stringBuffer.append(TEXT_40);
395
    stringBuffer.append(metaFeatureAccess);
396
    stringBuffer.append(TEXT_41);
397
    stringBuffer.append(featInitIt.hasNext() ? "," : "");
398
    
399
			if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider && !expressionProviders.isCopy(__genValueExpression)) {
400
				javaInitializers.put(__genValueExpression, __genExprContext);
401
			}
402
		} // end of GenFeatureValueSpec iteration
403
404
    stringBuffer.append(TEXT_42);
405
    
184
}
406
}
407
if (needsObjectInitializer) {
185
408
186
    stringBuffer.append(TEXT_38);
409
    stringBuffer.append(TEXT_43);
410
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
411
    stringBuffer.append(TEXT_44);
412
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
413
    stringBuffer.append(TEXT_45);
414
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
415
    stringBuffer.append(TEXT_46);
416
    stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
417
    stringBuffer.append(TEXT_47);
418
    stringBuffer.append(importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName()));
419
    stringBuffer.append(TEXT_48);
420
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
421
    stringBuffer.append(TEXT_49);
422
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
423
    stringBuffer.append(TEXT_50);
424
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnum"));
425
    stringBuffer.append(TEXT_51);
426
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral"));
427
    stringBuffer.append(TEXT_52);
428
    stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EEnumLiteral"));
429
    stringBuffer.append(TEXT_53);
430
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
431
    stringBuffer.append(TEXT_54);
432
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
433
    stringBuffer.append(TEXT_55);
434
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
435
    stringBuffer.append(TEXT_56);
436
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
437
    stringBuffer.append(TEXT_57);
438
    stringBuffer.append(importManager.getImportedName("java.util.Collection"));
439
    stringBuffer.append(TEXT_58);
440
    stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
441
    stringBuffer.append(TEXT_59);
442
    
443
	if(!javaInitializers.isEmpty()) {
444
445
    stringBuffer.append(TEXT_60);
446
    stringBuffer.append(javaExprContainer);
447
    stringBuffer.append(TEXT_61);
448
    
449
		for(Iterator javaExprIt = javaInitializers.keySet().iterator(); javaExprIt.hasNext();) {
450
			GenFeatureValueSpec __genValueExpression = (GenFeatureValueSpec)javaExprIt.next();
451
			GenClassifier __genExprContext = (GenClassifier)javaInitializers.get(__genValueExpression);
452
			GenExpressionProviderBase provider = expressionProviders.getProvider(__genValueExpression);
453
			if(!(provider instanceof GenJavaExpressionProvider)) continue;
454
			String __genExprResultType = provider.getQualifiedInstanceClassName(__genValueExpression.getFeature());
455
456
    stringBuffer.append(TEXT_62);
457
    
458
/* 
459
ValueExpression __genValueExpression
460
java.util.Map __exprEnvVariables
461
GenClassifier __genExprContext
462
GenClassifier || String/qualifiedClassName/__genExprResultType
463
*/
464
org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
465
if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) {
466
	String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
467
	// support GenClassifier and also String based qualified java class name
468
	Object __genExprResultTypeObj = __genExprResultType;
469
	String __exprResultTypeQualifiedName = null;
470
	if(__genExprResultTypeObj instanceof String) 
471
		__exprResultTypeQualifiedName = (String)__genExprResultTypeObj;
472
	else if(__genExprResultTypeObj instanceof org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)
473
		__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
474
	String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
475
476
    stringBuffer.append(TEXT_63);
477
    stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
478
    stringBuffer.append(TEXT_64);
479
    stringBuffer.append(__exprJavaOperName);
480
    stringBuffer.append(TEXT_65);
481
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
482
    stringBuffer.append(TEXT_66);
483
    
484
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
485
		String __nextVarName = (String)envVarIt.next();
486
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(__nextVarName);
487
		String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
488
489
	
490
    stringBuffer.append(TEXT_67);
491
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
492
    stringBuffer.append(TEXT_68);
493
    stringBuffer.append(__nextVarName);
494
    	} 
495
496
    stringBuffer.append(TEXT_69);
497
    stringBuffer.append(__exprJavaOperName);
498
    stringBuffer.append(TEXT_70);
499
    
500
}
501
502
    
503
		}
504
505
    stringBuffer.append(TEXT_71);
506
    stringBuffer.append(javaExprContainer);
507
    	} /* end of javaInitializers */ 
508
    
509
}
510
}	//end local block that separates initializers and constraints
511
512
    stringBuffer.append(TEXT_72);
513
    
514
final GenExpressionProviderContainer expressionProviders = genDiagram.getEditorGen().getExpressionProviders();
515
if (genDiagram.hasLinkCreationConstraints() && expressionProviders != null) {
516
	String pluginActivatorClass = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName());
517
	String importedAbstractExprCls = importManager.getImportedName(expressionProviders.getAbstractExpressionQualifiedClassName());
518
	boolean hasJavaConstraints = false;
519
520
    stringBuffer.append(TEXT_73);
521
    stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName());
522
    stringBuffer.append(TEXT_74);
523
    
524
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
525
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
526
		if(linkConstraints == null) continue;
527
		if(linkConstraints.getSourceEndContextClass() == null || linkConstraints.getTargetEndContextClass() == null) continue;
528
		hasJavaConstraints |= (linkConstraints.getSourceEnd() != null && expressionProviders.getProvider(linkConstraints.getSourceEnd()) instanceof GenJavaExpressionProvider) ||
529
							(linkConstraints.getTargetEnd() != null && expressionProviders.getProvider(linkConstraints.getTargetEnd()) instanceof GenJavaExpressionProvider);
530
531
    stringBuffer.append(TEXT_75);
532
    stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName());
533
    stringBuffer.append(TEXT_76);
534
    stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName());
535
    stringBuffer.append(TEXT_77);
536
    stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName());
537
    stringBuffer.append(TEXT_78);
538
    
539
	} // end of link iteration
540
541
    stringBuffer.append(TEXT_79);
542
    
543
	final String oppositeEndVarName = "oppositeEnd";
544
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
545
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
546
		if(linkConstraints == null) continue;
547
		GenClass srcContext = linkConstraints.getSourceEndContextClass();
548
		GenClass targetContext = linkConstraints.getTargetEndContextClass();
549
		if(srcContext == null || targetContext == null) continue;
550
551
    stringBuffer.append(TEXT_80);
552
    stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName());
553
    stringBuffer.append(TEXT_81);
554
    stringBuffer.append(linkConstraints.getConstraintsInstanceFieldName());
555
    stringBuffer.append(TEXT_82);
556
    
557
		String __javaOperationContainer = javaConstraintsContainer;
558
		Map __exprEnvVariables = new java.util.HashMap();
559
		String __outEnvVarName = "sourceEnv";
560
		GenClassifier __genExprContext = srcContext;
561
		ValueExpression __genValueExpression = linkConstraints.getSourceEnd();
562
		__exprEnvVariables.put(oppositeEndVarName, targetContext); //$NON-NLS-1$
563
564
565
    
566
{ /*begin the scope*/
567
/*
568
java.util.Map __exprEnvVariables
569
String __outEnvVarName;
570
*/
571
if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProviders() != null && 
572
	genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) 
573
	instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {	
574
575
    stringBuffer.append(TEXT_83);
576
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
577
    stringBuffer.append(TEXT_84);
578
    stringBuffer.append(__outEnvVarName);
579
    stringBuffer.append(TEXT_85);
580
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
581
    stringBuffer.append(TEXT_86);
582
    
583
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
584
		String nextVariableName = (String)envVarIt.next();
585
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
586
		String varTypeEClassifierAccess = nextVariableType.getGenPackage().getQualifiedPackageInterfaceName() + ".eINSTANCE.get" + nextVariableType.getClassifierAccessorName()+"()";			
587
588
589
    stringBuffer.append(__outEnvVarName);
590
    stringBuffer.append(TEXT_87);
591
    stringBuffer.append(nextVariableName);
592
    stringBuffer.append(TEXT_88);
593
    stringBuffer.append(varTypeEClassifierAccess);
594
    stringBuffer.append(TEXT_89);
595
    	
596
	} 
597
}
598
599
    
600
} /*end the scope*/
601
602
    stringBuffer.append(TEXT_90);
603
    stringBuffer.append(importedAbstractExprCls);
604
    stringBuffer.append(TEXT_91);
605
    
606
		if(linkConstraints.getSourceEnd() != null) {
607
608
    
609
{ /*begin the scope*/
610
/*
611
ValueExpression __genValueExpression;
612
GenClassifier __genExprContext
613
java.util.Map __exprEnvVariables
614
String __outEnvVarName;
615
String __javaOperationContainer;
616
*/
617
	org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
618
	String __ctxEClassifierAccess = importManager.getImportedName(__genExprContext.getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + __genExprContext.getClassifierAccessorName()+"()";
619
	String __importedAbstractClass = __genExprProvider != null ? importManager.getImportedName(__genExprProvider.getContainer().getAbstractExpressionQualifiedClassName()) : null;
620
621
	if(__genExprProvider == null || __importedAbstractClass == null) {
622
623
    stringBuffer.append(TEXT_92);
624
    
625
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
626
		org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
627
		String __expressionAccessor = interpreter.getExpressionAccessor(__genValueExpression);
628
		String providerImportedClass = importManager.getImportedName(interpreter.getQualifiedClassName());
629
		if(!__exprEnvVariables.isEmpty()) {			
630
631
    stringBuffer.append(providerImportedClass);
632
    stringBuffer.append(TEXT_93);
633
    stringBuffer.append(__expressionAccessor);
634
    stringBuffer.append(TEXT_94);
635
    stringBuffer.append(__genValueExpression.getBody());
636
    stringBuffer.append(TEXT_95);
637
    stringBuffer.append(__ctxEClassifierAccess);
638
    stringBuffer.append(TEXT_96);
639
    stringBuffer.append(__outEnvVarName);
640
    stringBuffer.append(TEXT_97);
641
    
642
		} else { 		
643
644
    stringBuffer.append(providerImportedClass);
645
    stringBuffer.append(TEXT_98);
646
    stringBuffer.append(__expressionAccessor);
647
    stringBuffer.append(TEXT_99);
648
    stringBuffer.append(__genValueExpression.getBody());
649
    stringBuffer.append(TEXT_100);
650
    stringBuffer.append(__ctxEClassifierAccess);
651
    stringBuffer.append(TEXT_101);
652
    
653
		}
654
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
655
		String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
656
		String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);	
657
658
659
    stringBuffer.append(TEXT_102);
660
    stringBuffer.append(__importedAbstractClass);
661
    stringBuffer.append(TEXT_103);
662
    stringBuffer.append(__ctxEClassifierAccess);
663
    stringBuffer.append(TEXT_104);
664
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
665
    stringBuffer.append(TEXT_105);
666
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
667
    stringBuffer.append(TEXT_106);
668
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
669
    stringBuffer.append(TEXT_107);
670
    	
671
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
672
			String nextVariableName = (String)envVarIt.next();
673
			org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
674
			String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
675
676
    stringBuffer.append(TEXT_108);
677
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
678
    stringBuffer.append(TEXT_109);
679
    stringBuffer.append(nextVariableName);
680
    stringBuffer.append(TEXT_110);
681
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
682
    stringBuffer.append(TEXT_111);
683
    stringBuffer.append(nextVariableName);
684
    stringBuffer.append(TEXT_112);
685
    		} 
686
    stringBuffer.append(TEXT_113);
687
    
688
		if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { 
689
    stringBuffer.append(__javaOperationContainer);
690
    stringBuffer.append(TEXT_114);
691
    
692
		} 
693
    stringBuffer.append(__exprJavaOperName);
694
    stringBuffer.append(TEXT_115);
695
    
696
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
697
    stringBuffer.append(TEXT_116);
698
    stringBuffer.append((String)envVarIt.next());
699
    }
700
    stringBuffer.append(TEXT_117);
701
    }
702
    } /*end of scope*/
703
    
704
		} else 
705
    stringBuffer.append(TEXT_118);
706
    ;
707
    stringBuffer.append(TEXT_119);
708
    
709
		__outEnvVarName = "targetEnv";
710
		__genExprContext = targetContext;
711
		__genValueExpression = linkConstraints.getTargetEnd();			
712
		__exprEnvVariables.put(oppositeEndVarName, srcContext); //$NON-NLS-1$
713
714
    
715
{ /*begin the scope*/
716
/*
717
java.util.Map __exprEnvVariables
718
String __outEnvVarName;
719
*/
720
if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProviders() != null && 
721
	genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) 
722
	instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {	
723
724
    stringBuffer.append(TEXT_120);
725
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
726
    stringBuffer.append(TEXT_121);
727
    stringBuffer.append(__outEnvVarName);
728
    stringBuffer.append(TEXT_122);
729
    stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
730
    stringBuffer.append(TEXT_123);
731
    
732
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
733
		String nextVariableName = (String)envVarIt.next();
734
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
735
		String varTypeEClassifierAccess = nextVariableType.getGenPackage().getQualifiedPackageInterfaceName() + ".eINSTANCE.get" + nextVariableType.getClassifierAccessorName()+"()";			
736
737
738
    stringBuffer.append(__outEnvVarName);
739
    stringBuffer.append(TEXT_124);
740
    stringBuffer.append(nextVariableName);
741
    stringBuffer.append(TEXT_125);
742
    stringBuffer.append(varTypeEClassifierAccess);
743
    stringBuffer.append(TEXT_126);
744
    	
745
	} 
746
}
747
748
    
749
} /*end the scope*/
750
751
    stringBuffer.append(TEXT_127);
752
    stringBuffer.append(importedAbstractExprCls);
753
    stringBuffer.append(TEXT_128);
754
    
755
		if(linkConstraints.getTargetEnd() != null) {
756
757
    
758
{ /*begin the scope*/
759
/*
760
ValueExpression __genValueExpression;
761
GenClassifier __genExprContext
762
java.util.Map __exprEnvVariables
763
String __outEnvVarName;
764
String __javaOperationContainer;
765
*/
766
	org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
767
	String __ctxEClassifierAccess = importManager.getImportedName(__genExprContext.getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + __genExprContext.getClassifierAccessorName()+"()";
768
	String __importedAbstractClass = __genExprProvider != null ? importManager.getImportedName(__genExprProvider.getContainer().getAbstractExpressionQualifiedClassName()) : null;
769
770
	if(__genExprProvider == null || __importedAbstractClass == null) {
771
772
    stringBuffer.append(TEXT_129);
773
    
774
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
775
		org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
776
		String __expressionAccessor = interpreter.getExpressionAccessor(__genValueExpression);
777
		String providerImportedClass = importManager.getImportedName(interpreter.getQualifiedClassName());
778
		if(!__exprEnvVariables.isEmpty()) {			
779
780
    stringBuffer.append(providerImportedClass);
781
    stringBuffer.append(TEXT_130);
782
    stringBuffer.append(__expressionAccessor);
783
    stringBuffer.append(TEXT_131);
784
    stringBuffer.append(__genValueExpression.getBody());
785
    stringBuffer.append(TEXT_132);
786
    stringBuffer.append(__ctxEClassifierAccess);
787
    stringBuffer.append(TEXT_133);
788
    stringBuffer.append(__outEnvVarName);
789
    stringBuffer.append(TEXT_134);
790
    
791
		} else { 		
792
793
    stringBuffer.append(providerImportedClass);
794
    stringBuffer.append(TEXT_135);
795
    stringBuffer.append(__expressionAccessor);
796
    stringBuffer.append(TEXT_136);
797
    stringBuffer.append(__genValueExpression.getBody());
798
    stringBuffer.append(TEXT_137);
799
    stringBuffer.append(__ctxEClassifierAccess);
800
    stringBuffer.append(TEXT_138);
801
    
802
		}
803
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
804
		String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
805
		String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);	
806
807
808
    stringBuffer.append(TEXT_139);
809
    stringBuffer.append(__importedAbstractClass);
810
    stringBuffer.append(TEXT_140);
811
    stringBuffer.append(__ctxEClassifierAccess);
812
    stringBuffer.append(TEXT_141);
813
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
814
    stringBuffer.append(TEXT_142);
815
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
816
    stringBuffer.append(TEXT_143);
817
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
818
    stringBuffer.append(TEXT_144);
819
    	
820
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
821
			String nextVariableName = (String)envVarIt.next();
822
			org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
823
			String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
824
825
    stringBuffer.append(TEXT_145);
826
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
827
    stringBuffer.append(TEXT_146);
828
    stringBuffer.append(nextVariableName);
829
    stringBuffer.append(TEXT_147);
830
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
831
    stringBuffer.append(TEXT_148);
832
    stringBuffer.append(nextVariableName);
833
    stringBuffer.append(TEXT_149);
834
    		} 
835
    stringBuffer.append(TEXT_150);
836
    
837
		if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { 
838
    stringBuffer.append(__javaOperationContainer);
839
    stringBuffer.append(TEXT_151);
840
    
841
		} 
842
    stringBuffer.append(__exprJavaOperName);
843
    stringBuffer.append(TEXT_152);
844
    
845
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){
846
    stringBuffer.append(TEXT_153);
847
    stringBuffer.append((String)envVarIt.next());
848
    }
849
    stringBuffer.append(TEXT_154);
850
    }
851
    } /*end of scope*/
852
    
853
		} else 
854
    stringBuffer.append(TEXT_155);
855
    ;
856
    stringBuffer.append(TEXT_156);
857
    stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName());
858
    stringBuffer.append(TEXT_157);
859
    
860
	} // end of link iteration
861
862
    stringBuffer.append(TEXT_158);
863
    stringBuffer.append(importedAbstractExprCls);
864
    stringBuffer.append(TEXT_159);
865
    stringBuffer.append(importedAbstractExprCls);
866
    stringBuffer.append(TEXT_160);
867
    stringBuffer.append(genDiagram.getLinkCreationConstraintsClassName());
868
    stringBuffer.append(TEXT_161);
869
    stringBuffer.append(importedAbstractExprCls);
870
    stringBuffer.append(TEXT_162);
871
    stringBuffer.append(importedAbstractExprCls);
872
    stringBuffer.append(TEXT_163);
873
    stringBuffer.append(importedAbstractExprCls);
874
    stringBuffer.append(TEXT_164);
875
    stringBuffer.append(importedAbstractExprCls);
876
    stringBuffer.append(TEXT_165);
877
    stringBuffer.append(importedAbstractExprCls);
878
    stringBuffer.append(TEXT_166);
879
    stringBuffer.append(importManager.getImportedName("java.util.Map"));
880
    stringBuffer.append(TEXT_167);
881
    stringBuffer.append(importManager.getImportedName("java.util.Collections"));
882
    stringBuffer.append(TEXT_168);
883
    stringBuffer.append(pluginActivatorClass);
884
    stringBuffer.append(TEXT_169);
885
    
886
if(hasJavaConstraints) {
887
888
    stringBuffer.append(TEXT_170);
889
    stringBuffer.append(javaConstraintsContainer);
890
    stringBuffer.append(TEXT_171);
891
    
892
	for (Iterator it = genDiagram.getLinks().iterator(); it.hasNext();) {
893
		GenLinkConstraints linkConstraints = ((GenLink)it.next()).getCreationConstraints();
894
		if(linkConstraints == null) continue;
895
		GenClass srcContext = linkConstraints.getSourceEndContextClass();
896
		GenClass targetContext = linkConstraints.getTargetEndContextClass();
897
		if(srcContext == null || targetContext == null) continue;
898
		String __genExprResultType = "java.lang.Boolean";
899
		Map __exprEnvVariables = new java.util.HashMap();
900
		GenClassifier __genExprContext = srcContext;
901
		ValueExpression __genValueExpression = linkConstraints.getSourceEnd();
902
		if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider) {				
903
			__exprEnvVariables.put(oppositeEndVarName, targetContext);
904
905
    stringBuffer.append(TEXT_172);
906
    
907
/* 
908
ValueExpression __genValueExpression
909
java.util.Map __exprEnvVariables
910
GenClassifier __genExprContext
911
GenClassifier || String/qualifiedClassName/__genExprResultType
912
*/
913
org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
914
if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) {
915
	String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
916
	// support GenClassifier and also String based qualified java class name
917
	Object __genExprResultTypeObj = __genExprResultType;
918
	String __exprResultTypeQualifiedName = null;
919
	if(__genExprResultTypeObj instanceof String) 
920
		__exprResultTypeQualifiedName = (String)__genExprResultTypeObj;
921
	else if(__genExprResultTypeObj instanceof org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)
922
		__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
923
	String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
924
925
    stringBuffer.append(TEXT_173);
926
    stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
927
    stringBuffer.append(TEXT_174);
928
    stringBuffer.append(__exprJavaOperName);
929
    stringBuffer.append(TEXT_175);
930
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
931
    stringBuffer.append(TEXT_176);
932
    
933
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
934
		String __nextVarName = (String)envVarIt.next();
935
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(__nextVarName);
936
		String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
937
938
	
939
    stringBuffer.append(TEXT_177);
940
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
941
    stringBuffer.append(TEXT_178);
942
    stringBuffer.append(__nextVarName);
943
    	} 
944
945
    stringBuffer.append(TEXT_179);
946
    stringBuffer.append(__exprJavaOperName);
947
    stringBuffer.append(TEXT_180);
948
    
949
}
950
951
    
952
		}
953
		__genValueExpression = linkConstraints.getTargetEnd();
954
		if(expressionProviders.getProvider(__genValueExpression) instanceof GenJavaExpressionProvider) {		
955
			__genExprContext = targetContext;
956
			__exprEnvVariables.put(oppositeEndVarName, srcContext);
957
958
    stringBuffer.append(TEXT_181);
959
    
960
/* 
961
ValueExpression __genValueExpression
962
java.util.Map __exprEnvVariables
963
GenClassifier __genExprContext
964
GenClassifier || String/qualifiedClassName/__genExprResultType
965
*/
966
org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
967
if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) {
968
	String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
969
	// support GenClassifier and also String based qualified java class name
970
	Object __genExprResultTypeObj = __genExprResultType;
971
	String __exprResultTypeQualifiedName = null;
972
	if(__genExprResultTypeObj instanceof String) 
973
		__exprResultTypeQualifiedName = (String)__genExprResultTypeObj;
974
	else if(__genExprResultTypeObj instanceof org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)
975
		__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
976
	String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
977
978
    stringBuffer.append(TEXT_182);
979
    stringBuffer.append(importManager.getImportedName(__exprResultTypeQualifiedName));
980
    stringBuffer.append(TEXT_183);
981
    stringBuffer.append(__exprJavaOperName);
982
    stringBuffer.append(TEXT_184);
983
    stringBuffer.append(importManager.getImportedName(evalCtxQualifiedName));
984
    stringBuffer.append(TEXT_185);
985
    
986
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
987
		String __nextVarName = (String)envVarIt.next();
988
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(__nextVarName);
989
		String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
990
991
	
992
    stringBuffer.append(TEXT_186);
993
    stringBuffer.append(importManager.getImportedName(qualifiedTypeName));
994
    stringBuffer.append(TEXT_187);
995
    stringBuffer.append(__nextVarName);
996
    	} 
997
998
    stringBuffer.append(TEXT_188);
999
    stringBuffer.append(__exprJavaOperName);
1000
    stringBuffer.append(TEXT_189);
1001
    
1002
}
1003
1004
    
1005
		}
1006
	} /*java constraints iteration*/
1007
1008
    stringBuffer.append(TEXT_190);
1009
    stringBuffer.append(javaConstraintsContainer);
1010
    
1011
} /* end of hasJavaConstraints */
1012
1013
    stringBuffer.append(TEXT_191);
1014
    } /*end of hasLinkCreationConstraints()*/ 
1015
    stringBuffer.append(TEXT_192);
187
    importManager.emitSortedImports();
1016
    importManager.emitSortedImports();
188
    stringBuffer.append(TEXT_39);
1017
    stringBuffer.append(TEXT_193);
189
    return stringBuffer.toString();
1018
    return stringBuffer.toString();
190
  }
1019
  }
191
}
1020
}
(-)templates/expressions/javaExpressionOperation.jetinc (+39 lines)
Added Link Here
1
<%
2
/* 
3
ValueExpression __genValueExpression
4
java.util.Map __exprEnvVariables
5
GenClassifier __genExprContext
6
GenClassifier || String/qualifiedClassName/__genExprResultType
7
*/
8
org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
9
if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) {
10
	String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
11
	// support GenClassifier and also String based qualified java class name
12
	Object __genExprResultTypeObj = __genExprResultType;
13
	String __exprResultTypeQualifiedName = null;
14
	if(__genExprResultTypeObj instanceof String) 
15
		__exprResultTypeQualifiedName = (String)__genExprResultTypeObj;
16
	else if(__genExprResultTypeObj instanceof org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)
17
		__exprResultTypeQualifiedName = __genExprProvider.getQualifiedInstanceClassName((org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__genExprResultTypeObj);
18
	String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);
19
%>
20
/**
21
 * @generated
22
 */
23
private static <%=importManager.getImportedName(__exprResultTypeQualifiedName)%> <%=__exprJavaOperName%>(<%=importManager.getImportedName(evalCtxQualifiedName)%> self<%
24
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
25
		String __nextVarName = (String)envVarIt.next();
26
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(__nextVarName);
27
		String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
28
29
	%>, <%=importManager.getImportedName(qualifiedTypeName)%> <%=__nextVarName%>
30
<%	} 
31
%>) {
32
	// TODO: implement this method
33
	// Ensure that you remove @generated or mark it @generated NOT
34
	
35
	throw new UnsupportedOperationException("No user implementation provided in '<%=__exprJavaOperName%>' operation"); //$NON-NLS-1$
36
}
37
<%
38
}
39
%>
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/expressions/OCLExpressionFactoryGenerator.java (+90 lines)
Added Link Here
1
package org.eclipse.gmf.codegen.templates.lite.expressions;
2
3
import org.eclipse.gmf.codegen.gmfgen.*;
4
import org.eclipse.gmf.common.codegen.*;
5
6
public class OCLExpressionFactoryGenerator
7
{
8
  protected static String nl;
9
  public static synchronized OCLExpressionFactoryGenerator create(String lineSeparator)
10
  {
11
    nl = lineSeparator;
12
    OCLExpressionFactoryGenerator result = new OCLExpressionFactoryGenerator();
13
    nl = null;
14
    return result;
15
  }
16
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = NL + "/*" + NL + " * ";
20
  protected final String TEXT_3 = NL + " */";
21
  protected final String TEXT_4 = NL;
22
  protected final String TEXT_5 = NL;
23
  protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
24
  protected final String TEXT_7 = " {" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
25
  protected final String TEXT_8 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
26
  protected final String TEXT_9 = " getExpression(String body, EClassifier context, Map environment) {\t\t" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tpublic static ";
27
  protected final String TEXT_10 = " getExpression(String body, EClassifier context) {\t\t" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}\t" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */\t" + NL + "\tprivate static class Expression extends ";
28
  protected final String TEXT_11 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate Query query;" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t\t" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context, environment);" + NL + "\t\t\t" + NL + "\t\t\tIOCLHelper oclHelper = (environment.isEmpty()) ? " + NL + "\t\t\t\t\tHelperUtil.createOCLHelper() :" + NL + "\t\t\t\t\tHelperUtil.createOCLHelper(createCustomEnv(environment));" + NL + "\t\t\toclHelper.setContext(context());" + NL + "\t\t\ttry {" + NL + "\t\t\t\tOCLExpression oclExpression = oclHelper.createQuery(body);" + NL + "\t\t\t\tthis.query = QueryFactory.eINSTANCE.createQuery(oclExpression);" + NL + "\t\t\t} catch (OCLParsingException e) {" + NL + "\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t}\t\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\tif (query == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tEvaluationEnvironment evalEnv = query.getEvaluationEnvironment();" + NL + "\t\t\t// init environment" + NL + "\t\t\tfor (Iterator it = env.entrySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\tMap.Entry nextEntry = (Map.Entry) it.next();" + NL + "\t\t\t\tevalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());\t\t\t\t\t" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\ttry {" + NL + "\t\t\t\tObject result = query.evaluate(context);" + NL + "\t\t\t\treturn (result != Types.OCL_INVALID) ? result : null;" + NL + "\t\t\t} finally {" + NL + "\t\t\t\tevalEnv.clear();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static EcoreEnvironmentFactory createCustomEnv(Map environment) {" + NL + "\t\t\tfinal Map env = environment;" + NL + "\t\t\treturn new EcoreEnvironmentFactory() {\t\t\t\t\t" + NL + "\t\t\t\tpublic Environment createClassifierContext(Object context) {" + NL + "\t\t\t\t\tEnvironment ecoreEnv = super.createClassifierContext(context);" + NL + "\t\t\t\t\tfor (Iterator it = env.keySet().iterator(); it.hasNext();) {" + NL + "\t\t\t\t\t\tString varName = (String)it.next();" + NL + "\t\t\t\t\t\tEClassifier varType = (EClassifier)env.get(varName);" + NL + "\t\t\t\t\t\tecoreEnv.addElement(varName, createVar(varName, varType), true);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\treturn ecoreEnv;" + NL + "\t\t\t\t}" + NL + "\t\t\t};\t\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */\t\t" + NL + "\t\tprivate static Variable createVar(String name, EClassifier type) {" + NL + "\t\t\tVariable var = ExpressionsFactory.eINSTANCE.createVariable();" + NL + "\t\t\tvar.setName(name);" + NL + "\t\t\tvar.setType(EcoreEnvironment.getOCLType(type));" + NL + "\t\t\treturn var;" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "}";
29
  protected final String TEXT_12 = NL;
30
31
  public String generate(Object argument)
32
  {
33
    final StringBuffer stringBuffer = new StringBuffer();
34
    
35
final GenExpressionInterpreter genInterpreter = (GenExpressionInterpreter) ((Object[]) argument)[0];
36
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
37
final GenDiagram genDiagram = genInterpreter.getContainer().getEditorGen().getDiagram();
38
final String factoryClassName = genInterpreter.getClassName();
39
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
40
41
    stringBuffer.append(TEXT_1);
42
    
43
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
44
if (copyrightText != null && copyrightText.trim().length() > 0) {
45
46
    stringBuffer.append(TEXT_2);
47
    stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
48
    stringBuffer.append(TEXT_3);
49
    }
50
    importManager.emitPackageStatement(stringBuffer);
51
    stringBuffer.append(TEXT_4);
52
    importManager.markImportLocation(stringBuffer);
53
    stringBuffer.append(TEXT_5);
54
    
55
importManager.registerInnerClass("Expression");
56
importManager.addImport("java.util.Collections");
57
importManager.addImport("java.util.Iterator");
58
importManager.addImport("java.util.Map");
59
importManager.addImport("org.eclipse.core.runtime.IStatus");
60
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
61
importManager.addImport("org.eclipse.emf.ocl.expressions.ExpressionsFactory");
62
importManager.addImport("org.eclipse.emf.ocl.expressions.OCLExpression");
63
importManager.addImport("org.eclipse.emf.ocl.expressions.Variable");
64
importManager.addImport("org.eclipse.emf.ocl.helper.HelperUtil");
65
importManager.addImport("org.eclipse.emf.ocl.helper.IOCLHelper");
66
importManager.addImport("org.eclipse.emf.ocl.helper.OCLParsingException");
67
importManager.addImport("org.eclipse.emf.ocl.parser.EcoreEnvironment");
68
importManager.addImport("org.eclipse.emf.ocl.parser.EcoreEnvironmentFactory");
69
importManager.addImport("org.eclipse.emf.ocl.parser.EvaluationEnvironment");
70
importManager.addImport("org.eclipse.emf.ocl.parser.Environment");
71
importManager.addImport("org.eclipse.emf.ocl.query.Query");
72
importManager.addImport("org.eclipse.emf.ocl.query.QueryFactory");
73
importManager.addImport("org.eclipse.emf.ocl.types.util.Types");
74
75
    stringBuffer.append(TEXT_6);
76
    stringBuffer.append(factoryClassName);
77
    stringBuffer.append(TEXT_7);
78
    stringBuffer.append(factoryClassName);
79
    stringBuffer.append(TEXT_8);
80
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
81
    stringBuffer.append(TEXT_9);
82
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
83
    stringBuffer.append(TEXT_10);
84
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
85
    stringBuffer.append(TEXT_11);
86
    importManager.emitSortedImports();
87
    stringBuffer.append(TEXT_12);
88
    return stringBuffer.toString();
89
  }
90
}
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/expressions/AbstractExpressionGenerator.java (+83 lines)
Added Link Here
1
package org.eclipse.gmf.codegen.templates.lite.expressions;
2
3
import org.eclipse.gmf.codegen.gmfgen.*;
4
import org.eclipse.gmf.common.codegen.*;
5
6
public class AbstractExpressionGenerator
7
{
8
  protected static String nl;
9
  public static synchronized AbstractExpressionGenerator create(String lineSeparator)
10
  {
11
    nl = lineSeparator;
12
    AbstractExpressionGenerator result = new AbstractExpressionGenerator();
13
    nl = null;
14
    return result;
15
  }
16
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = NL + "/*" + NL + " * ";
20
  protected final String TEXT_3 = NL + " */";
21
  protected final String TEXT_4 = NL;
22
  protected final String TEXT_5 = NL;
23
  protected final String TEXT_6 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public abstract class ";
24
  protected final String TEXT_7 = " {\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate String body;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EClassifier context;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprivate IStatus status = Status.OK_STATUS;\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
25
  protected final String TEXT_8 = "(EClassifier context) {" + NL + "\t\tthis.context = context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected ";
26
  protected final String TEXT_9 = "(String body, EClassifier context, Map env) {" + NL + "\t\tthis.body = body;" + NL + "\t\tthis.context = context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected void setStatus(int severity, String message, Throwable throwable) {\t\t" + NL + "\t\tString pluginID = ";
27
  protected final String TEXT_10 = ".ID;" + NL + "\t\tthis.status = new Status(severity, pluginID, -1, (message != null) ? message : \"\", throwable); //$NON-NLS-1$" + NL + "\t\tif(!this.status.isOK()) {" + NL + "\t\t\t";
28
  protected final String TEXT_11 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression problem:\" + message + \"body:\"+ body, throwable); //$NON-NLS-1$ //$NON-NLS-2$" + NL + "\t\t" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tprotected abstract Object doEvaluate(Object context, Map env);" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context) {" + NL + "\t\treturn evaluate(context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic Object evaluate(Object context, Map env) {" + NL + "\t\tif(context().isInstance(context)) {" + NL + "\t\t\ttry {" + NL + "\t\t\t\treturn doEvaluate(context, env);" + NL + "\t\t\t} catch(Exception e) {" + NL + "\t\t\t\t";
29
  protected final String TEXT_12 = NL + "\t\t\t\t\t.getInstance().logError(\"Expression evaluation failure: \" + body, e);" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic IStatus getStatus() {" + NL + "\t\treturn status;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic String body() {" + NL + "\t\treturn body;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EClassifier context() {" + NL + "\t\treturn context;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\tpublic static final ";
30
  protected final String TEXT_13 = " createNullExpression(EClassifier context) {" + NL + "\t\treturn new ";
31
  protected final String TEXT_14 = "(context) {" + NL + "\t\t\tprotected Object doEvaluate(Object context, Map env) {" + NL + "\t\t\t\t// TODO - log entry about not provider available for this expression" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "\t}" + NL + "}";
32
  protected final String TEXT_15 = NL;
33
34
  public String generate(Object argument)
35
  {
36
    final StringBuffer stringBuffer = new StringBuffer();
37
    
38
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
39
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
40
final GenExpressionProviderContainer providerContainer = genDiagram.getEditorGen().getExpressionProviders();
41
42
    stringBuffer.append(TEXT_1);
43
    
44
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
45
if (copyrightText != null && copyrightText.trim().length() > 0) {
46
47
    stringBuffer.append(TEXT_2);
48
    stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
49
    stringBuffer.append(TEXT_3);
50
    }
51
    importManager.emitPackageStatement(stringBuffer);
52
    stringBuffer.append(TEXT_4);
53
    importManager.markImportLocation(stringBuffer);
54
    stringBuffer.append(TEXT_5);
55
    
56
importManager.addImport("java.util.Collections");
57
importManager.addImport("java.util.Map");
58
importManager.addImport("org.eclipse.core.runtime.IStatus");
59
importManager.addImport("org.eclipse.core.runtime.Status");
60
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
61
62
    stringBuffer.append(TEXT_6);
63
    stringBuffer.append(providerContainer.getAbstractExpressionClassName());
64
    stringBuffer.append(TEXT_7);
65
    stringBuffer.append(providerContainer.getAbstractExpressionClassName());
66
    stringBuffer.append(TEXT_8);
67
    stringBuffer.append(providerContainer.getAbstractExpressionClassName());
68
    stringBuffer.append(TEXT_9);
69
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
70
    stringBuffer.append(TEXT_10);
71
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
72
    stringBuffer.append(TEXT_11);
73
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
74
    stringBuffer.append(TEXT_12);
75
    stringBuffer.append(providerContainer.getAbstractExpressionClassName());
76
    stringBuffer.append(TEXT_13);
77
    stringBuffer.append(providerContainer.getAbstractExpressionClassName());
78
    stringBuffer.append(TEXT_14);
79
    importManager.emitSortedImports();
80
    stringBuffer.append(TEXT_15);
81
    return stringBuffer.toString();
82
  }
83
}
(-)templates/expressions/getExpression.jetinc (+49 lines)
Added Link Here
1
<%
2
{ /*begin the scope*/
3
/*
4
ValueExpression __genValueExpression;
5
GenClassifier __genExprContext
6
java.util.Map __exprEnvVariables
7
String __outEnvVarName;
8
String __javaOperationContainer;
9
*/
10
	org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase __genExprProvider = (genDiagram.getEditorGen().getExpressionProviders() != null) ? genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) : null;
11
	String __ctxEClassifierAccess = importManager.getImportedName(__genExprContext.getGenPackage().getQualifiedPackageInterfaceName()) + ".eINSTANCE.get" + __genExprContext.getClassifierAccessorName()+"()";
12
	String __importedAbstractClass = __genExprProvider != null ? importManager.getImportedName(__genExprProvider.getContainer().getAbstractExpressionQualifiedClassName()) : null;
13
14
	if(__genExprProvider == null || __importedAbstractClass == null) {
15
%>null<%
16
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {
17
		org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter interpreter = (org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter)__genExprProvider;
18
		String __expressionAccessor = interpreter.getExpressionAccessor(__genValueExpression);
19
		String providerImportedClass = importManager.getImportedName(interpreter.getQualifiedClassName());
20
		if(!__exprEnvVariables.isEmpty()) {			
21
%><%=providerImportedClass%>.<%=__expressionAccessor%>("<%=__genValueExpression.getBody()%>", //$NON-NLS-1$
22
	<%=__ctxEClassifierAccess%>, <%=__outEnvVarName%>)<%
23
		} else { 		
24
%><%=providerImportedClass%>.<%=__expressionAccessor%>("<%=__genValueExpression.getBody()%>", //$NON-NLS-1$
25
	<%=__ctxEClassifierAccess%>)<%
26
		}
27
	} else if(__genExprProvider instanceof org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider) { /*inlined java expression adapter*/
28
		String evalCtxQualifiedName = __genExprProvider.getQualifiedInstanceClassName(__genExprContext);
29
		String __exprJavaOperName = ((org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider)__genExprProvider).getOperationName(__genValueExpression);	
30
31
%>new <%=__importedAbstractClass%>(<%=__ctxEClassifierAccess%>) {
32
	protected Object doEvaluate(Object context, <%=importManager.getImportedName("java.util.Map")%> env) {	
33
		<%=importManager.getImportedName(evalCtxQualifiedName)%> self = (<%=importManager.getImportedName(evalCtxQualifiedName)%>)context;
34
<%	
35
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
36
			String nextVariableName = (String)envVarIt.next();
37
			org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
38
			String qualifiedTypeName = __genExprProvider.getQualifiedInstanceClassName(nextVariableType);
39
%>	
40
		<%=importManager.getImportedName(qualifiedTypeName)%> <%=nextVariableName%> = (<%=importManager.getImportedName(qualifiedTypeName)%>)env.get("<%=nextVariableName%>"); //$NON-NLS-1$
41
<%		} %>
42
		return <%
43
		if(__javaOperationContainer != null && __javaOperationContainer.length() > 0) { %><%=__javaOperationContainer%>.<%
44
		} %><%=__exprJavaOperName%>(self<%
45
		for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();){%>, <%=(String)envVarIt.next()%><%}%>);
46
	}
47
}
48
<%}%>
49
<%} /*end of scope*/%>
(-)src-templates/org/eclipse/gmf/codegen/templates/lite/expressions/RegexpExpressionFactoryGenerator.java (+83 lines)
Added Link Here
1
package org.eclipse.gmf.codegen.templates.lite.expressions;
2
3
import org.eclipse.gmf.codegen.gmfgen.*;
4
import org.eclipse.gmf.common.codegen.*;
5
6
public class RegexpExpressionFactoryGenerator
7
{
8
  protected static String nl;
9
  public static synchronized RegexpExpressionFactoryGenerator create(String lineSeparator)
10
  {
11
    nl = lineSeparator;
12
    RegexpExpressionFactoryGenerator result = new RegexpExpressionFactoryGenerator();
13
    nl = null;
14
    return result;
15
  }
16
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = NL + "/*" + NL + " * ";
20
  protected final String TEXT_3 = NL + " */";
21
  protected final String TEXT_4 = NL;
22
  protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated " + NL + " */" + NL + "public class ";
23
  protected final String TEXT_6 = " {" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate ";
24
  protected final String TEXT_7 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
25
  protected final String TEXT_8 = " getExpression(String body," + NL + "\t\t\tEClassifier context, Map environment) {" + NL + "\t\treturn new Expression(body, context, environment);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tpublic static ";
26
  protected final String TEXT_9 = " getExpression(String body," + NL + "\t\t\tEClassifier context) {" + NL + "\t\treturn getExpression(body, context, Collections.EMPTY_MAP);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated " + NL + "\t */" + NL + "\tprivate static class Expression extends ";
27
  protected final String TEXT_10 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprivate Pattern pattern;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tpublic Expression(String body, EClassifier context, Map environment) {" + NL + "\t\t\tsuper(body, context, environment);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tthis.pattern = Pattern.compile(body);" + NL + "\t\t\t} catch (PatternSyntaxException e) {" + NL + "\t\t\t\tsetStatus(IStatus.ERROR, e.getMessage(), e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated " + NL + "\t\t */" + NL + "\t\tprotected Object doEvaluate(Object contextInstance, Map env) {" + NL + "\t\t\tif (pattern == null) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tif(context() instanceof EDataType) {" + NL + "\t\t\t\tcontextInstance = EcoreUtil.convertToString((EDataType)context(), contextInstance);" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\tMatcher matcher = this.pattern.matcher(String.valueOf(contextInstance));" + NL + "\t\t\treturn Boolean.valueOf(";
28
  protected final String TEXT_11 = "matcher.matches());" + NL + "\t\t}" + NL + "\t}" + NL + "}";
29
  protected final String TEXT_12 = NL;
30
31
  public String generate(Object argument)
32
  {
33
    final StringBuffer stringBuffer = new StringBuffer();
34
    
35
final GenExpressionInterpreter genInterpreter = (GenExpressionInterpreter) ((Object[]) argument)[0];
36
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
37
final GenDiagram genDiagram = genInterpreter.getContainer().getEditorGen().getDiagram();
38
final String factoryClassName = genInterpreter.getClassName();
39
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
40
final boolean isNegationRegexp = !"regexp".equals(genInterpreter.getLanguage());
41
42
    stringBuffer.append(TEXT_1);
43
    
44
String copyrightText = genDiagram.getEditorGen().getCopyrightText();
45
if (copyrightText != null && copyrightText.trim().length() > 0) {
46
47
    stringBuffer.append(TEXT_2);
48
    stringBuffer.append(copyrightText.replaceAll("\n", "\n * "));
49
    stringBuffer.append(TEXT_3);
50
    }
51
    importManager.emitPackageStatement(stringBuffer);
52
    stringBuffer.append(TEXT_4);
53
    importManager.markImportLocation(stringBuffer);
54
importManager.registerInnerClass("Expression");
55
56
importManager.addImport("java.util.Collections");
57
importManager.addImport("java.util.Map");
58
importManager.addImport("java.util.regex.Matcher");
59
importManager.addImport("java.util.regex.Pattern");
60
importManager.addImport("java.util.regex.PatternSyntaxException");
61
importManager.addImport("org.eclipse.core.runtime.IStatus");
62
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
63
importManager.addImport("org.eclipse.emf.ecore.EDataType");
64
importManager.addImport("org.eclipse.emf.ecore.util.EcoreUtil");
65
66
    stringBuffer.append(TEXT_5);
67
    stringBuffer.append(factoryClassName);
68
    stringBuffer.append(TEXT_6);
69
    stringBuffer.append(factoryClassName);
70
    stringBuffer.append(TEXT_7);
71
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
72
    stringBuffer.append(TEXT_8);
73
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
74
    stringBuffer.append(TEXT_9);
75
    stringBuffer.append(importManager.getImportedName(abstractExpressionClass));
76
    stringBuffer.append(TEXT_10);
77
    stringBuffer.append(isNegationRegexp ? "!" : "");
78
    stringBuffer.append(TEXT_11);
79
    importManager.emitSortedImports();
80
    stringBuffer.append(TEXT_12);
81
    return stringBuffer.toString();
82
  }
83
}
(-)templates/expressions/RegexpExpressionFactory.javajet (+92 lines)
Added Link Here
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.expressions" class="RegexpExpressionFactoryGenerator"
2
    imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*"%>
3
<%
4
final GenExpressionInterpreter genInterpreter = (GenExpressionInterpreter) ((Object[]) argument)[0];
5
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
6
final GenDiagram genDiagram = genInterpreter.getContainer().getEditorGen().getDiagram();
7
final String factoryClassName = genInterpreter.getClassName();
8
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
9
final boolean isNegationRegexp = !"regexp".equals(genInterpreter.getLanguage());
10
%>
11
<%@ include file="../copyright4java.jetinc"%>
12
<%importManager.emitPackageStatement(stringBuffer);%>
13
14
<%importManager.markImportLocation(stringBuffer);
15
importManager.registerInnerClass("Expression");
16
17
importManager.addImport("java.util.Collections");
18
importManager.addImport("java.util.Map");
19
importManager.addImport("java.util.regex.Matcher");
20
importManager.addImport("java.util.regex.Pattern");
21
importManager.addImport("java.util.regex.PatternSyntaxException");
22
importManager.addImport("org.eclipse.core.runtime.IStatus");
23
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
24
importManager.addImport("org.eclipse.emf.ecore.EDataType");
25
importManager.addImport("org.eclipse.emf.ecore.util.EcoreUtil");
26
%>
27
28
/**
29
 * @generated 
30
 */
31
public class <%=factoryClassName%> {
32
	/**
33
	 * @generated 
34
	 */
35
	private <%=factoryClassName%>() {
36
	}
37
38
	/**
39
	 * @generated 
40
	 */
41
	public static <%=importManager.getImportedName(abstractExpressionClass)%> getExpression(String body,
42
			EClassifier context, Map environment) {
43
		return new Expression(body, context, environment);
44
	}
45
46
	/**
47
	 * @generated 
48
	 */
49
	public static <%=importManager.getImportedName(abstractExpressionClass)%> getExpression(String body,
50
			EClassifier context) {
51
		return getExpression(body, context, Collections.EMPTY_MAP);
52
	}
53
54
	/**
55
	 * @generated 
56
	 */
57
	private static class Expression extends <%=importManager.getImportedName(abstractExpressionClass)%> {
58
		/**
59
		 * @generated 
60
		 */
61
		private Pattern pattern;
62
63
		/**
64
		 * @generated 
65
		 */
66
		public Expression(String body, EClassifier context, Map environment) {
67
			super(body, context, environment);
68
			try {
69
				this.pattern = Pattern.compile(body);
70
			} catch (PatternSyntaxException e) {
71
				setStatus(IStatus.ERROR, e.getMessage(), e);
72
			}
73
		}
74
75
		/**
76
		 * @generated 
77
		 */
78
		protected Object doEvaluate(Object contextInstance, Map env) {
79
			if (pattern == null) {
80
				return null;
81
			}
82
			
83
			if(context() instanceof EDataType) {
84
				contextInstance = EcoreUtil.convertToString((EDataType)context(), contextInstance);
85
			}
86
			
87
			Matcher matcher = this.pattern.matcher(String.valueOf(contextInstance));
88
			return Boolean.valueOf(<%=isNegationRegexp ? "!" : ""%>matcher.matches());
89
		}
90
	}
91
}
92
<%importManager.emitSortedImports();%>
(-)templates/expressions/initEnv.jetinc (+25 lines)
Added Link Here
1
<%
2
{ /*begin the scope*/
3
/*
4
java.util.Map __exprEnvVariables
5
String __outEnvVarName;
6
*/
7
if(!__exprEnvVariables.isEmpty() && genDiagram.getEditorGen().getExpressionProviders() != null && 
8
	genDiagram.getEditorGen().getExpressionProviders().getProvider(__genValueExpression) 
9
	instanceof org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter) {	
10
%>
11
<%=importManager.getImportedName("java.util.Map")%> <%=__outEnvVarName%> = new <%=importManager.getImportedName("java.util.HashMap")%>(3);
12
<%
13
	for(java.util.Iterator envVarIt = __exprEnvVariables.keySet().iterator(); envVarIt.hasNext();) {
14
		String nextVariableName = (String)envVarIt.next();
15
		org.eclipse.emf.codegen.ecore.genmodel.GenClassifier nextVariableType = (org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)__exprEnvVariables.get(nextVariableName);
16
		String varTypeEClassifierAccess = nextVariableType.getGenPackage().getQualifiedPackageInterfaceName() + ".eINSTANCE.get" + nextVariableType.getClassifierAccessorName()+"()";			
17
18
%><%=__outEnvVarName%>.put("<%=nextVariableName%>", <%=varTypeEClassifierAccess%>); //$NON-NLS-1$
19
<%	
20
	} 
21
}
22
%>
23
<%
24
} /*end the scope*/
25
%>
(-)templates/parts/linkConstraints.jetinc (+9 lines)
Added Link Here
1
<%
2
			if (linkConstraints != null) {
3
%>
4
			if(!<%=importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")+"."+genDiagram.getLinkCreationConstraintsClassName()+"."+linkConstraints.getConstraintsInstanceFieldName()%>.canCreateLink(<%=_source%>, <%=_target%>, false)) {
5
				return false;
6
			}
7
<%
8
			}
9
%>
(-)templates/expressions/AbstractExpression.javajet (+127 lines)
Added Link Here
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.expressions" class="AbstractExpressionGenerator"
2
    imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*"%>
3
<%
4
final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
5
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
6
final GenExpressionProviderContainer providerContainer = genDiagram.getEditorGen().getExpressionProviders();
7
%>
8
<%@ include file="../copyright4java.jetinc"%>
9
<%importManager.emitPackageStatement(stringBuffer);%>
10
11
<%importManager.markImportLocation(stringBuffer);%>
12
13
<%
14
importManager.addImport("java.util.Collections");
15
importManager.addImport("java.util.Map");
16
importManager.addImport("org.eclipse.core.runtime.IStatus");
17
importManager.addImport("org.eclipse.core.runtime.Status");
18
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
19
%>
20
21
/**
22
 * @generated
23
 */
24
public abstract class <%=providerContainer.getAbstractExpressionClassName()%> {		
25
	/**
26
	 * @generated
27
	 */
28
	private String body;
29
	/**
30
	 * @generated
31
	 */
32
	private EClassifier context;
33
	/**
34
	 * @generated
35
	 */	
36
	private IStatus status = Status.OK_STATUS;	
37
38
	/**
39
	 * @generated
40
	 */
41
	protected <%=providerContainer.getAbstractExpressionClassName()%>(EClassifier context) {
42
		this.context = context;
43
	}
44
	
45
	/**
46
	 * @generated
47
	 */	
48
	protected <%=providerContainer.getAbstractExpressionClassName()%>(String body, EClassifier context, Map env) {
49
		this.body = body;
50
		this.context = context;
51
	}
52
	
53
	/**
54
	 * @generated
55
	 */	
56
	protected void setStatus(int severity, String message, Throwable throwable) {		
57
		String pluginID = <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.ID;
58
		this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
59
		if(!this.status.isOK()) {
60
			<%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>
61
					.getInstance().logError("Expression problem:" + message + "body:"+ body, throwable); //$NON-NLS-1$ //$NON-NLS-2$
62
		
63
		}
64
	}
65
	
66
	/**
67
	 * @generated
68
	 */	
69
	protected abstract Object doEvaluate(Object context, Map env);
70
71
	/**
72
	 * @generated
73
	 */	
74
	public Object evaluate(Object context) {
75
		return evaluate(context, Collections.EMPTY_MAP);
76
	}
77
	
78
	/**
79
	 * @generated
80
	 */	
81
	public Object evaluate(Object context, Map env) {
82
		if(context().isInstance(context)) {
83
			try {
84
				return doEvaluate(context, env);
85
			} catch(Exception e) {
86
				<%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>
87
					.getInstance().logError("Expression evaluation failure: " + body, e);
88
				return null;
89
			}
90
		}
91
		return null;
92
	}
93
94
	/**
95
	 * @generated
96
	 */	
97
	public IStatus getStatus() {
98
		return status;
99
	}
100
	
101
	/**
102
	 * @generated
103
	 */	
104
	public String body() {
105
		return body;
106
	}
107
108
	/**
109
	 * @generated
110
	 */
111
	public EClassifier context() {
112
		return context;
113
	}
114
	
115
	/**
116
	 * @generated
117
	 */	
118
	public static final <%=providerContainer.getAbstractExpressionClassName()%> createNullExpression(EClassifier context) {
119
		return new <%=providerContainer.getAbstractExpressionClassName()%>(context) {
120
			protected Object doEvaluate(Object context, Map env) {
121
				// TODO - log entry about not provider available for this expression
122
				return null;
123
			}
124
		};
125
	}
126
}
127
<%importManager.emitSortedImports();%>
(-)templates/expressions/OCLExpressionFactory.javajet (+138 lines)
Added Link Here
1
<%@ jet package="org.eclipse.gmf.codegen.templates.lite.expressions" class="OCLExpressionFactoryGenerator"
2
    imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*"%>
3
<%
4
final GenExpressionInterpreter genInterpreter = (GenExpressionInterpreter) ((Object[]) argument)[0];
5
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
6
final GenDiagram genDiagram = genInterpreter.getContainer().getEditorGen().getDiagram();
7
final String factoryClassName = genInterpreter.getClassName();
8
final String abstractExpressionClass = genInterpreter.getContainer().getAbstractExpressionQualifiedClassName();
9
%>
10
<%@ include file="../copyright4java.jetinc"%>
11
<%importManager.emitPackageStatement(stringBuffer);%>
12
13
<%importManager.markImportLocation(stringBuffer);%>
14
15
<%
16
importManager.registerInnerClass("Expression");
17
importManager.addImport("java.util.Collections");
18
importManager.addImport("java.util.Iterator");
19
importManager.addImport("java.util.Map");
20
importManager.addImport("org.eclipse.core.runtime.IStatus");
21
importManager.addImport("org.eclipse.emf.ecore.EClassifier");
22
importManager.addImport("org.eclipse.emf.ocl.expressions.ExpressionsFactory");
23
importManager.addImport("org.eclipse.emf.ocl.expressions.OCLExpression");
24
importManager.addImport("org.eclipse.emf.ocl.expressions.Variable");
25
importManager.addImport("org.eclipse.emf.ocl.helper.HelperUtil");
26
importManager.addImport("org.eclipse.emf.ocl.helper.IOCLHelper");
27
importManager.addImport("org.eclipse.emf.ocl.helper.OCLParsingException");
28
importManager.addImport("org.eclipse.emf.ocl.parser.EcoreEnvironment");
29
importManager.addImport("org.eclipse.emf.ocl.parser.EcoreEnvironmentFactory");
30
importManager.addImport("org.eclipse.emf.ocl.parser.EvaluationEnvironment");
31
importManager.addImport("org.eclipse.emf.ocl.parser.Environment");
32
importManager.addImport("org.eclipse.emf.ocl.query.Query");
33
importManager.addImport("org.eclipse.emf.ocl.query.QueryFactory");
34
importManager.addImport("org.eclipse.emf.ocl.types.util.Types");
35
%>
36
37
/**
38
 * @generated 
39
 */
40
public class <%=factoryClassName%> {
41
	/**
42
	 * @generated 
43
	 */
44
	private <%=factoryClassName%>() {
45
	}
46
47
	/**
48
	 * @generated 
49
	 */	
50
	public static <%=importManager.getImportedName(abstractExpressionClass)%> getExpression(String body, EClassifier context, Map environment) {		
51
		return new Expression(body, context, environment);
52
	}
53
	
54
	/**
55
	 * @generated 
56
	 */	
57
	public static <%=importManager.getImportedName(abstractExpressionClass)%> getExpression(String body, EClassifier context) {		
58
		return getExpression(body, context, Collections.EMPTY_MAP);
59
	}	
60
	
61
	/**
62
	 * @generated 
63
	 */	
64
	private static class Expression extends <%=importManager.getImportedName(abstractExpressionClass)%> {
65
		/**
66
		 * @generated 
67
		 */		
68
		private Query query;
69
		/**
70
		 * @generated 
71
		 */			
72
		public Expression(String body, EClassifier context, Map environment) {
73
			super(body, context, environment);
74
			
75
			IOCLHelper oclHelper = (environment.isEmpty()) ? 
76
					HelperUtil.createOCLHelper() :
77
					HelperUtil.createOCLHelper(createCustomEnv(environment));
78
			oclHelper.setContext(context());
79
			try {
80
				OCLExpression oclExpression = oclHelper.createQuery(body);
81
				this.query = QueryFactory.eINSTANCE.createQuery(oclExpression);
82
			} catch (OCLParsingException e) {
83
				setStatus(IStatus.ERROR, e.getMessage(), e);
84
			}			
85
		}
86
87
		/**
88
		 * @generated 
89
		 */		
90
		protected Object doEvaluate(Object context, Map env) {
91
			if (query == null) {
92
				return null;
93
			}
94
			EvaluationEnvironment evalEnv = query.getEvaluationEnvironment();
95
			// init environment
96
			for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
97
				Map.Entry nextEntry = (Map.Entry) it.next();
98
				evalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());					
99
			}
100
			
101
			try {
102
				Object result = query.evaluate(context);
103
				return (result != Types.OCL_INVALID) ? result : null;
104
			} finally {
105
				evalEnv.clear();
106
			}
107
		}
108
		
109
		/**
110
		 * @generated 
111
		 */		
112
		private static EcoreEnvironmentFactory createCustomEnv(Map environment) {
113
			final Map env = environment;
114
			return new EcoreEnvironmentFactory() {					
115
				public Environment createClassifierContext(Object context) {
116
					Environment ecoreEnv = super.createClassifierContext(context);
117
					for (Iterator it = env.keySet().iterator(); it.hasNext();) {
118
						String varName = (String)it.next();
119
						EClassifier varType = (EClassifier)env.get(varName);
120
						ecoreEnv.addElement(varName, createVar(varName, varType), true);
121
					}
122
					return ecoreEnv;
123
				}
124
			};				
125
		}
126
		
127
		/**
128
		 * @generated 
129
		 */		
130
		private static Variable createVar(String name, EClassifier type) {
131
			Variable var = ExpressionsFactory.eINSTANCE.createVariable();
132
			var.setName(name);
133
			var.setType(EcoreEnvironment.getOCLType(type));
134
			return var;
135
		}		
136
	}
137
}
138
<%importManager.emitSortedImports();%>

Return to bug 144412