View | Details | Raw Unified | Return to bug 155698
Collapse All | Expand All

(-)src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java (-106 / +109 lines)
Lines 182-243 Link Here
182
  protected final String TEXT_163 = "));";
182
  protected final String TEXT_163 = "));";
183
  protected final String TEXT_164 = NL + "\t\t//FIXME: workaround for #154536" + NL + "\t\tresult.getBounds().setSize(result.getPreferredSize());";
183
  protected final String TEXT_164 = NL + "\t\t//FIXME: workaround for #154536" + NL + "\t\tresult.getBounds().setSize(result.getPreferredSize());";
184
  protected final String TEXT_165 = "\t\t" + NL + "\t\treturn result;" + NL + "\t}";
184
  protected final String TEXT_165 = "\t\t" + NL + "\t\treturn result;" + NL + "\t}";
185
  protected final String TEXT_166 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPolicy getPrimaryDragEditPolicy() {" + NL + "\t\t";
185
  protected final String TEXT_166 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPolicy getPrimaryDragEditPolicy() {" + NL + "\t\tEditPolicy result = super.getPrimaryDragEditPolicy();" + NL + "\t\tif (result instanceof ";
186
  protected final String TEXT_167 = " ep = (";
186
  protected final String TEXT_167 = "){" + NL + "\t\t\t";
187
  protected final String TEXT_168 = ") super.getPrimaryDragEditPolicy();" + NL + "\t\t";
187
  protected final String TEXT_168 = " ep = (";
188
  protected final String TEXT_169 = NL + "\t\tep.setResizeDirections(";
188
  protected final String TEXT_169 = ") result;" + NL + "\t\t\t";
189
  protected final String TEXT_170 = ".NONE);" + NL + "\t\t";
189
  protected final String TEXT_170 = NL + "\t\t\tep.setResizeDirections(";
190
  protected final String TEXT_171 = NL + "\t\tep.setResizeDirections(";
190
  protected final String TEXT_171 = ".NONE);" + NL + "\t\t\t";
191
  protected final String TEXT_172 = ".";
191
  protected final String TEXT_172 = NL + "\t\t\tep.setResizeDirections(";
192
  protected final String TEXT_173 = " | ";
192
  protected final String TEXT_173 = ".";
193
  protected final String TEXT_174 = ");" + NL + "\t\t";
193
  protected final String TEXT_174 = " | ";
194
  protected final String TEXT_175 = NL + "\t\treturn ep;" + NL + "\t}";
194
  protected final String TEXT_175 = ");" + NL + "\t\t\t";
195
  protected final String TEXT_176 = NL;
195
  protected final String TEXT_176 = NL + "\t\t}" + NL + "\t\treturn result;" + NL + "\t}";
196
  protected final String TEXT_177 = "\t " + NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
196
  protected final String TEXT_177 = NL;
197
  protected final String TEXT_178 = " createMainFigure() {";
197
  protected final String TEXT_178 = "\t " + NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
198
  protected final String TEXT_179 = NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
198
  protected final String TEXT_179 = " createMainFigure() {";
199
  protected final String TEXT_180 = " createNodeFigure() {";
199
  protected final String TEXT_180 = NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
200
  protected final String TEXT_181 = NL + "\t\t";
200
  protected final String TEXT_181 = " createNodeFigure() {";
201
  protected final String TEXT_182 = " figure = createNodePlate();" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\tcontentPane = setupContentPane(shape);" + NL + "\t\treturn figure;" + 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 IFigure setupContentPane(IFigure nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {";
201
  protected final String TEXT_182 = NL + "\t\t";
202
  protected final String TEXT_183 = NL + "\t\tnodeShape.setLayoutManager(new ";
202
  protected final String TEXT_183 = " figure = createNodePlate();" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\tcontentPane = setupContentPane(shape);" + NL + "\t\treturn figure;" + 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 IFigure setupContentPane(IFigure nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {";
203
  protected final String TEXT_184 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
203
  protected final String TEXT_184 = NL + "\t\tnodeShape.setLayoutManager(new ";
204
  protected final String TEXT_185 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
204
  protected final String TEXT_185 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new ";
205
  protected final String TEXT_186 = NL + "\t\t\t";
205
  protected final String TEXT_186 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});";
206
  protected final String TEXT_187 = " layout = new ";
206
  protected final String TEXT_187 = NL + "\t\t\t";
207
  protected final String TEXT_188 = "();" + NL + "\t\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\t\tnodeShape.setLayoutManager(layout);";
207
  protected final String TEXT_188 = " layout = new ";
208
  protected final String TEXT_189 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}";
