Added
Link Here
|
1 |
package org.eclipse.gmf.codegen.templates.lite.parts; |
2 |
|
3 |
import java.util.*; |
4 |
import org.eclipse.emf.codegen.ecore.genmodel.*; |
5 |
import org.eclipse.gmf.codegen.gmfgen.*; |
6 |
import org.eclipse.gmf.common.codegen.*; |
7 |
import org.eclipse.emf.ecore.*; |
8 |
|
9 |
public class NodeEditPartGenerator |
10 |
{ |
11 |
protected static String nl; |
12 |
public static synchronized NodeEditPartGenerator create(String lineSeparator) |
13 |
{ |
14 |
nl = lineSeparator; |
15 |
NodeEditPartGenerator result = new NodeEditPartGenerator(); |
16 |
nl = null; |
17 |
return result; |
18 |
} |
19 |
|
20 |
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; |
21 |
protected final String TEXT_1 = ""; |
22 |
protected final String TEXT_2 = NL + "/*" + NL + " * "; |
23 |
protected final String TEXT_3 = NL + " */"; |
24 |
protected final String TEXT_4 = NL; |
25 |
protected final String TEXT_5 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; |
26 |
protected final String TEXT_6 = " extends "; |
27 |
protected final String TEXT_7 = " implements "; |
28 |
protected final String TEXT_8 = ", IUpdatableEditPart {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
29 |
protected final String TEXT_9 = " contentPane;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
30 |
protected final String TEXT_10 = " primaryShape;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
31 |
protected final String TEXT_11 = "("; |
32 |
protected final String TEXT_12 = " model) {" + NL + "\t\tassert model instanceof "; |
33 |
protected final String TEXT_13 = ";" + NL + "\t\tsetModel(model);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createEditPolicies() {"; |
34 |
protected final String TEXT_14 = NL; |
35 |
protected final String TEXT_15 = "\t\tinstallEditPolicy("; |
36 |
protected final String TEXT_16 = ".COMPONENT_ROLE, new "; |
37 |
protected final String TEXT_17 = "() {" + NL + "\t\t\tprotected "; |
38 |
protected final String TEXT_18 = " createDeleteCommand("; |
39 |
protected final String TEXT_19 = " deleteRequest) {" + NL + "\t\t\t\treturn new "; |
40 |
protected final String TEXT_20 = "() {"; |
41 |
protected final String TEXT_21 = NL + "\t\t\t\t\tprivate final org.eclipse.emf.common.command.Command domainModelRemoveCommand = getDomainModelRemoveCommand();" + NL + "\t\t\t\t\tprivate org.eclipse.emf.common.command.Command getDomainModelRemoveCommand() {" + NL + "\t\t\t\t\t\t"; |
42 |
protected final String TEXT_22 = " result = new "; |
43 |
protected final String TEXT_23 = "();"; |
44 |
protected final String TEXT_24 = NL + "\t\t\t\t\t\tresult.append("; |
45 |
protected final String TEXT_25 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
46 |
protected final String TEXT_26 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
47 |
protected final String TEXT_27 = ".eINSTANCE.get"; |
48 |
protected final String TEXT_28 = "()," + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement()));"; |
49 |
protected final String TEXT_29 = NL + "\t\t\t\t\t\tresult.append("; |
50 |
protected final String TEXT_30 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
51 |
protected final String TEXT_31 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
52 |
protected final String TEXT_32 = ".eINSTANCE.get"; |
53 |
protected final String TEXT_33 = "()," + NL + "\t\t\t\t\t\t\t"; |
54 |
protected final String TEXT_34 = ".UNSET_VALUE));"; |
55 |
protected final String TEXT_35 = NL + "\t\t\t\t\t\tresult.append("; |
56 |
protected final String TEXT_36 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
57 |
protected final String TEXT_37 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
58 |
protected final String TEXT_38 = ".eINSTANCE.get"; |
59 |
protected final String TEXT_39 = "()," + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement()));"; |
60 |
protected final String TEXT_40 = NL + "\t\t\t\t\t\tresult.append("; |
61 |
protected final String TEXT_41 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
62 |
protected final String TEXT_42 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
63 |
protected final String TEXT_43 = ".eINSTANCE.get"; |
64 |
protected final String TEXT_44 = "()," + NL + "\t\t\t\t\t\t\t"; |
65 |
protected final String TEXT_45 = ".UNSET_VALUE));"; |
66 |
protected final String TEXT_46 = NL + "\t\t\t\t\t\treturn result;" + NL + "\t\t\t\t\t}"; |
67 |
protected final String TEXT_47 = NL + "\t\t\t\t\t\tprivate final org.eclipse.emf.common.command.Command domainModelRemoveCommand = "; |
68 |
protected final String TEXT_48 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
69 |
protected final String TEXT_49 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
70 |
protected final String TEXT_50 = ".eINSTANCE.get"; |
71 |
protected final String TEXT_51 = "()," + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement());"; |
72 |
protected final String TEXT_52 = NL + "\t\t\t\t\t\tprivate final org.eclipse.emf.common.command.Command domainModelRemoveCommand = "; |
73 |
protected final String TEXT_53 = ".create(" + NL + "\t\t\t\t\t\t\t"; |
74 |
protected final String TEXT_54 = ".getEditingDomainFor(getDiagramNode().getDiagram().getElement()), " + NL + "\t\t\t\t\t\t\tgetDiagramNode().getElement().eContainer(), "; |
75 |
protected final String TEXT_55 = ".eINSTANCE.get"; |
76 |
protected final String TEXT_56 = "()," + NL + "\t\t\t\t\t\t\t"; |
77 |
protected final String TEXT_57 = ".UNSET_VALUE);"; |
78 |
protected final String TEXT_58 = NL + "\t\t\t\t\tprivate final org.eclipse.emf.common.command.Command viewRemoveCommand = "; |
79 |
protected final String TEXT_59 = ".create(" + NL + "\t\t\t\t\t\t"; |
80 |
protected final String TEXT_60 = ".getEditingDomainFor(getDiagramNode().getDiagram()), " + NL + "\t\t\t\t\t\tgetDiagramNode());" + NL + "\t\t\t\t\tpublic boolean canExecute() {" + NL + "\t\t\t\t\t\treturn domainModelRemoveCommand != null && domainModelRemoveCommand.canExecute() && viewRemoveCommand != null && viewRemoveCommand.canExecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void execute() {" + NL + "\t\t\t\t\t\tdomainModelRemoveCommand.execute();" + NL + "\t\t\t\t\t\tviewRemoveCommand.execute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic boolean canUndo() {" + NL + "\t\t\t\t\t\treturn domainModelRemoveCommand != null && domainModelRemoveCommand.canUndo() && viewRemoveCommand != null && viewRemoveCommand.canUndo();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void undo() {" + NL + "\t\t\t\t\t\tdomainModelRemoveCommand.undo();" + NL + "\t\t\t\t\t\tviewRemoveCommand.undo();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t}" + NL + "\t\t});"; |
81 |
protected final String TEXT_61 = NL + "\t\tinstallEditPolicy("; |
82 |
protected final String TEXT_62 = ".LAYOUT_ROLE, new "; |
83 |
protected final String TEXT_63 = "() {" + NL + "\t\t\tprotected "; |
84 |
protected final String TEXT_64 = " getCreateCommand("; |
85 |
protected final String TEXT_65 = " request) {" + NL + "\t\t\t\treturn "; |
86 |
protected final String TEXT_66 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Object getConstraintFor("; |
87 |
protected final String TEXT_67 = " rect) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Object getConstraintFor("; |
88 |
protected final String TEXT_68 = " point) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected "; |
89 |
protected final String TEXT_69 = " createChangeConstraintCommand("; |
90 |
protected final String TEXT_70 = " child, Object constraint) {" + NL + "\t\t\t\treturn "; |
91 |
protected final String TEXT_71 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t\tprotected "; |
92 |
protected final String TEXT_72 = " createChildEditPolicy("; |
93 |
protected final String TEXT_73 = " child) {" + NL + "\t\t\t\treturn new "; |
94 |
protected final String TEXT_74 = "() {" + NL + "\t\t\t\t\tpublic "; |
95 |
protected final String TEXT_75 = " getTargetEditPart("; |
96 |
protected final String TEXT_76 = " request) {" + NL + "\t\t\t\t\t\tif ("; |
97 |
protected final String TEXT_77 = ".REQ_SELECTION.equals(request.getType())) {" + NL + "\t\t\t\t\t\t\treturn "; |
98 |
protected final String TEXT_78 = ".this;" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\treturn super.getTargetEditPart(request);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\tinstallEditPolicy("; |
99 |
protected final String TEXT_79 = ".GRAPHICAL_NODE_ROLE, new "; |
100 |
protected final String TEXT_80 = "() {" + NL + "\t\t\tprotected "; |
101 |
protected final String TEXT_81 = " getReconnectTargetCommand("; |
102 |
protected final String TEXT_82 = " request) {" + NL + "\t\t\t\t//XXX: reconnect command" + NL + "\t\t\t\treturn "; |
103 |
protected final String TEXT_83 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t\tprotected "; |
104 |
protected final String TEXT_84 = " getReconnectSourceCommand("; |
105 |
protected final String TEXT_85 = " request) {" + NL + "\t\t\t\t//XXX: reconnect command" + NL + "\t\t\t\treturn "; |
106 |
protected final String TEXT_86 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t\tprotected "; |
107 |
protected final String TEXT_87 = " getConnectionCreateCommand("; |
108 |
protected final String TEXT_88 = " request) {"; |
109 |
protected final String TEXT_89 = NL + "\t\t\t\tif (request instanceof "; |
110 |
protected final String TEXT_90 = ".CreateConnectionRequestEx) {" + NL + "\t\t\t\t\t"; |
111 |
protected final String TEXT_91 = ".CreateConnectionRequestEx requestEx = ("; |
112 |
protected final String TEXT_92 = ".CreateConnectionRequestEx) request;" + NL + "\t\t\t\t\tint[] visualIds = requestEx.getVisualIds();" + NL + "\t\t\t\t\tint matchingVisualIdsCount = 0;" + NL + "\t\t\t\t\tfor (int i = 0; i < visualIds.length; i++) {" + NL + "\t\t\t\t\t\tint nextVisualId = visualIds[i];" + NL + "\t\t\t\t\t\tswitch (nextVisualId) {"; |
113 |
protected final String TEXT_93 = NL + "\t\t\t\t\t\tcase "; |
114 |
protected final String TEXT_94 = ":" + NL + "\t\t\t\t\t\t\tmatchingVisualIdsCount++;" + NL + "\t\t\t\t\t\t\tbreak;"; |
115 |
protected final String TEXT_95 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (matchingVisualIdsCount != 1) {" + NL + "\t\t\t\t\t\t//Cannot create several connections at once." + NL + "\t\t\t\t\t\treturn "; |
116 |
protected final String TEXT_96 = ".INSTANCE;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\t"; |
117 |
protected final String TEXT_97 = " result = new "; |
118 |
protected final String TEXT_98 = "() {" + NL + "\t\t\t\t\t\t//XXX: check multiplicity requirements etc." + NL + "\t\t\t\t\t};" + NL + "\t\t\t\t\trequest.setStartCommand(result);" + NL + "\t\t\t\t\treturn result;" + NL + "\t\t\t\t}"; |
119 |
protected final String TEXT_99 = NL + "\t\t\t\treturn "; |
120 |
protected final String TEXT_100 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t\tprotected "; |
121 |
protected final String TEXT_101 = " getConnectionCompleteCommand("; |
122 |
protected final String TEXT_102 = " request) {"; |
123 |
protected final String TEXT_103 = NL + "\t\t\t\tif (request.getStartCommand() == null || !request.getStartCommand().canExecute()) {" + NL + "\t\t\t\t\treturn "; |
124 |
protected final String TEXT_104 = ".INSTANCE;" + NL + "\t\t\t\t}" + NL + "\t\t\t\tif (request instanceof "; |
125 |
protected final String TEXT_105 = ".CreateConnectionRequestEx) {" + NL + "\t\t\t\t\t"; |
126 |
protected final String TEXT_106 = ".CreateConnectionRequestEx requestEx = ("; |
127 |
protected final String TEXT_107 = ".CreateConnectionRequestEx) request;" + NL + "\t\t\t\t\tint[] visualIds = requestEx.getVisualIds();" + NL + "\t\t\t\t\t"; |
128 |
protected final String TEXT_108 = " result = new "; |
129 |
protected final String TEXT_109 = "();" + NL + "\t\t\t\t\tfor (int i = 0; i < visualIds.length; i++) {" + NL + "\t\t\t\t\t\tint nextVisualId = visualIds[i];" + NL + "\t\t\t\t\t\tswitch (nextVisualId) {"; |
130 |
protected final String TEXT_110 = NL + "\t\t\t\t\t\tcase "; |
131 |
protected final String TEXT_111 = ":" + NL + "\t\t\t\t\t\t\tresult.add(new Create"; |
132 |
protected final String TEXT_112 = "Command(requestEx));" + NL + "\t\t\t\t\t\t\tbreak;"; |
133 |
protected final String TEXT_113 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tif (result.getChildren().length != 1) {" + NL + "\t\t\t\t\t\t//Cannot create several connections at once." + NL + "\t\t\t\t\t\treturn "; |
134 |
protected final String TEXT_114 = ".INSTANCE;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\treturn result.unwrap();" + NL + "\t\t\t\t}"; |
135 |
protected final String TEXT_115 = NL + "\t\t\t\treturn "; |
136 |
protected final String TEXT_116 = ".INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
137 |
protected final String TEXT_117 = " createFigure() {" + NL + "\t\t"; |
138 |
protected final String TEXT_118 = " invisibleRectangle = new "; |
139 |
protected final String TEXT_119 = "();" + NL + "\t\tinvisibleRectangle.setLayoutManager(new "; |
140 |
protected final String TEXT_120 = "());" + NL + "\t\t"; |
141 |
protected final String TEXT_121 = " shape = createNodeShape();" + NL + "\t\tinvisibleRectangle.add(shape);" + NL + "\t\tcontentPane = setupContentPane(shape);" + NL + "\t\t" + NL + "\t\t"; |
142 |
protected final String TEXT_122 = " decorationShape = createDecorationPane();" + NL + "\t\tif (decorationShape != null) {" + NL + "\t\t\tinvisibleRectangle.add(decorationShape);" + NL + "\t\t}" + NL + "" + NL + "\t\treturn invisibleRectangle;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
143 |
protected final String TEXT_123 = " createNodeShape() {"; |
144 |
protected final String TEXT_124 = NL + "\t\tprimaryShape = new "; |
145 |
protected final String TEXT_125 = "()"; |
146 |
protected final String TEXT_126 = " {" + NL + "\t\t\tprotected boolean useLocalCoordinates() {" + NL + "\t\t\t\treturn true;" + NL + "\t\t\t}" + NL + "\t\t}"; |
147 |
protected final String TEXT_127 = ";"; |
148 |
protected final String TEXT_128 = NL + "\t\tprimaryShape = "; |
149 |
protected final String TEXT_129 = ";"; |
150 |
protected final String TEXT_130 = NL + "\t\t"; |
151 |
protected final String TEXT_131 = " figure = new "; |
152 |
protected final String TEXT_132 = "();" + NL + " \t\tfigure.setUseLocalCoordinates("; |
153 |
protected final String TEXT_133 = ");" + NL + " \t\tprimaryShape = figure;"; |
154 |
protected final String TEXT_134 = NL + "\t\treturn primaryShape;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
155 |
protected final String TEXT_135 = " createDecorationPane() {" + NL + "\t\t"; |
156 |
protected final String TEXT_136 = " view = ("; |
157 |
protected final String TEXT_137 = ") getModel();" + NL + "\t\t"; |
158 |
protected final String TEXT_138 = " 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"; |
159 |
protected final String TEXT_139 = " decorationPane = new "; |
160 |
protected final String TEXT_140 = "();" + NL + "\t\tdecorationPane.setLayoutManager(new "; |
161 |
protected final String TEXT_141 = "());" + NL + "" + NL + "\t\t"; |
162 |
protected final String TEXT_142 = " imageFigure = new "; |
163 |
protected final String TEXT_143 = "("; |
164 |
protected final String TEXT_144 = ".getInstance().getBundledImage(\"icons/shortcut.gif\"), "; |
165 |
protected final String TEXT_145 = ".EAST);" + NL + "\t\tdecorationPane.add(imageFigure, "; |
166 |
protected final String TEXT_146 = ".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 "; |
167 |
protected final String TEXT_147 = " setupContentPane("; |
168 |
protected final String TEXT_148 = " nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {"; |
169 |
protected final String TEXT_149 = NL + "\t\t\t"; |
170 |
protected final String TEXT_150 = " layout = new "; |
171 |
protected final String TEXT_151 = "();" + NL + "\t\t\tlayout.setSpacing(5);" + NL + "\t\t\tnodeShape.setLayoutManager(layout);"; |
172 |
protected final String TEXT_152 = NL + "\t\tnodeShape.setLayoutManager(new "; |
173 |
protected final String TEXT_153 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint("; |
174 |
protected final String TEXT_154 = " figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new "; |
175 |
protected final String TEXT_155 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});"; |
176 |
protected final String TEXT_156 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
177 |
protected final String TEXT_157 = " 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 "; |
178 |
protected final String TEXT_158 = " getDiagramNode() {" + NL + "\t\treturn ("; |
179 |
protected final String TEXT_159 = ") getModel();" + NL + "\t}" + NL; |
180 |
protected final String TEXT_160 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean addFixedChild("; |
181 |
protected final String TEXT_161 = " childEditPart) {"; |
182 |
protected final String TEXT_162 = NL + "\t\tif (childEditPart instanceof "; |
183 |
protected final String TEXT_163 = ") {"; |
184 |
protected final String TEXT_164 = NL + "\t\t\t(("; |
185 |
protected final String TEXT_165 = ") childEditPart).setLabel((("; |
186 |
protected final String TEXT_166 = ") primaryShape).getFigure"; |
187 |
protected final String TEXT_167 = "());"; |
188 |
protected final String TEXT_168 = NL + "\t\t\t(("; |
189 |
protected final String TEXT_169 = ") childEditPart).setLabel(new "; |
190 |
protected final String TEXT_170 = "());"; |
191 |
protected final String TEXT_171 = NL + "\t\t\treturn true;" + NL + "\t\t}"; |
192 |
protected final String TEXT_172 = NL + "\t\treturn false;" + NL + "\t}" + NL; |
193 |
protected final String TEXT_173 = NL; |
194 |
protected final String TEXT_174 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static int getVisualID("; |
195 |
protected final String TEXT_175 = " containerView) {" + NL + "\t\t"; |
196 |
protected final String TEXT_176 = " annotation = containerView.getEAnnotation(\"ViewIdentifier\"); //$NON-NLS-1$" + NL + "\t\tif (annotation == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\tString visualID = (String) annotation.getDetails().get(\"visualID\"); //$NON-NLS-1$" + NL + "\t\tif (visualID == null) {" + NL + "\t\t\treturn -1;" + NL + "\t\t}" + NL + "\t\ttry {" + NL + "\t\t\treturn Integer.parseInt(visualID);" + NL + "\t\t} catch (NumberFormatException e) {" + NL + "\t\t\t"; |
197 |
protected final String TEXT_177 = ".getInstance().logError(\"Unable to parse \\\"visualID\\\" annotation: \" + visualID, e);" + NL + "\t\t}" + NL + "\t\treturn -1;" + 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_178 = " getPrimaryLabelEditPart() {" + NL + "\t\tfor("; |
199 |
protected final String TEXT_179 = " it = getDiagramNode().getChildren().iterator(); it.hasNext(); ) {" + NL + "\t\t\t"; |
200 |
protected final String TEXT_180 = " nextChild = ("; |
201 |
protected final String TEXT_181 = ")it.next();" + NL + "\t\t\tif (getVisualID(nextChild) == "; |
202 |
protected final String TEXT_182 = ") {" + NL + "\t\t\t\treturn ("; |
203 |
protected final String TEXT_183 = ") getViewer().getEditPartRegistry().get(nextChild);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void performRequest("; |
204 |
protected final String TEXT_184 = " req) {" + NL + "\t\tif ("; |
205 |
protected final String TEXT_185 = ".REQ_DIRECT_EDIT == req.getType()) {" + NL + "\t\t\t"; |
206 |
protected final String TEXT_186 = " primaryLabel = getPrimaryLabelEditPart();" + NL + "\t\t\tif (primaryLabel != null) {" + NL + "\t\t\t\tprimaryLabel.performRequest(req);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL; |
207 |
protected final String TEXT_187 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual("; |
208 |
protected final String TEXT_188 = " childEditPart, int index) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t"; |
209 |
protected final String TEXT_189 = " labelFigure = (("; |
210 |
protected final String TEXT_190 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t} else {"; |
211 |
protected final String TEXT_191 = NL + "\t\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t\t}"; |
212 |
protected final String TEXT_192 = NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);"; |
213 |
protected final String TEXT_193 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual("; |
214 |
protected final String TEXT_194 = " childEditPart) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t"; |
215 |
protected final String TEXT_195 = " labelFigure = (("; |
216 |
protected final String TEXT_196 = ") 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("; |
217 |
protected final String TEXT_197 = " childEditPart) {"; |
218 |
protected final String TEXT_198 = NL + "\t\tif (childEditPart instanceof "; |
219 |
protected final String TEXT_199 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}"; |
220 |
protected final String TEXT_200 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
221 |
protected final String TEXT_201 = " getExternalLabelsContainer() {" + NL + "\t\t"; |
222 |
protected final String TEXT_202 = " root = ("; |
223 |
protected final String TEXT_203 = ") getRoot();" + NL + "\t\treturn root.getLayer("; |
224 |
protected final String TEXT_204 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL; |
225 |
protected final String TEXT_205 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual("; |
226 |
protected final String TEXT_206 = " childEditPart, int index) {" + NL + "\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t}" + NL + "\t}"; |
227 |
protected final String TEXT_207 = 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"; |
228 |
protected final String TEXT_208 = " node = getDiagramNode();" + NL + "\t\tassert node.getLayoutConstraint() instanceof "; |
229 |
protected final String TEXT_209 = ";" + NL + "\t\t"; |
230 |
protected final String TEXT_210 = " bounds = ("; |
231 |
protected final String TEXT_211 = ") node.getLayoutConstraint();" + NL + "\t\t(("; |
232 |
protected final String TEXT_212 = ") getParent()).setLayoutConstraint(this, getFigure(), " + NL + "\t\t\tnew "; |
233 |
protected final String TEXT_213 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
234 |
protected final String TEXT_214 = " getModelChildren() {" + NL + "\t\treturn getDiagramNode().getVisibleChildren();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
235 |
protected final String TEXT_215 = " getModelSourceConnections() {" + NL + "\t\treturn getDiagramNode().getSourceEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; |
236 |
protected final String TEXT_216 = " getModelTargetConnections() {" + NL + "\t\treturn getDiagramNode().getTargetEdges();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
237 |
protected final String TEXT_217 = " getSourceConnectionAnchor("; |
238 |
protected final String TEXT_218 = " connection) {" + NL + "\t\treturn new "; |
239 |
protected final String TEXT_219 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
240 |
protected final String TEXT_220 = " getSourceConnectionAnchor("; |
241 |
protected final String TEXT_221 = " request) {" + NL + "\t\treturn new "; |
242 |
protected final String TEXT_222 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
243 |
protected final String TEXT_223 = " getTargetConnectionAnchor("; |
244 |
protected final String TEXT_224 = " connection) {" + NL + "\t\treturn new "; |
245 |
protected final String TEXT_225 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
246 |
protected final String TEXT_226 = " getTargetConnectionAnchor("; |
247 |
protected final String TEXT_227 = " request) {" + NL + "\t\treturn new "; |
248 |
protected final String TEXT_228 = "(getFigure());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key) {"; |
249 |
protected final String TEXT_229 = 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; |
250 |
protected final String TEXT_230 = NL; |
251 |
protected final String TEXT_231 = "\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 "; |
252 |
protected final String TEXT_232 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged("; |
253 |
protected final String TEXT_233 = " 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(("; |
254 |
protected final String TEXT_234 = ") 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; |
255 |
protected final String TEXT_235 = NL; |
256 |
protected final String TEXT_236 = "\tpublic void addRefresher("; |
257 |
protected final String TEXT_237 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tpublic void removeRefresher("; |
258 |
protected final String TEXT_238 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tprivate CompositeRefresher getCompositeRefresher("; |
259 |
protected final String TEXT_239 = " 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; |
260 |
protected final String TEXT_240 = NL; |
261 |
protected final String TEXT_241 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshFont() {" + NL + "\t\t"; |
262 |
protected final String TEXT_242 = " style =" + NL + "\t\t\t("; |
263 |
protected final String TEXT_243 = ") "; |
264 |
protected final String TEXT_244 = ".getStyle(" + NL + "\t\t\t\t"; |
265 |
protected final String TEXT_245 = ".eINSTANCE.getFontStyle());" + NL + "\t\t"; |
266 |
protected final String TEXT_246 = " 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 = "; |
267 |
protected final String TEXT_247 = ".NORMAL;" + NL + "\t\t\tif (style.isBold()) {" + NL + "\t\t\t\tfontStyle |= "; |
268 |
protected final String TEXT_248 = ".BOLD;" + NL + "\t\t\t}" + NL + "\t\t\tif (style.isItalic()) {" + NL + "\t\t\t\tfontStyle |= "; |
269 |
protected final String TEXT_249 = ".ITALIC;" + NL + "\t\t\t}" + NL + "\t\t\t"; |
270 |
protected final String TEXT_250 = " currentFont = getFigure().getFont();" + NL + "\t\t\tif (currentFont != null) {" + NL + "\t\t\t\t"; |
271 |
protected final String TEXT_251 = " 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 "; |
272 |
protected final String TEXT_252 = "(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 "; |
273 |
protected final String TEXT_253 = " createdFont;" + NL; |
274 |
protected final String TEXT_254 = NL; |
275 |
protected final String TEXT_255 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshForegroundColor() {" + NL + "\t\t"; |
276 |
protected final String TEXT_256 = " style = ("; |
277 |
protected final String TEXT_257 = ") "; |
278 |
protected final String TEXT_258 = ".getStyle("; |
279 |
protected final String TEXT_259 = ".eINSTANCE.getLineStyle());" + NL + "\t\t"; |
280 |
protected final String TEXT_260 = " 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"; |
281 |
protected final String TEXT_261 = " 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 "; |
282 |
protected final String TEXT_262 = "(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 "; |
283 |
protected final String TEXT_263 = " createdForegroundColor;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshBackgroundColor() {" + NL + "\t\t"; |
284 |
protected final String TEXT_264 = " style = ("; |
285 |
protected final String TEXT_265 = ") "; |
286 |
protected final String TEXT_266 = ".getStyle("; |
287 |
protected final String TEXT_267 = ".eINSTANCE.getFillStyle());" + NL + "\t\t"; |
288 |
protected final String TEXT_268 = " 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"; |
289 |
protected final String TEXT_269 = " 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 "; |
290 |
protected final String TEXT_270 = "(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 "; |
291 |
protected final String TEXT_271 = " createdBackgroundColor;" + NL; |
292 |
protected final String TEXT_272 = NL; |
293 |
protected final String TEXT_273 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
294 |
protected final String TEXT_274 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher("; |
295 |
protected final String TEXT_275 = " feature, "; |
296 |
protected final String TEXT_276 = " 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 "; |
297 |
protected final String TEXT_277 = "();"; |
298 |
protected final String TEXT_278 = NL; |
299 |
protected final String TEXT_279 = "\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("; |
300 |
protected final String TEXT_280 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
301 |
protected final String TEXT_281 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);"; |
302 |
protected final String TEXT_282 = NL; |
303 |
protected final String TEXT_283 = "\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("; |
304 |
protected final String TEXT_284 = ".eINSTANCE.getNode_LayoutConstraint(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
305 |
protected final String TEXT_285 = ".eINSTANCE.getSize_Width(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
306 |
protected final String TEXT_286 = ".eINSTANCE.getSize_Height(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
307 |
protected final String TEXT_287 = ".eINSTANCE.getLocation_X(), boundsRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
308 |
protected final String TEXT_288 = ".eINSTANCE.getLocation_Y(), boundsRefresher);"; |
309 |
protected final String TEXT_289 = NL; |
310 |
protected final String TEXT_290 = "\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("; |
311 |
protected final String TEXT_291 = ".eINSTANCE.getView_Visible(), visibilityRefresher);"; |
312 |
protected final String TEXT_292 = NL; |
313 |
protected final String TEXT_293 = "\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("; |
314 |
protected final String TEXT_294 = ".eINSTANCE.getView_SourceEdges(), sourceEdgesRefresher);"; |
315 |
protected final String TEXT_295 = NL; |
316 |
protected final String TEXT_296 = "\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("; |
317 |
protected final String TEXT_297 = ".eINSTANCE.getView_TargetEdges(), targetEdgesRefresher);"; |
318 |
protected final String TEXT_298 = NL; |
319 |
protected final String TEXT_299 = "\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("; |
320 |
protected final String TEXT_300 = ".eINSTANCE.getFontStyle_FontHeight(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
321 |
protected final String TEXT_301 = ".eINSTANCE.getFontStyle_FontName(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
322 |
protected final String TEXT_302 = ".eINSTANCE.getFontStyle_Bold(), fontRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put("; |
323 |
protected final String TEXT_303 = ".eINSTANCE.getFontStyle_Italic(), fontRefresher);" + NL + "\t\t"; |
324 |
protected final String TEXT_304 = NL; |
325 |
protected final String TEXT_305 = "\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("; |
326 |
protected final String TEXT_306 = ".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("; |
327 |
protected final String TEXT_307 = ".eINSTANCE.getLineStyle_LineColor(), foregroundColorRefresher);" + NL + "\t}" + NL; |
328 |
protected final String TEXT_308 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create"; |
329 |
protected final String TEXT_309 = "Command extends "; |
330 |
protected final String TEXT_310 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final "; |
331 |
protected final String TEXT_311 = " source;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final "; |
332 |
protected final String TEXT_312 = " target;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final "; |
333 |
protected final String TEXT_313 = " 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"; |
334 |
protected final String TEXT_314 = "Command("; |
335 |
protected final String TEXT_315 = ".CreateConnectionRequestEx requestEx) {" + NL + "\t\t\tif (requestEx.getSourceEditPart().getModel() instanceof "; |
336 |
protected final String TEXT_316 = ") {" + NL + "\t\t\t\tsource = ("; |
337 |
protected final String TEXT_317 = ")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 "; |
338 |
protected final String TEXT_318 = ") {" + NL + "\t\t\t\ttarget = ("; |
339 |
protected final String TEXT_319 = ")requestEx.getTargetEditPart().getModel();" + NL + "\t\t\t} else {" + NL + "\t\t\t\ttarget = null;" + NL + "\t\t\t}" + NL + "\t\t\tcreatedEdge = "; |
340 |
protected final String TEXT_320 = ".eINSTANCE.createEdge();"; |
341 |
protected final String TEXT_321 = NL + "\t\t\t"; |
342 |
protected final String TEXT_322 = " createdDomainElement = "; |
343 |
protected final String TEXT_323 = ".eINSTANCE.create"; |
344 |
protected final String TEXT_324 = "();" + NL + "\t\t\tcreatedEdge.setElement(createdDomainElement);" + NL + "\t\t\t"; |
345 |
protected final String TEXT_325 = NL + "\t\t\t"; |
346 |
protected final String TEXT_326 = "."; |
347 |
protected final String TEXT_327 = ".initializeElement(createdDomainElement);"; |
348 |
protected final String TEXT_328 = NL + "\t\t\tcreatedEdge.setElement(target.getElement());\t\t//XXX: is this correct?"; |
349 |
protected final String TEXT_329 = NL + "\t\t\t"; |
350 |
protected final String TEXT_330 = ".decorateView(createdEdge);" + NL + "\t\t\t"; |
351 |
protected final String TEXT_331 = " domainModelEditDomain = "; |
352 |
protected final String TEXT_332 = ".getEditingDomainFor(source.getDiagram().getElement());"; |
353 |
protected final String TEXT_333 = NL + "\t\t\torg.eclipse.emf.common.command.CompoundCommand addLinkEndsCommand = new org.eclipse.emf.common.command.CompoundCommand();"; |
354 |
protected final String TEXT_334 = NL + "\t\t\t"; |
355 |
protected final String TEXT_335 = " container = getRelationshipContainer(source.getElement(), "; |
356 |
protected final String TEXT_336 = ".eINSTANCE.get"; |
357 |
protected final String TEXT_337 = "());" + 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("; |
358 |
protected final String TEXT_338 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcontainer, "; |
359 |
protected final String TEXT_339 = ".eINSTANCE.get"; |
360 |
protected final String TEXT_340 = "(), createdDomainElement));"; |
361 |
protected final String TEXT_341 = NL + "\t\t\taddLinkEndsCommand.append("; |
362 |
protected final String TEXT_342 = ".create(domainModelEditDomain," + NL + "\t\t\t\tcontainer, "; |
363 |
protected final String TEXT_343 = ".eINSTANCE.get"; |
364 |
protected final String TEXT_344 = "(), createdDomainElement));"; |
365 |
protected final String TEXT_345 = NL + "\t\t\taddLinkEndsCommand.append("; |
366 |
protected final String TEXT_346 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, "; |
367 |
protected final String TEXT_347 = ".eINSTANCE.get"; |
368 |
protected final String TEXT_348 = "(), source.getElement()));"; |
369 |
protected final String TEXT_349 = NL + "\t\t\taddLinkEndsCommand.append("; |
370 |
protected final String TEXT_350 = ".create(domainModelEditDomain, " + NL + "\t\t\t\tcreatedDomainElement, "; |
371 |
protected final String TEXT_351 = ".eINSTANCE.get"; |
372 |
protected final String TEXT_352 = "(), target.getElement()));"; |
373 |
protected final String TEXT_353 = NL + "\t\tdomainModelAddCommand = addLinkEndsCommand;"; |
374 |
protected final String TEXT_354 = NL + "\t\t\tdomainModelAddCommand = "; |
375 |
protected final String TEXT_355 = ".create(domainModelEditDomain, source.getElement(), " + NL + "\t\t\t\t"; |
376 |
protected final String TEXT_356 = ".eINSTANCE.get"; |
377 |
protected final String TEXT_357 = "(), target.getElement());"; |
378 |
protected final String TEXT_358 = NL + "\t\t}" + NL; |
379 |
protected final String TEXT_359 = 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 "; |
380 |
protected final String TEXT_360 = " getRelationshipContainer("; |
381 |
protected final String TEXT_361 = " element, "; |
382 |
protected final String TEXT_362 = " 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}"; |
383 |
protected final String TEXT_363 = 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}"; |
384 |
protected final String TEXT_364 = NL; |
385 |
protected final String TEXT_365 = NL; |
386 |
protected final String TEXT_366 = 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}"; |
387 |
protected final String TEXT_367 = NL + "}"; |
388 |
|
389 |
public String generate(Object argument) |
390 |
{ |
391 |
final StringBuffer stringBuffer = new StringBuffer(); |
392 |
|
393 |
GenNode genNode = (GenNode) ((Object[]) argument)[0]; |
394 |
GenDiagram genDiagram = genNode.getDiagram(); |
395 |
Palette palette = genDiagram.getPalette(); |
396 |
boolean useFlowLayout = !genNode.isListLayout(); |
397 |
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; |
398 |
|
399 |
stringBuffer.append(TEXT_1); |
400 |
|
401 |
String copyrightText = genDiagram.getEditorGen().getCopyrightText(); |
402 |
if (copyrightText != null && copyrightText.trim().length() > 0) { |
403 |
|
404 |
stringBuffer.append(TEXT_2); |
405 |
stringBuffer.append(copyrightText.replaceAll("\n", "\n * ")); |
406 |
stringBuffer.append(TEXT_3); |
407 |
} |
408 |
stringBuffer.append(TEXT_4); |
409 |
importManager.emitPackageStatement(stringBuffer); |
410 |
|
411 |
/*XXX: temporary hack to generate compilable code in tests (where class NodeEditPart extends NodeEditPart is generated otherwise)*/ |
412 |
importManager.registerInnerClass(genNode.getEditPartClassName()); |
413 |
importManager.markImportLocation(stringBuffer); |
414 |
|
415 |
stringBuffer.append(TEXT_5); |
416 |
stringBuffer.append(genNode.getEditPartClassName()); |
417 |
stringBuffer.append(TEXT_6); |
418 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.AbstractGraphicalEditPart")); |
419 |
stringBuffer.append(TEXT_7); |
420 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.NodeEditPart")); |
421 |
stringBuffer.append(TEXT_8); |
422 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
423 |
stringBuffer.append(TEXT_9); |
424 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
425 |
stringBuffer.append(TEXT_10); |
426 |
stringBuffer.append(genNode.getEditPartClassName()); |
427 |
stringBuffer.append(TEXT_11); |
428 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
429 |
stringBuffer.append(TEXT_12); |
430 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); |
431 |
stringBuffer.append(TEXT_13); |
432 |
stringBuffer.append(TEXT_14); |
433 |
stringBuffer.append(TEXT_15); |
434 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy")); |
435 |
stringBuffer.append(TEXT_16); |
436 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ComponentEditPolicy")); |
437 |
stringBuffer.append(TEXT_17); |
438 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
439 |
stringBuffer.append(TEXT_18); |
440 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.GroupRequest")); |
441 |
stringBuffer.append(TEXT_19); |
442 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
443 |
stringBuffer.append(TEXT_20); |
444 |
|
445 |
{ |
446 |
TypeModelFacet facet = genNode.getModelFacet(); |
447 |
GenFeature childFeature = facet.getChildMetaFeature(); |
448 |
GenFeature containmentFeature = facet.getContainmentMetaFeature(); |
449 |
if (childFeature != null && childFeature != containmentFeature && !childFeature.isDerived()) { |
450 |
|
451 |
stringBuffer.append(TEXT_21); |
452 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")); |
453 |
stringBuffer.append(TEXT_22); |
454 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")); |
455 |
stringBuffer.append(TEXT_23); |
456 |
|
457 |
if (containmentFeature.getEcoreFeature().isMany()) { |
458 |
|
459 |
stringBuffer.append(TEXT_24); |
460 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.RemoveCommand")); |
461 |
stringBuffer.append(TEXT_25); |
462 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
463 |
stringBuffer.append(TEXT_26); |
464 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
465 |
stringBuffer.append(TEXT_27); |
466 |
stringBuffer.append(containmentFeature.getFeatureAccessorName()); |
467 |
stringBuffer.append(TEXT_28); |
468 |
|
469 |
} else { |
470 |
|
471 |
stringBuffer.append(TEXT_29); |
472 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
473 |
stringBuffer.append(TEXT_30); |
474 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
475 |
stringBuffer.append(TEXT_31); |
476 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
477 |
stringBuffer.append(TEXT_32); |
478 |
stringBuffer.append(containmentFeature.getFeatureAccessorName()); |
479 |
stringBuffer.append(TEXT_33); |
480 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
481 |
stringBuffer.append(TEXT_34); |
482 |
|
483 |
} |
484 |
|
485 |
|
486 |
if (childFeature.getEcoreFeature().isMany()) { |
487 |
|
488 |
stringBuffer.append(TEXT_35); |
489 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.RemoveCommand")); |
490 |
stringBuffer.append(TEXT_36); |
491 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
492 |
stringBuffer.append(TEXT_37); |
493 |
stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
494 |
stringBuffer.append(TEXT_38); |
495 |
stringBuffer.append(childFeature.getFeatureAccessorName()); |
496 |
stringBuffer.append(TEXT_39); |
497 |
|
498 |
} else { |
499 |
|
500 |
stringBuffer.append(TEXT_40); |
501 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
502 |
stringBuffer.append(TEXT_41); |
503 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
504 |
stringBuffer.append(TEXT_42); |
505 |
stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
506 |
stringBuffer.append(TEXT_43); |
507 |
stringBuffer.append(childFeature.getFeatureAccessorName()); |
508 |
stringBuffer.append(TEXT_44); |
509 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
510 |
stringBuffer.append(TEXT_45); |
511 |
|
512 |
} |
513 |
|
514 |
stringBuffer.append(TEXT_46); |
515 |
|
516 |
} else { |
517 |
if (containmentFeature.getEcoreFeature().isMany()) { |
518 |
|
519 |
stringBuffer.append(TEXT_47); |
520 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.RemoveCommand")); |
521 |
stringBuffer.append(TEXT_48); |
522 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
523 |
stringBuffer.append(TEXT_49); |
524 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
525 |
stringBuffer.append(TEXT_50); |
526 |
stringBuffer.append(containmentFeature.getFeatureAccessorName()); |
527 |
stringBuffer.append(TEXT_51); |
528 |
|
529 |
} else { |
530 |
|
531 |
stringBuffer.append(TEXT_52); |
532 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
533 |
stringBuffer.append(TEXT_53); |
534 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
535 |
stringBuffer.append(TEXT_54); |
536 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
537 |
stringBuffer.append(TEXT_55); |
538 |
stringBuffer.append(containmentFeature.getFeatureAccessorName()); |
539 |
stringBuffer.append(TEXT_56); |
540 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.SetCommand")); |
541 |
stringBuffer.append(TEXT_57); |
542 |
|
543 |
} |
544 |
} |
545 |
|
546 |
stringBuffer.append(TEXT_58); |
547 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.command.RemoveCommand")); |
548 |
stringBuffer.append(TEXT_59); |
549 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
550 |
stringBuffer.append(TEXT_60); |
551 |
|
552 |
} /*restrict local vars used in component edit policy*/ |
553 |
|
554 |
stringBuffer.append(TEXT_61); |
555 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy")); |
556 |
stringBuffer.append(TEXT_62); |
557 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy")); |
558 |
stringBuffer.append(TEXT_63); |
559 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
560 |
stringBuffer.append(TEXT_64); |
561 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateRequest")); |
562 |
stringBuffer.append(TEXT_65); |
563 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
564 |
stringBuffer.append(TEXT_66); |
565 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")); |
566 |
stringBuffer.append(TEXT_67); |
567 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point")); |
568 |
stringBuffer.append(TEXT_68); |
569 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
570 |
stringBuffer.append(TEXT_69); |
571 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
572 |
stringBuffer.append(TEXT_70); |
573 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
574 |
stringBuffer.append(TEXT_71); |
575 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy")); |
576 |
stringBuffer.append(TEXT_72); |
577 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
578 |
stringBuffer.append(TEXT_73); |
579 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")); |
580 |
stringBuffer.append(TEXT_74); |
581 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
582 |
stringBuffer.append(TEXT_75); |
583 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); |
584 |
stringBuffer.append(TEXT_76); |
585 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.RequestConstants")); |
586 |
stringBuffer.append(TEXT_77); |
587 |
stringBuffer.append(genNode.getEditPartClassName()); |
588 |
stringBuffer.append(TEXT_78); |
589 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy")); |
590 |
stringBuffer.append(TEXT_79); |
591 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy")); |
592 |
stringBuffer.append(TEXT_80); |
593 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
594 |
stringBuffer.append(TEXT_81); |
595 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.ReconnectRequest")); |
596 |
stringBuffer.append(TEXT_82); |
597 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
598 |
stringBuffer.append(TEXT_83); |
599 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
600 |
stringBuffer.append(TEXT_84); |
601 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.ReconnectRequest")); |
602 |
stringBuffer.append(TEXT_85); |
603 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
604 |
stringBuffer.append(TEXT_86); |
605 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
606 |
stringBuffer.append(TEXT_87); |
607 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateConnectionRequest")); |
608 |
stringBuffer.append(TEXT_88); |
609 |
if (palette != null) { |
610 |
stringBuffer.append(TEXT_89); |
611 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
612 |
stringBuffer.append(TEXT_90); |
613 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
614 |
stringBuffer.append(TEXT_91); |
615 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
616 |
stringBuffer.append(TEXT_92); |
617 |
|
618 |
for(Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { |
619 |
GenLink genLink = (GenLink)it.next(); |
620 |
if (!genLink.isViewDirectionAlignedWithModel() || genLink.getModelFacet() == null) { |
621 |
continue; |
622 |
} |
623 |
GenClass outgoingClass; |
624 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
625 |
TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet(); |
626 |
outgoingClass = modelFacet.getSourceMetaFeature() == null |
627 |
? modelFacet.getContainmentMetaFeature().getGenClass() |
628 |
: modelFacet.getSourceMetaFeature().getTypeGenClass(); |
629 |
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) { |
630 |
GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature(); |
631 |
outgoingClass = metaFeature.getGenClass(); |
632 |
} else { |
633 |
continue; |
634 |
} |
635 |
if (!outgoingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) { |
636 |
continue; |
637 |
} |
638 |
|
639 |
stringBuffer.append(TEXT_93); |
640 |
stringBuffer.append(genLink.getVisualID()); |
641 |
stringBuffer.append(TEXT_94); |
642 |
|
643 |
} |
644 |
|
645 |
stringBuffer.append(TEXT_95); |
646 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
647 |
stringBuffer.append(TEXT_96); |
648 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
649 |
stringBuffer.append(TEXT_97); |
650 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
651 |
stringBuffer.append(TEXT_98); |
652 |
}/*when there's palette*/ |
653 |
stringBuffer.append(TEXT_99); |
654 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
655 |
stringBuffer.append(TEXT_100); |
656 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
657 |
stringBuffer.append(TEXT_101); |
658 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.CreateConnectionRequest")); |
659 |
stringBuffer.append(TEXT_102); |
660 |
if (palette != null) { |
661 |
stringBuffer.append(TEXT_103); |
662 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
663 |
stringBuffer.append(TEXT_104); |
664 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
665 |
stringBuffer.append(TEXT_105); |
666 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
667 |
stringBuffer.append(TEXT_106); |
668 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
669 |
stringBuffer.append(TEXT_107); |
670 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.CompoundCommand")); |
671 |
stringBuffer.append(TEXT_108); |
672 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.CompoundCommand")); |
673 |
stringBuffer.append(TEXT_109); |
674 |
|
675 |
for(Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { |
676 |
GenLink genLink = (GenLink)it.next(); |
677 |
if (!genLink.isViewDirectionAlignedWithModel() || genLink.getModelFacet() == null) { |
678 |
continue; |
679 |
} |
680 |
GenClass incomingClass; |
681 |
String createCommandNameInfix; |
682 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
683 |
TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet(); |
684 |
incomingClass = modelFacet.getTargetMetaFeature().getTypeGenClass(); |
685 |
createCommandNameInfix = modelFacet.getMetaClass().getName(); |
686 |
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) { |
687 |
GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature(); |
688 |
incomingClass = metaFeature.getTypeGenClass(); |
689 |
createCommandNameInfix = metaFeature.getFeatureAccessorName(); |
690 |
} else { |
691 |
continue; |
692 |
} |
693 |
if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) { |
694 |
continue; |
695 |
} |
696 |
|
697 |
stringBuffer.append(TEXT_110); |
698 |
stringBuffer.append(genLink.getVisualID()); |
699 |
stringBuffer.append(TEXT_111); |
700 |
stringBuffer.append(createCommandNameInfix); |
701 |
stringBuffer.append(genLink.getVisualID()); |
702 |
stringBuffer.append(TEXT_112); |
703 |
|
704 |
} |
705 |
|
706 |
stringBuffer.append(TEXT_113); |
707 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
708 |
stringBuffer.append(TEXT_114); |
709 |
}/*when there's palette*/ |
710 |
stringBuffer.append(TEXT_115); |
711 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand")); |
712 |
stringBuffer.append(TEXT_116); |
713 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
714 |
stringBuffer.append(TEXT_117); |
715 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
716 |
stringBuffer.append(TEXT_118); |
717 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure")); |
718 |
stringBuffer.append(TEXT_119); |
719 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.StackLayout")); |
720 |
stringBuffer.append(TEXT_120); |
721 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
722 |
stringBuffer.append(TEXT_121); |
723 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
724 |
stringBuffer.append(TEXT_122); |
725 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
726 |
stringBuffer.append(TEXT_123); |
727 |
|
728 |
String figureQualifiedClassName = null; |
729 |
Viewmap viewmap = genNode.getViewmap(); |
730 |
if (viewmap instanceof FigureViewmap) { |
731 |
figureQualifiedClassName = ((FigureViewmap) viewmap).getFigureQualifiedClassName(); |
732 |
if (figureQualifiedClassName == null || figureQualifiedClassName.trim().length() == 0) { |
733 |
figureQualifiedClassName = "org.eclipse.draw2d.RectangleFigure"; |
734 |
} |
735 |
|
736 |
stringBuffer.append(TEXT_124); |
737 |
stringBuffer.append(importManager.getImportedName(figureQualifiedClassName)); |
738 |
stringBuffer.append(TEXT_125); |
739 |
if (useFlowLayout) { |
740 |
stringBuffer.append(TEXT_126); |
741 |
} /* use flow layout*/ |
742 |
stringBuffer.append(TEXT_127); |
743 |
} else if (viewmap instanceof SnippetViewmap) { |
744 |
stringBuffer.append(TEXT_128); |
745 |
stringBuffer.append(((SnippetViewmap) viewmap).getBody()); |
746 |
stringBuffer.append(TEXT_129); |
747 |
} else if (viewmap instanceof InnerClassViewmap) { |
748 |
figureQualifiedClassName = ((InnerClassViewmap) viewmap).getClassName(); |
749 |
|
750 |
stringBuffer.append(TEXT_130); |
751 |
stringBuffer.append(figureQualifiedClassName); |
752 |
stringBuffer.append(TEXT_131); |
753 |
stringBuffer.append(figureQualifiedClassName); |
754 |
stringBuffer.append(TEXT_132); |
755 |
stringBuffer.append(useFlowLayout ? "true" : "false"); |
756 |
stringBuffer.append(TEXT_133); |
757 |
} |
758 |
stringBuffer.append(TEXT_134); |
759 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
760 |
stringBuffer.append(TEXT_135); |
761 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
762 |
stringBuffer.append(TEXT_136); |
763 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
764 |
stringBuffer.append(TEXT_137); |
765 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); |
766 |
stringBuffer.append(TEXT_138); |
767 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure")); |
768 |
stringBuffer.append(TEXT_139); |
769 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure")); |
770 |
stringBuffer.append(TEXT_140); |
771 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout")); |
772 |
stringBuffer.append(TEXT_141); |
773 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure")); |
774 |
stringBuffer.append(TEXT_142); |
775 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ImageFigure")); |
776 |
stringBuffer.append(TEXT_143); |
777 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
778 |
stringBuffer.append(TEXT_144); |
779 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.PositionConstants")); |
780 |
stringBuffer.append(TEXT_145); |
781 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.BorderLayout")); |
782 |
stringBuffer.append(TEXT_146); |
783 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
784 |
stringBuffer.append(TEXT_147); |
785 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
786 |
stringBuffer.append(TEXT_148); |
787 |
|
788 |
if (!useFlowLayout) { |
789 |
String layoutClassName = importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout"); |
790 |
|
791 |
stringBuffer.append(TEXT_149); |
792 |
stringBuffer.append(layoutClassName); |
793 |
stringBuffer.append(TEXT_150); |
794 |
stringBuffer.append(layoutClassName); |
795 |
stringBuffer.append(TEXT_151); |
796 |
} else { |
797 |
stringBuffer.append(TEXT_152); |
798 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout")); |
799 |
stringBuffer.append(TEXT_153); |
800 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
801 |
stringBuffer.append(TEXT_154); |
802 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")); |
803 |
stringBuffer.append(TEXT_155); |
804 |
} |
805 |
stringBuffer.append(TEXT_156); |
806 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
807 |
stringBuffer.append(TEXT_157); |
808 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); |
809 |
stringBuffer.append(TEXT_158); |
810 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); |
811 |
stringBuffer.append(TEXT_159); |
812 |
|
813 |
boolean hasFixedChildren = false; |
814 |
List innerLabels = new ArrayList(genNode.getLabels().size()); |
815 |
for (Iterator it = genNode.getLabels().iterator(); it.hasNext(); ) { |
816 |
GenNodeLabel genLabel = (GenNodeLabel) it.next(); |
817 |
if (!(genLabel instanceof GenExternalNodeLabel)) { |
818 |
innerLabels.add(genLabel); |
819 |
} |
820 |
} |
821 |
if (!innerLabels.isEmpty()) { |
822 |
hasFixedChildren = true; |
823 |
|
824 |
stringBuffer.append(TEXT_160); |
825 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
826 |
stringBuffer.append(TEXT_161); |
827 |
|
828 |
for (Iterator it = innerLabels.iterator(); it.hasNext(); ) { |
829 |
GenNodeLabel genLabel = (GenNodeLabel) it.next(); |
830 |
String labelEditPart = importManager.getImportedName(genLabel.getEditPartQualifiedClassName()); |
831 |
String labelFigureClassName = null; |
832 |
boolean isAccessor; |
833 |
if (genLabel.getViewmap() instanceof InnerClassViewmap) { |
834 |
labelFigureClassName = ((InnerClassViewmap) genLabel.getViewmap()).getClassName(); |
835 |
isAccessor = true; |
836 |
} else if (genLabel.getViewmap() instanceof FigureViewmap) { |
837 |
labelFigureClassName = ((FigureViewmap) genLabel.getViewmap()).getFigureQualifiedClassName(); |
838 |
isAccessor = false; |
839 |
} else { |
840 |
// temp hack to make tests pass |
841 |
labelFigureClassName = "org.eclipse.draw2d.Label"; |
842 |
isAccessor = false; |
843 |
} |
844 |
|
845 |
stringBuffer.append(TEXT_162); |
846 |
stringBuffer.append(labelEditPart); |
847 |
stringBuffer.append(TEXT_163); |
848 |
if (isAccessor) { |
849 |
stringBuffer.append(TEXT_164); |
850 |
stringBuffer.append(labelEditPart); |
851 |
stringBuffer.append(TEXT_165); |
852 |
stringBuffer.append(figureQualifiedClassName); |
853 |
stringBuffer.append(TEXT_166); |
854 |
stringBuffer.append(labelFigureClassName); |
855 |
stringBuffer.append(TEXT_167); |
856 |
} else { |
857 |
stringBuffer.append(TEXT_168); |
858 |
stringBuffer.append(labelEditPart); |
859 |
stringBuffer.append(TEXT_169); |
860 |
stringBuffer.append(labelFigureClassName); |
861 |
stringBuffer.append(TEXT_170); |
862 |
} |
863 |
stringBuffer.append(TEXT_171); |
864 |
} |
865 |
stringBuffer.append(TEXT_172); |
866 |
stringBuffer.append(TEXT_173); |
867 |
stringBuffer.append(TEXT_174); |
868 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
869 |
stringBuffer.append(TEXT_175); |
870 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EAnnotation")); |
871 |
stringBuffer.append(TEXT_176); |
872 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
873 |
stringBuffer.append(TEXT_177); |
874 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
875 |
stringBuffer.append(TEXT_178); |
876 |
stringBuffer.append(importManager.getImportedName("java.util.Iterator")); |
877 |
stringBuffer.append(TEXT_179); |
878 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
879 |
stringBuffer.append(TEXT_180); |
880 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
881 |
stringBuffer.append(TEXT_181); |
882 |
stringBuffer.append(((GenNodeLabel)innerLabels.get(0)).getVisualID()); |
883 |
stringBuffer.append(TEXT_182); |
884 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
885 |
stringBuffer.append(TEXT_183); |
886 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); |
887 |
stringBuffer.append(TEXT_184); |
888 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.RequestConstants")); |
889 |
stringBuffer.append(TEXT_185); |
890 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
891 |
stringBuffer.append(TEXT_186); |
892 |
|
893 |
} |
894 |
|
895 |
|
896 |
boolean hasExternalLabels = false; |
897 |
for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { |
898 |
GenNodeLabel label = (GenNodeLabel) labels.next(); |
899 |
if (label instanceof GenExternalNodeLabel) { |
900 |
hasExternalLabels = true; |
901 |
break; |
902 |
} |
903 |
} |
904 |
if (hasExternalLabels) { |
905 |
|
906 |
stringBuffer.append(TEXT_187); |
907 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
908 |
stringBuffer.append(TEXT_188); |
909 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
910 |
stringBuffer.append(TEXT_189); |
911 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); |
912 |
stringBuffer.append(TEXT_190); |
913 |
if (hasFixedChildren) { |
914 |
stringBuffer.append(TEXT_191); |
915 |
} else { |
916 |
stringBuffer.append(TEXT_192); |
917 |
} |
918 |
stringBuffer.append(TEXT_193); |
919 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
920 |
stringBuffer.append(TEXT_194); |
921 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
922 |
stringBuffer.append(TEXT_195); |
923 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); |
924 |
stringBuffer.append(TEXT_196); |
925 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
926 |
stringBuffer.append(TEXT_197); |
927 |
|
928 |
for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { |
929 |
GenNodeLabel label = (GenNodeLabel) labels.next(); |
930 |
if (label instanceof GenExternalNodeLabel) { |
931 |
|
932 |
stringBuffer.append(TEXT_198); |
933 |
stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); |
934 |
stringBuffer.append(TEXT_199); |
935 |
|
936 |
} |
937 |
} |
938 |
|
939 |
stringBuffer.append(TEXT_200); |
940 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); |
941 |
stringBuffer.append(TEXT_201); |
942 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart")); |
943 |
stringBuffer.append(TEXT_202); |
944 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.ScalableFreeformRootEditPart")); |
945 |
stringBuffer.append(TEXT_203); |
946 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); |
947 |
stringBuffer.append(TEXT_204); |
948 |
|
949 |
} else { |
950 |
if (hasFixedChildren) { |
951 |
stringBuffer.append(TEXT_205); |
952 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); |
953 |
stringBuffer.append(TEXT_206); |
954 |
|
955 |
} |
956 |
} |
957 |
|
958 |
stringBuffer.append(TEXT_207); |
959 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")); |
960 |
stringBuffer.append(TEXT_208); |
961 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds")); |
962 |
stringBuffer.append(TEXT_209); |
963 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds")); |
964 |
stringBuffer.append(TEXT_210); |
965 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds")); |
966 |
stringBuffer.append(TEXT_211); |
967 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); |
968 |
stringBuffer.append(TEXT_212); |
969 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")); |
970 |
stringBuffer.append(TEXT_213); |
971 |
stringBuffer.append(importManager.getImportedName("java.util.List")); |
972 |
stringBuffer.append(TEXT_214); |
973 |
stringBuffer.append(importManager.getImportedName("java.util.List")); |
974 |
stringBuffer.append(TEXT_215); |
975 |
stringBuffer.append(importManager.getImportedName("java.util.List")); |
976 |
stringBuffer.append(TEXT_216); |
977 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor")); |
978 |
stringBuffer.append(TEXT_217); |
979 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart")); |
980 |
stringBuffer.append(TEXT_218); |
981 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor")); |
982 |
stringBuffer.append(TEXT_219); |
983 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor")); |
984 |
stringBuffer.append(TEXT_220); |
985 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); |
986 |
stringBuffer.append(TEXT_221); |
987 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor")); |
988 |
stringBuffer.append(TEXT_222); |
989 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor")); |
990 |
stringBuffer.append(TEXT_223); |
991 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ConnectionEditPart")); |
992 |
stringBuffer.append(TEXT_224); |
993 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor")); |
994 |
stringBuffer.append(TEXT_225); |
995 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ConnectionAnchor")); |
996 |
stringBuffer.append(TEXT_226); |
997 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.Request")); |
998 |
stringBuffer.append(TEXT_227); |
999 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ChopboxAnchor")); |
1000 |
stringBuffer.append(TEXT_228); |
1001 |
/*@ include file="adapters/propertySource.javajetinc"*/ |
1002 |
stringBuffer.append(TEXT_229); |
1003 |
stringBuffer.append(TEXT_230); |
1004 |
stringBuffer.append(TEXT_231); |
1005 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.impl.AdapterImpl")); |
1006 |
stringBuffer.append(TEXT_232); |
1007 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification")); |
1008 |
stringBuffer.append(TEXT_233); |
1009 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); |
1010 |
stringBuffer.append(TEXT_234); |
1011 |
stringBuffer.append(TEXT_235); |
1012 |
stringBuffer.append(TEXT_236); |
1013 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); |
1014 |
stringBuffer.append(TEXT_237); |
1015 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); |
1016 |
stringBuffer.append(TEXT_238); |
1017 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); |
1018 |
stringBuffer.append(TEXT_239); |
1019 |
|
1020 |
final String primaryView = "getDiagramNode()"; |
1021 |
|
1022 |
stringBuffer.append(TEXT_240); |
1023 |
stringBuffer.append(TEXT_241); |
1024 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle")); |
1025 |
stringBuffer.append(TEXT_242); |
1026 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FontStyle")); |
1027 |
stringBuffer.append(TEXT_243); |
1028 |
stringBuffer.append(primaryView); |
1029 |
stringBuffer.append(TEXT_244); |
1030 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1031 |
stringBuffer.append(TEXT_245); |
1032 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font")); |
1033 |
stringBuffer.append(TEXT_246); |
1034 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); |
1035 |
stringBuffer.append(TEXT_247); |
1036 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); |
1037 |
stringBuffer.append(TEXT_248); |
1038 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); |
1039 |
stringBuffer.append(TEXT_249); |
1040 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font")); |
1041 |
stringBuffer.append(TEXT_250); |
1042 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.FontData")); |
1043 |
stringBuffer.append(TEXT_251); |
1044 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font")); |
1045 |
stringBuffer.append(TEXT_252); |
1046 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Font")); |
1047 |
stringBuffer.append(TEXT_253); |
1048 |
stringBuffer.append(TEXT_254); |
1049 |
stringBuffer.append(TEXT_255); |
1050 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle")); |
1051 |
stringBuffer.append(TEXT_256); |
1052 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.LineStyle")); |
1053 |
stringBuffer.append(TEXT_257); |
1054 |
stringBuffer.append(primaryView); |
1055 |
stringBuffer.append(TEXT_258); |
1056 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1057 |
stringBuffer.append(TEXT_259); |
1058 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1059 |
stringBuffer.append(TEXT_260); |
1060 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1061 |
stringBuffer.append(TEXT_261); |
1062 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1063 |
stringBuffer.append(TEXT_262); |
1064 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1065 |
stringBuffer.append(TEXT_263); |
1066 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle")); |
1067 |
stringBuffer.append(TEXT_264); |
1068 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.FillStyle")); |
1069 |
stringBuffer.append(TEXT_265); |
1070 |
stringBuffer.append(primaryView); |
1071 |
stringBuffer.append(TEXT_266); |
1072 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1073 |
stringBuffer.append(TEXT_267); |
1074 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1075 |
stringBuffer.append(TEXT_268); |
1076 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1077 |
stringBuffer.append(TEXT_269); |
1078 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1079 |
stringBuffer.append(TEXT_270); |
1080 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Color")); |
1081 |
stringBuffer.append(TEXT_271); |
1082 |
stringBuffer.append(TEXT_272); |
1083 |
stringBuffer.append(TEXT_273); |
1084 |
stringBuffer.append(importManager.getImportedName("java.util.HashMap")); |
1085 |
stringBuffer.append(TEXT_274); |
1086 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); |
1087 |
stringBuffer.append(TEXT_275); |
1088 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification")); |
1089 |
stringBuffer.append(TEXT_276); |
1090 |
stringBuffer.append(importManager.getImportedName("java.util.HashMap")); |
1091 |
stringBuffer.append(TEXT_277); |
1092 |
stringBuffer.append(TEXT_278); |
1093 |
stringBuffer.append(TEXT_279); |
1094 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1095 |
stringBuffer.append(TEXT_280); |
1096 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1097 |
stringBuffer.append(TEXT_281); |
1098 |
stringBuffer.append(TEXT_282); |
1099 |
stringBuffer.append(TEXT_283); |
1100 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1101 |
stringBuffer.append(TEXT_284); |
1102 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1103 |
stringBuffer.append(TEXT_285); |
1104 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1105 |
stringBuffer.append(TEXT_286); |
1106 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1107 |
stringBuffer.append(TEXT_287); |
1108 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1109 |
stringBuffer.append(TEXT_288); |
1110 |
stringBuffer.append(TEXT_289); |
1111 |
stringBuffer.append(TEXT_290); |
1112 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1113 |
stringBuffer.append(TEXT_291); |
1114 |
stringBuffer.append(TEXT_292); |
1115 |
stringBuffer.append(TEXT_293); |
1116 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1117 |
stringBuffer.append(TEXT_294); |
1118 |
stringBuffer.append(TEXT_295); |
1119 |
stringBuffer.append(TEXT_296); |
1120 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1121 |
stringBuffer.append(TEXT_297); |
1122 |
stringBuffer.append(TEXT_298); |
1123 |
stringBuffer.append(TEXT_299); |
1124 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1125 |
stringBuffer.append(TEXT_300); |
1126 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1127 |
stringBuffer.append(TEXT_301); |
1128 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1129 |
stringBuffer.append(TEXT_302); |
1130 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1131 |
stringBuffer.append(TEXT_303); |
1132 |
stringBuffer.append(TEXT_304); |
1133 |
stringBuffer.append(TEXT_305); |
1134 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1135 |
stringBuffer.append(TEXT_306); |
1136 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")); |
1137 |
stringBuffer.append(TEXT_307); |
1138 |
/*XXX: probably, this should go to a separate jet-template along with GraphicalNodeEditPolicy*/ |
1139 |
|
1140 |
for(Iterator it = genDiagram.getLinks().iterator(); it.hasNext(); ) { |
1141 |
GenLink genLink = (GenLink)it.next(); |
1142 |
if (!genLink.isViewDirectionAlignedWithModel() || genLink.getModelFacet() == null) { |
1143 |
continue; |
1144 |
} |
1145 |
GenClass incomingClass; |
1146 |
String createCommandNameInfix; |
1147 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
1148 |
TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet(); |
1149 |
incomingClass = modelFacet.getTargetMetaFeature().getTypeGenClass(); |
1150 |
createCommandNameInfix = modelFacet.getMetaClass().getName(); |
1151 |
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) { |
1152 |
GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature(); |
1153 |
incomingClass = metaFeature.getTypeGenClass(); |
1154 |
createCommandNameInfix = metaFeature.getFeatureAccessorName(); |
1155 |
} else { |
1156 |
continue; |
1157 |
} |
1158 |
if (!incomingClass.getEcoreClass().isSuperTypeOf(genNode.getModelFacet().getMetaClass().getEcoreClass())) { |
1159 |
continue; |
1160 |
} |
1161 |
|
1162 |
if (palette != null) { |
1163 |
stringBuffer.append(TEXT_308); |
1164 |
stringBuffer.append(createCommandNameInfix); |
1165 |
stringBuffer.append(genLink.getVisualID()); |
1166 |
stringBuffer.append(TEXT_309); |
1167 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); |
1168 |
stringBuffer.append(TEXT_310); |
1169 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1170 |
stringBuffer.append(TEXT_311); |
1171 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1172 |
stringBuffer.append(TEXT_312); |
1173 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")); |
1174 |
stringBuffer.append(TEXT_313); |
1175 |
stringBuffer.append(createCommandNameInfix); |
1176 |
stringBuffer.append(genLink.getVisualID()); |
1177 |
stringBuffer.append(TEXT_314); |
1178 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
1179 |
stringBuffer.append(TEXT_315); |
1180 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1181 |
stringBuffer.append(TEXT_316); |
1182 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1183 |
stringBuffer.append(TEXT_317); |
1184 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1185 |
stringBuffer.append(TEXT_318); |
1186 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); |
1187 |
stringBuffer.append(TEXT_319); |
1188 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); |
1189 |
stringBuffer.append(TEXT_320); |
1190 |
|
1191 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
1192 |
TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet(); |
1193 |
GenClass linkClass = modelFacet.getMetaClass(); |
1194 |
|
1195 |
stringBuffer.append(TEXT_321); |
1196 |
stringBuffer.append(importManager.getImportedName(importManager.getImportedName(linkClass.getQualifiedInterfaceName()))); |
1197 |
stringBuffer.append(TEXT_322); |
1198 |
stringBuffer.append(importManager.getImportedName(linkClass.getGenPackage().getQualifiedFactoryInterfaceName())); |
1199 |
stringBuffer.append(TEXT_323); |
1200 |
stringBuffer.append(linkClass.getClassifierAccessorName()); |
1201 |
stringBuffer.append(TEXT_324); |
1202 |
/*XXX: Class name DomainElementInitializer should be user-customizable*/ |
1203 |
stringBuffer.append(TEXT_325); |
1204 |
stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")); |
1205 |
stringBuffer.append(TEXT_326); |
1206 |
stringBuffer.append(genLink.getUniqueIdentifier()); |
1207 |
stringBuffer.append(TEXT_327); |
1208 |
|
1209 |
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) { |
1210 |
|
1211 |
stringBuffer.append(TEXT_328); |
1212 |
|
1213 |
} |
1214 |
|
1215 |
stringBuffer.append(TEXT_329); |
1216 |
stringBuffer.append(importManager.getImportedName(genLink.getNotationViewFactoryQualifiedClassName())); |
1217 |
stringBuffer.append(TEXT_330); |
1218 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.EditingDomain")); |
1219 |
stringBuffer.append(TEXT_331); |
1220 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain")); |
1221 |
stringBuffer.append(TEXT_332); |
1222 |
|
1223 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
1224 |
|
1225 |
stringBuffer.append(TEXT_333); |
1226 |
|
1227 |
TypeLinkModelFacet modelFacet = (TypeLinkModelFacet) genLink.getModelFacet(); |
1228 |
GenFeature sourceFeature = modelFacet.getSourceMetaFeature(); |
1229 |
GenFeature containmentFeature = modelFacet.getContainmentMetaFeature(); |
1230 |
GenFeature childFeature = modelFacet.getChildMetaFeature(); |
1231 |
GenFeature targetFeature = modelFacet.getTargetMetaFeature(); |
1232 |
//source/link features seem to be pointing from link to its ends, not vice versa. |
1233 |
//Anyway, if there is containment feature and it is not opposite to either the source/target, we should add containment, |
1234 |
//otherwise we will have problems with saving uncontained EObjects. |
1235 |
boolean addSource = sourceFeature != null; |
1236 |
boolean addTarget = targetFeature != null; |
1237 |
boolean addChild = childFeature != null && childFeature != containmentFeature && !childFeature.isDerived(); |
1238 |
if (containmentFeature != null) { |
1239 |
if (sourceFeature != null && sourceFeature.getEcoreFeature() instanceof EReference == true) { |
1240 |
EReference sourceEcoreFeature = (EReference)sourceFeature.getEcoreFeature(); |
1241 |
if (sourceEcoreFeature.getEOpposite() == containmentFeature.getEcoreFeature()) { |
1242 |
addSource = false; |
1243 |
} |
1244 |
} |
1245 |
if (targetFeature != null && targetFeature.getEcoreFeature() instanceof EReference == true) { |
1246 |
EReference targetEcoreFeature = (EReference)targetFeature.getEcoreFeature(); |
1247 |
if (targetEcoreFeature.getEOpposite() == containmentFeature.getEcoreFeature()) { |
1248 |
addTarget = false; |
1249 |
} |
1250 |
} |
1251 |
|
1252 |
stringBuffer.append(TEXT_334); |
1253 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
1254 |
stringBuffer.append(TEXT_335); |
1255 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenClass().getGenPackage().getQualifiedPackageInterfaceName())); |
1256 |
stringBuffer.append(TEXT_336); |
1257 |
stringBuffer.append(containmentFeature.getGenClass().getClassifierAccessorName()); |
1258 |
stringBuffer.append(TEXT_337); |
1259 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")); |
1260 |
stringBuffer.append(TEXT_338); |
1261 |
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
1262 |
stringBuffer.append(TEXT_339); |
1263 |
stringBuffer.append(containmentFeature.getFeatureAccessorName()); |
1264 |
stringBuffer.append(TEXT_340); |
1265 |
|
1266 |
} |
1267 |
if (addChild) { |
1268 |
|
1269 |
stringBuffer.append(TEXT_341); |
1270 |
stringBuffer.append(importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")); |
1271 |
stringBuffer.append(TEXT_342); |
1272 |
stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
1273 |
stringBuffer.append(TEXT_343); |
1274 |
stringBuffer.append(childFeature.getFeatureAccessorName()); |
1275 |
stringBuffer.append(TEXT_344); |
1276 |
|
1277 |
} |
1278 |
if (addSource) { |
1279 |
|
1280 |
stringBuffer.append(TEXT_345); |
1281 |
stringBuffer.append(importManager.getImportedName(sourceFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")); |
1282 |
stringBuffer.append(TEXT_346); |
1283 |
stringBuffer.append(importManager.getImportedName(sourceFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
1284 |
stringBuffer.append(TEXT_347); |
1285 |
stringBuffer.append(sourceFeature.getFeatureAccessorName()); |
1286 |
stringBuffer.append(TEXT_348); |
1287 |
|
1288 |
} |
1289 |
if (addTarget) { |
1290 |
|
1291 |
stringBuffer.append(TEXT_349); |
1292 |
stringBuffer.append(importManager.getImportedName(targetFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")); |
1293 |
stringBuffer.append(TEXT_350); |
1294 |
stringBuffer.append(importManager.getImportedName(targetFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
1295 |
stringBuffer.append(TEXT_351); |
1296 |
stringBuffer.append(targetFeature.getFeatureAccessorName()); |
1297 |
stringBuffer.append(TEXT_352); |
1298 |
|
1299 |
} |
1300 |
|
1301 |
stringBuffer.append(TEXT_353); |
1302 |
|
1303 |
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) { |
1304 |
GenFeature metaFeature = ((FeatureModelFacet) genLink.getModelFacet()).getMetaFeature(); |
1305 |
|
1306 |
stringBuffer.append(TEXT_354); |
1307 |
stringBuffer.append(importManager.getImportedName(metaFeature.getEcoreFeature().isMany()? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")); |
1308 |
stringBuffer.append(TEXT_355); |
1309 |
stringBuffer.append(importManager.getImportedName(metaFeature.getGenPackage().getQualifiedPackageInterfaceName())); |
1310 |
stringBuffer.append(TEXT_356); |
1311 |
stringBuffer.append(metaFeature.getFeatureAccessorName()); |
1312 |
stringBuffer.append(TEXT_357); |
1313 |
|
1314 |
} |
1315 |
|
1316 |
stringBuffer.append(TEXT_358); |
1317 |
|
1318 |
if (genLink.getModelFacet() instanceof TypeLinkModelFacet) { |
1319 |
|
1320 |
stringBuffer.append(TEXT_359); |
1321 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
1322 |
stringBuffer.append(TEXT_360); |
1323 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
1324 |
stringBuffer.append(TEXT_361); |
1325 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass")); |
1326 |
stringBuffer.append(TEXT_362); |
1327 |
|
1328 |
} |
1329 |
|
1330 |
stringBuffer.append(TEXT_363); |
1331 |
|
1332 |
} |
1333 |
|
1334 |
}/*when there's palette*/ |
1335 |
|
1336 |
if (genNode.getViewmap() instanceof InnerClassViewmap) { |
1337 |
String classBody = ((InnerClassViewmap) genNode.getViewmap()).getClassBody(); |
1338 |
|
1339 |
stringBuffer.append(TEXT_364); |
1340 |
stringBuffer.append(classBody); |
1341 |
stringBuffer.append(TEXT_365); |
1342 |
|
1343 |
if (classBody.indexOf("DPtoLP") != -1) { |
1344 |
|
1345 |
stringBuffer.append(TEXT_366); |
1346 |
|
1347 |
} |
1348 |
|
1349 |
|
1350 |
} |
1351 |
|
1352 |
stringBuffer.append(TEXT_367); |
1353 |
importManager.emitSortedImports(); |
1354 |
return stringBuffer.toString(); |
1355 |
} |
1356 |
} |