208
  protected final String TEXT_189 = "();" + NL + "\t\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\t\tnodeShape.setLayoutManager(layout);";
209
  protected final String TEXT_190 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
209
  protected final String TEXT_190 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}";
210
  protected final String TEXT_191 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint(";
210
  protected final String TEXT_191 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
211
  protected final String TEXT_192 = ".getType(";
211
  protected final String TEXT_192 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint(";
212
  protected final String TEXT_193 = ".VISUAL_ID));" + NL + "\t}";
212
  protected final String TEXT_193 = ".getType(";
213
  protected final String TEXT_194 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel(";
213
  protected final String TEXT_194 = ".VISUAL_ID));" + NL + "\t}";
214
  protected final String TEXT_195 = " childEditPart) {";
214
  protected final String TEXT_195 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel(";
215
  protected final String TEXT_196 = NL + "\t\tif (childEditPart instanceof ";
215
  protected final String TEXT_196 = " childEditPart) {";
216
  protected final String TEXT_197 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}";
216
  protected final String TEXT_197 = NL + "\t\tif (childEditPart instanceof ";
217
  protected final String TEXT_198 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure getExternalLabelsContainer() {" + NL + "\t\t";
217
  protected final String TEXT_198 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}";
218
  protected final String TEXT_199 = " root = (";
218
  protected final String TEXT_199 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure getExternalLabelsContainer() {" + NL + "\t\t";
219
  protected final String TEXT_200 = ") getRoot();" + NL + "\t\treturn root.getLayer(";
219
  protected final String TEXT_200 = " root = (";
220
  protected final String TEXT_201 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL;
220
  protected final String TEXT_201 = ") getRoot();" + NL + "\t\treturn root.getLayer(";
221
  protected final String TEXT_202 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
221
  protected final String TEXT_202 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL;
222
  protected final String TEXT_203 = " childEditPart, int index) {";
222
  protected final String TEXT_203 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(";
223
  protected final String TEXT_204 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = ((";
223
  protected final String TEXT_204 = " childEditPart, int index) {";
224
  protected final String TEXT_205 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} ";
224
  protected final String TEXT_205 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = ((";
225
  protected final String TEXT_206 = "\t\t" + NL + "\t\tif (addFixedChild(childEditPart)) {" + NL + "\t\t\treturn;" + NL + "\t\t}";
225
  protected final String TEXT_206 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} ";
226
  protected final String TEXT_207 = NL + "\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual(";
226
  protected final String TEXT_207 = "\t\t" + NL + "\t\tif (addFixedChild(childEditPart)) {" + NL + "\t\t\treturn;" + NL + "\t\t}";
227
  protected final String TEXT_208 = " childEditPart) {";
227
  protected final String TEXT_208 = NL + "\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual(";
228
  protected final String TEXT_209 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = ((";
228
  protected final String TEXT_209 = " childEditPart) {";
229
  protected final String TEXT_210 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} ";
229
  protected final String TEXT_210 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = ((";
230
  protected final String TEXT_211 = NL + "\t\tif (removeFixedChild(childEditPart)){" + NL + "\t\t\treturn;" + NL + "\t\t}";
230
  protected final String TEXT_211 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} ";
231
  protected final String TEXT_212 = NL + "\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t}";
231
  protected final String TEXT_212 = NL + "\t\tif (removeFixedChild(childEditPart)){" + NL + "\t\t\treturn;" + NL + "\t\t}";
232
  protected final String TEXT_213 = "\t\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void removeNotify() {" + NL + "\t\tfor (";
232
  protected final String TEXT_213 = NL + "\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t}";
233
  protected final String TEXT_214 = " it = getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t";
233
  protected final String TEXT_214 = "\t\t" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void removeNotify() {" + NL + "\t\tfor (";
234
  protected final String TEXT_215 = " childEditPart = (";
234
  protected final String TEXT_215 = " it = getChildren().iterator(); it.hasNext();) {" + NL + "\t\t\t";
235
  protected final String TEXT_216 = ") it.next();" + NL + "\t\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t\tIFigure labelFigure = ((";
235
  protected final String TEXT_216 = " childEditPart = (";
236
  protected final String TEXT_217 = ") childEditPart).getFigure();" + NL + "\t\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tsuper.removeNotify();" + NL + "\t}";
236
  protected final String TEXT_217 = ") it.next();" + NL + "\t\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\t\tIFigure labelFigure = ((";
237
  protected final String TEXT_218 = "\t" + NL;
237
  protected final String TEXT_218 = ") childEditPart).getFigure();" + NL + "\t\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tsuper.removeNotify();" + NL + "\t}";
238
  protected final String TEXT_219 = NL;
238
  protected final String TEXT_219 = "\t" + NL;
239
  protected final String TEXT_220 = NL + "}";
239
  protected final String TEXT_220 = NL;
240
  protected final String TEXT_221 = NL;
240
  protected final String TEXT_221 = NL + "}";
241
  protected final String TEXT_222 = NL;
241
242
242
	protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
243
	protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) {
243
		StringBuffer result = new StringBuffer();
244
		StringBuffer result = new StringBuffer();
Lines 907-1047 Link Here
907
    stringBuffer.append(TEXT_167);
908
    stringBuffer.append(TEXT_167);
908
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy"));
909
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy"));
909
    stringBuffer.append(TEXT_168);
910
    stringBuffer.append(TEXT_168);
910
    if (rc.getResizeHandleNames().isEmpty()) {
911
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy"));
911
    stringBuffer.append(TEXT_169);
912
    stringBuffer.append(TEXT_169);
912
    stringBuffer.append(draw2dPC);
913
    if (rc.getResizeHandleNames().isEmpty()) {
913
    stringBuffer.append(TEXT_170);
914
    stringBuffer.append(TEXT_170);
914
     } else {
915
    stringBuffer.append(draw2dPC);
915
    stringBuffer.append(TEXT_171);
916
    stringBuffer.append(TEXT_171);
917
     } else {
918
    stringBuffer.append(TEXT_172);
916
    for (Iterator rcNamesIter = rc.getResizeHandleNames().iterator(); rcNamesIter.hasNext();) {
919
    for (Iterator rcNamesIter = rc.getResizeHandleNames().iterator(); rcNamesIter.hasNext();) {
917
			String nextConstantName = (String) rcNamesIter.next();
920
				String nextConstantName = (String) rcNamesIter.next();
918
    stringBuffer.append(draw2dPC);
921
    stringBuffer.append(draw2dPC);
919
    stringBuffer.append(TEXT_172);
922
    stringBuffer.append(TEXT_173);
920
    stringBuffer.append(nextConstantName);
923
    stringBuffer.append(nextConstantName);
921
    if (rcNamesIter.hasNext()) {
924
    if (rcNamesIter.hasNext()) {
922
    stringBuffer.append(TEXT_173);
923
    }}
924
    stringBuffer.append(TEXT_174);
925
    stringBuffer.append(TEXT_174);
925
    }
926
    }}
926
    stringBuffer.append(TEXT_175);
927
    stringBuffer.append(TEXT_175);
927
    }
928
    }
928
    stringBuffer.append(TEXT_176);
929
    stringBuffer.append(TEXT_176);
929
    if (myHelper.hasSideAffixedChildren()) {
930
    }
930
    stringBuffer.append(TEXT_177);
931
    stringBuffer.append(TEXT_177);
931
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
932
    if (myHelper.hasSideAffixedChildren()) {
932
    stringBuffer.append(TEXT_178);
933
    stringBuffer.append(TEXT_178);
933
    } else {
934
    stringBuffer.append(TEXT_179);
935
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
934
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
935
    stringBuffer.append(TEXT_179);
936
    } else {
936
    stringBuffer.append(TEXT_180);
937
    stringBuffer.append(TEXT_180);
937
    }
938
    stringBuffer.append(TEXT_181);
939
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
938
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
939
    stringBuffer.append(TEXT_181);
940
    }
940
    stringBuffer.append(TEXT_182);
941
    stringBuffer.append(TEXT_182);
942
    stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure"));
943
    stringBuffer.append(TEXT_183);
941
    
944
    
942
if (isXYLayout) {
945
if (isXYLayout) {
943
946
944
    stringBuffer.append(TEXT_183);
945
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
946
    stringBuffer.append(TEXT_184);
947
    stringBuffer.append(TEXT_184);
947
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
948
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
948
    stringBuffer.append(TEXT_185);
949
    stringBuffer.append(TEXT_185);
950
    stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
951
    stringBuffer.append(TEXT_186);
949
    } else {
952
    } else {
950
	String layoutClassName = importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout");
953
	String layoutClassName = importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout");
951
954
952
    stringBuffer.append(TEXT_186);
953
    stringBuffer.append(layoutClassName);
954
    stringBuffer.append(TEXT_187);
955
    stringBuffer.append(TEXT_187);
955
    stringBuffer.append(layoutClassName);
956
    stringBuffer.append(layoutClassName);
956
    stringBuffer.append(TEXT_188);
957
    stringBuffer.append(TEXT_188);
957
    }
958
    stringBuffer.append(layoutClassName);
958
    stringBuffer.append(TEXT_189);
959
    stringBuffer.append(TEXT_189);
960
    }
961
    stringBuffer.append(TEXT_190);
959
    
962
    
960
if (myHelper.getPrimaryLabel() != null) {
963
if (myHelper.getPrimaryLabel() != null) {
961
	GenNodeLabel primaryLabel = myHelper.getPrimaryLabel();
964
	GenNodeLabel primaryLabel = myHelper.getPrimaryLabel();
962
965
963
    stringBuffer.append(TEXT_190);
964
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
965
    stringBuffer.append(TEXT_191);
966
    stringBuffer.append(TEXT_191);
966
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
967
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
967
    stringBuffer.append(TEXT_192);
968
    stringBuffer.append(TEXT_192);
968
    stringBuffer.append(importManager.getImportedName(primaryLabel.getEditPartQualifiedClassName()));
969
    stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
969
    stringBuffer.append(TEXT_193);
970
    stringBuffer.append(TEXT_193);
971
    stringBuffer.append(importManager.getImportedName(primaryLabel.getEditPartQualifiedClassName()));
972
    stringBuffer.append(TEXT_194);
970
    
973
    
971
}
974
}
972
if (myHelper.hasExternalLabels()) {
975
if (myHelper.hasExternalLabels()) {
973
976
974
    stringBuffer.append(TEXT_194);
975
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
976
    stringBuffer.append(TEXT_195);
977
    stringBuffer.append(TEXT_195);
978
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
979
    stringBuffer.append(TEXT_196);
977
    
980
    
978
	for (Iterator externalLabels = myHelper.getExternalLabels(); externalLabels.hasNext();) {
981
	for (Iterator externalLabels = myHelper.getExternalLabels(); externalLabels.hasNext();) {
979
		GenNodeLabel next = (GenNodeLabel) externalLabels.next();
982
		GenNodeLabel next = (GenNodeLabel) externalLabels.next();
980
983
981
    stringBuffer.append(TEXT_196);
982
    stringBuffer.append(importManager.getImportedName(next.getEditPartQualifiedClassName()));
983
    stringBuffer.append(TEXT_197);
984
    stringBuffer.append(TEXT_197);
984
    	}
985
    stringBuffer.append(importManager.getImportedName(next.getEditPartQualifiedClassName()));
985
    stringBuffer.append(TEXT_198);
986
    stringBuffer.append(TEXT_198);
986
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.LayerManager"));
987
    	}
987
    stringBuffer.append(TEXT_199);
988
    stringBuffer.append(TEXT_199);
988
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.LayerManager"));
989
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.LayerManager"));
989
    stringBuffer.append(TEXT_200);
990
    stringBuffer.append(TEXT_200);
990
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
991
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editparts.LayerManager"));
991
    stringBuffer.append(TEXT_201);
992
    stringBuffer.append(TEXT_201);
993
    stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
994
    stringBuffer.append(TEXT_202);
992
    
995
    
993
}
996
}
994
if (myHelper.hasFixedChildren() || myHelper.hasExternalLabels()) {
997
if (myHelper.hasFixedChildren() || myHelper.hasExternalLabels()) {
995
998
996
    stringBuffer.append(TEXT_202);
997
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
998
    stringBuffer.append(TEXT_203);
999
    stringBuffer.append(TEXT_203);
999
    	if (myHelper.hasExternalLabels()) {
1000
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1000
    stringBuffer.append(TEXT_204);
1001
    stringBuffer.append(TEXT_204);
1001
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1002
    	if (myHelper.hasExternalLabels()) {
1002
    stringBuffer.append(TEXT_205);
1003
    stringBuffer.append(TEXT_205);
1004
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1005
    stringBuffer.append(TEXT_206);
1003
    
1006
    
1004
	}
1007
	}
1005
	if (myHelper.hasFixedChildren()) {
1008
	if (myHelper.hasFixedChildren()) {
1006
1009
1007
    stringBuffer.append(TEXT_206);
1008
    	}
1009
    stringBuffer.append(TEXT_207);
1010
    stringBuffer.append(TEXT_207);
1010
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1011
    	}
1011
    stringBuffer.append(TEXT_208);
1012
    stringBuffer.append(TEXT_208);
1012
    	if (myHelper.hasExternalLabels()) {
1013
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1013
    stringBuffer.append(TEXT_209);
1014
    stringBuffer.append(TEXT_209);
1014
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1015
    	if (myHelper.hasExternalLabels()) {
1015
    stringBuffer.append(TEXT_210);
1016
    stringBuffer.append(TEXT_210);
1017
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1018
    stringBuffer.append(TEXT_211);
1016
    
1019
    
1017
	}
1020
	}
1018
	if (myHelper.hasFixedChildren()){
1021
	if (myHelper.hasFixedChildren()){
1019
1022
1020
    stringBuffer.append(TEXT_211);
1021
    	}
1022
    stringBuffer.append(TEXT_212);
1023
    stringBuffer.append(TEXT_212);
1023
    	if (myHelper.hasExternalLabels()) {
1024
    	}
1024
    stringBuffer.append(TEXT_213);
1025
    stringBuffer.append(TEXT_213);
1025
    stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
1026
    	if (myHelper.hasExternalLabels()) {
1026
    stringBuffer.append(TEXT_214);
1027
    stringBuffer.append(TEXT_214);
1027
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1028
    stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
1028
    stringBuffer.append(TEXT_215);
1029
    stringBuffer.append(TEXT_215);
1029
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1030
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1030
    stringBuffer.append(TEXT_216);
1031
    stringBuffer.append(TEXT_216);
1031
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1032
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart"));
1032
    stringBuffer.append(TEXT_217);
1033
    stringBuffer.append(TEXT_217);
1034
    stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
1035
    stringBuffer.append(TEXT_218);
1033
    
1036
    
1034
	}
1037
	}
1035
} // if hasFixedChildren || hasExternalLabels
1038
} // if hasFixedChildren || hasExternalLabels
1036
1039
1037
    stringBuffer.append(TEXT_218);
1038
    if (genNode.getViewmap() instanceof InnerClassViewmap) {
1039
    stringBuffer.append(TEXT_219);
1040
    stringBuffer.append(TEXT_219);
1041
    if (genNode.getViewmap() instanceof InnerClassViewmap) {
1042
    stringBuffer.append(TEXT_220);
1040
    stringBuffer.append(((InnerClassViewmap) genNode.getViewmap()).getClassBody());
1043
    stringBuffer.append(((InnerClassViewmap) genNode.getViewmap()).getClassBody());
1041
    }
1044
    }
1042
    stringBuffer.append(TEXT_220);
1043
    importManager.emitSortedImports();
1044
    stringBuffer.append(TEXT_221);
1045
    stringBuffer.append(TEXT_221);
1046
    importManager.emitSortedImports();
1047
    stringBuffer.append(TEXT_222);
1045
    return stringBuffer.toString();
1048
    return stringBuffer.toString();
1046
  }
1049
  }
1047
}
1050
}
(-)templates/parts/NodeEditPart.javajet (-8 / +11 lines)
Lines 555-568 Link Here
555
	 * @generated
555
	 * @generated
556
	 */
556
	 */
557
	public EditPolicy getPrimaryDragEditPolicy() {
557
	public EditPolicy getPrimaryDragEditPolicy() {
558
		<%=importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")%> ep = (<%=importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")%>) super.getPrimaryDragEditPolicy();
558
		EditPolicy result = super.getPrimaryDragEditPolicy();
559
		<%if (rc.getResizeHandleNames().isEmpty()) {%>
559
		if (result instanceof <%=importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")%>){
560
		ep.setResizeDirections(<%=draw2dPC%>.NONE);
560
			<%=importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")%> ep = (<%=importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")%>) result;
561
		<% } else {%>
561
			<%if (rc.getResizeHandleNames().isEmpty()) {%>
562
		ep.setResizeDirections(<%for (Iterator rcNamesIter = rc.getResizeHandleNames().iterator(); rcNamesIter.hasNext();) {
562
			ep.setResizeDirections(<%=draw2dPC%>.NONE);
563
			String nextConstantName = (String) rcNamesIter.next();%><%=draw2dPC%>.<%=nextConstantName%><%if (rcNamesIter.hasNext()) {%> | <%}}%>);
563
			<% } else {%>
564
		<%}%>
564
			ep.setResizeDirections(<%for (Iterator rcNamesIter = rc.getResizeHandleNames().iterator(); rcNamesIter.hasNext();) {
565
		return ep;
565
				String nextConstantName = (String) rcNamesIter.next();%><%=draw2dPC%>.<%=nextConstantName%><%if (rcNamesIter.hasNext()) {%> | <%}}%>);
566
			<%}%>
567
		}
568
		return result;
566
	}
569
	}
567
<%}%>
570
<%}%>
568
571

Return to bug 155698