### Eclipse Workspace Patch 1.0
#P org.eclipse.gmf.codegen.lite
Index: src/org/eclipse/gmf/internal/codegen/lite/Generator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src/org/eclipse/gmf/internal/codegen/lite/Generator.java,v
retrieving revision 1.8
diff -u -r1.8 Generator.java
--- src/org/eclipse/gmf/internal/codegen/lite/Generator.java 6 Jun 2006 16:22:12 -0000 1.8
+++ src/org/eclipse/gmf/internal/codegen/lite/Generator.java 19 Jun 2006 16:46:23 -0000
@@ -143,6 +143,9 @@
if(myDiagram.getEditorGen().getExpressionProviders() != null) {
generateExpressionProviders();
}
+ internalGenerateJavaClass(myEmitters.getCreateNotationalElementCommandGenerator(), myDiagram.getEditCommandsPackageName(), "CreateNotationalElementCommand", myDiagram);
+ internalGenerateJavaClass(myEmitters.getRemoveNotationalElementCommandGenerator(), myDiagram.getEditCommandsPackageName(), "RemoveNotationalElementCommand", myDiagram);
+ internalGenerateJavaClass(myEmitters.getReplaceNotationalElementCommandGenerator(), myDiagram.getEditCommandsPackageName(), "ReplaceNotationalElementCommand", myDiagram);
}
private void generateExpressionProviders() throws UnexpectedBehaviourException, InterruptedException {
Index: src/org/eclipse/gmf/internal/codegen/lite/CodegenEmitters.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src/org/eclipse/gmf/internal/codegen/lite/CodegenEmitters.java,v
retrieving revision 1.5
diff -u -r1.5 CodegenEmitters.java
--- src/org/eclipse/gmf/internal/codegen/lite/CodegenEmitters.java 5 Jun 2006 13:35:59 -0000 1.5
+++ src/org/eclipse/gmf/internal/codegen/lite/CodegenEmitters.java 19 Jun 2006 16:46:23 -0000
@@ -24,6 +24,9 @@
import org.eclipse.gmf.internal.common.codegen.JETEmitterAdapter;
import org.eclipse.gmf.internal.common.codegen.TextEmitter;
+import org.eclipse.gmf.codegen.templates.lite.commands.CreateNotationalElementCommandGenerator;
+import org.eclipse.gmf.codegen.templates.lite.commands.RemoveNotationalElementCommandGenerator;
+import org.eclipse.gmf.codegen.templates.lite.commands.ReplaceNotationalElementCommandGenerator;
import org.eclipse.gmf.codegen.templates.lite.editor.ActionBarContributorGenerator;
import org.eclipse.gmf.codegen.templates.lite.editor.BuildPropertiesGenerator;
import org.eclipse.gmf.codegen.templates.lite.editor.CreationWizardGenerator;
@@ -123,6 +126,9 @@
put(tr, "/expressions/AbstractExpression.javajet", AbstractExpressionGenerator.class);
put(tr, "/expressions/OCLExpressionFactory.javajet", OCLExpressionFactoryGenerator.class);
put(tr, "/expressions/RegexpExpressionFactory.javajet", RegexpExpressionFactoryGenerator.class);
+ put(tr, "/commands/CreateNotationalElementCommand.javajet", CreateNotationalElementCommandGenerator.class);
+ put(tr, "/commands/RemoveNotationalElementCommand.javajet", RemoveNotationalElementCommandGenerator.class);
+ put(tr, "/commands/ReplaceNotationalElementCommand.javajet", ReplaceNotationalElementCommandGenerator.class);
return tr;
}
@@ -262,6 +268,18 @@
return retrieve(RegexpExpressionFactoryGenerator.class);
}
+ public TextEmitter getCreateNotationalElementCommandGenerator() throws UnexpectedBehaviourException {
+ return retrieve(CreateNotationalElementCommandGenerator.class);
+ }
+
+ public TextEmitter getRemoveNotationalElementCommandGenerator() throws UnexpectedBehaviourException {
+ return retrieve(RemoveNotationalElementCommandGenerator.class);
+ }
+
+ public TextEmitter getReplaceNotationalElementCommandGenerator() throws UnexpectedBehaviourException {
+ return retrieve(ReplaceNotationalElementCommandGenerator.class);
+ }
+
/**
* @see #retrieve(Class)
*/
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/parts/LinkEditPartGenerator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/LinkEditPartGenerator.java,v
retrieving revision 1.6
diff -u -r1.6 LinkEditPartGenerator.java
--- src-templates/org/eclipse/gmf/codegen/templates/lite/parts/LinkEditPartGenerator.java 5 Jun 2006 13:35:59 -0000 1.6
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/parts/LinkEditPartGenerator.java 19 Jun 2006 16:46:16 -0000
@@ -130,9 +130,9 @@
protected final String TEXT_110 = " 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((";
protected final String TEXT_111 = ") 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;
protected final String TEXT_112 = NL;
- protected final String TEXT_113 = "\tpublic void addRefresher(";
- protected final String TEXT_114 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tpublic void removeRefresher(";
- protected final String TEXT_115 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
+ protected final String TEXT_113 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addRefresher(";
+ protected final String TEXT_114 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void removeRefresher(";
+ protected final String TEXT_115 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
protected final String TEXT_116 = " 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 + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createRefreshers() {" + NL + "\t\tstructuralFeatures2Refresher = new HashMap();";
protected final String TEXT_117 = NL;
protected final String TEXT_118 = "\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(";
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/parts/CompartmentEditPartGenerator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/CompartmentEditPartGenerator.java,v
retrieving revision 1.4
diff -u -r1.4 CompartmentEditPartGenerator.java
--- src-templates/org/eclipse/gmf/codegen/templates/lite/parts/CompartmentEditPartGenerator.java 24 May 2006 18:18:05 -0000 1.4
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/parts/CompartmentEditPartGenerator.java 19 Jun 2006 16:46:12 -0000
@@ -28,135 +28,262 @@
protected final String TEXT_9 = ";";
protected final String TEXT_10 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
protected final String TEXT_11 = "(View view) {" + NL + "\t\tsetModel(view);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
- protected final String TEXT_12 = " getModelChildren() {" + NL + "\t\treturn ((View) getModel()).getChildren();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createEditPolicies() {" + NL + "\t\t//XXX: install correct edit policies!";
- protected final String TEXT_13 = NL + "\t\tinstallEditPolicy(";
- protected final String TEXT_14 = ".LAYOUT_ROLE, new ";
- protected final String TEXT_15 = "() {" + NL + "\t\t\tprotected Command createChangeConstraintCommand(final ";
- protected final String TEXT_16 = " request, final EditPart child, Object constraint) {" + NL + "\t\t\t\tfinal Node node = (Node) child.getModel();" + NL + "\t\t\t\t";
- protected final String TEXT_17 = " emfCommand = new ";
- protected final String TEXT_18 = "(\"Change node position/size\") {" + NL + "\t\t\t\t\tprivate ";
- protected final String TEXT_19 = " moveDelta;" + NL + "\t\t\t\t\tprivate ";
- protected final String TEXT_20 = " resizeDelta;" + NL + "" + NL + "\t\t\t\t\tpublic boolean canUndo() {" + NL + "\t\t\t\t\t\treturn canExecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tprotected boolean prepare() {" + NL + "\t\t\t\t\t\tif (node.getLayoutConstraint() instanceof Bounds == false) {" + NL + "\t\t\t\t\t\t\treturn false;" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tBounds bounds = (Bounds) node.getLayoutConstraint();" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_21 = " original = new ";
- protected final String TEXT_22 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_23 = " referenceFigure = ((";
- protected final String TEXT_24 = ")child).getFigure();" + NL + "\t\t\t\t\t\treferenceFigure.translateToAbsolute(original);" + NL + "\t\t\t\t\t\t";
- protected final String TEXT_25 = " transformed = request.getTransformedRectangle(original);" + NL + "\t\t\t\t\t\treferenceFigure.translateToRelative(transformed);" + NL + "\t\t\t\t\t\treferenceFigure.translateToRelative(original);" + NL + "\t\t\t\t\t\tresizeDelta = transformed.getSize().expand(original.getSize().negate());" + NL + "\t\t\t\t\t\tmoveDelta = transformed.getTopLeft().translate(original.getTopLeft().negate());" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void undo() {" + NL + "\t\t\t\t\t\texecute(moveDelta.getNegated(), resizeDelta.getNegated());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void execute() {" + NL + "\t\t\t\t\t\texecute(moveDelta, resizeDelta);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void redo() {" + NL + "\t\t\t\t\t\texecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tprivate void execute(";
- protected final String TEXT_26 = " move, ";
- protected final String TEXT_27 = " resize) {" + NL + "\t\t\t\t\t\tBounds bounds = (Bounds) node.getLayoutConstraint();" + NL + "\t\t\t\t\t\tbounds.setX(bounds.getX() + move.x);" + NL + "\t\t\t\t\t\tbounds.setY(bounds.getY() + move.y);" + NL + "\t\t\t\t\t\tbounds.setWidth(bounds.getWidth() + resize.width);" + NL + "\t\t\t\t\t\tbounds.setHeight(bounds.getHeight() + resize.height);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t\treturn new WrappingCommand(";
- protected final String TEXT_28 = ".getEditingDomain(node.getDiagram().getElement()), emfCommand);" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\tassert false;" + NL + "\t\t\t\treturn ";
- protected final String TEXT_29 = ".INSTANCE;" + NL + "\t\t\t}";
- protected final String TEXT_30 = NL + "\t\tinstallEditPolicy(";
- protected final String TEXT_31 = ".LAYOUT_ROLE, new ";
- protected final String TEXT_32 = "() {" + NL + "\t\t\tprotected Object getConstraintFor(";
- protected final String TEXT_33 = " rect) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Object getConstraintFor(";
- protected final String TEXT_34 = " point) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\treturn ";
- protected final String TEXT_35 = ".INSTANCE;" + NL + "\t\t\t}";
- protected final String TEXT_36 = NL + "\t\t\tprotected Command getCreateCommand(CreateRequest request) {";
- protected final String TEXT_37 = NL + "\t\t\t\tif (request instanceof ";
- protected final String TEXT_38 = ".CreateRequestEx) {" + NL + "\t\t\t\t\t";
- protected final String TEXT_39 = ".CreateRequestEx requestEx = (";
- protected final String TEXT_40 = ".CreateRequestEx) request;" + NL + "\t\t\t\t\tint[] visualIds = requestEx.getVisualIds();" + NL + "\t\t\t\t\t";
- protected final String TEXT_41 = " result = new ";
- protected final String TEXT_42 = "();" + 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) {";
- protected final String TEXT_43 = NL + "\t\t\t\t\t\tcase ";
- protected final String TEXT_44 = ".VISUAL_ID:" + NL + "\t\t\t\t\t\t\tresult.append(new Create";
- protected final String TEXT_45 = "Command((View) getModel(), requestEx";
- protected final String TEXT_46 = ", " + NL + "\t\t\t\t\t\t\t\t(";
- protected final String TEXT_47 = ")getConstraintFor(request)";
- protected final String TEXT_48 = "));" + NL + "\t\t\t\t\t\t\tbreak;";
- protected final String TEXT_49 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\treturn new WrappingCommand(";
- protected final String TEXT_50 = ".getEditingDomain(((View) getModel()).getDiagram().getElement()), result);" + NL + "\t\t\t\t}";
- protected final String TEXT_51 = NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getTitleName() {" + NL + "\t\treturn \"";
- protected final String TEXT_52 = "\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_53 = " createFigure() {" + NL + "\t\t";
- protected final String TEXT_54 = " result = new ";
- protected final String TEXT_55 = "();" + NL + "\t\tresult.setLabel(getTitleName());" + NL + "\t\tresult.setOpaque(false);" + NL + "\t\tresult.setLayoutManager(new ";
- protected final String TEXT_56 = "());" + NL + "\t\t";
- protected final String TEXT_57 = " scrollPane = new ";
- protected final String TEXT_58 = "();" + NL + "\t\tresult.add(scrollPane);";
- protected final String TEXT_59 = NL + "\t\t";
- protected final String TEXT_60 = " viewport = new ";
- protected final String TEXT_61 = "();" + NL + "\t\tcontentPane = new ";
- protected final String TEXT_62 = "();" + NL + "\t\tcontentPane.setLayoutManager(new ";
- protected final String TEXT_63 = "());";
- protected final String TEXT_64 = NL + "\t\t";
- protected final String TEXT_65 = " viewport = new ";
- protected final String TEXT_66 = "();" + NL + "\t\tcontentPane = new ";
- protected final String TEXT_67 = "();" + NL + "\t\tcontentPane.setLayoutManager(new ";
- protected final String TEXT_68 = "());";
- protected final String TEXT_69 = NL + "\t\tviewport.setContents(contentPane);" + NL + "\t\tscrollPane.setViewport(viewport);" + NL + "\t\treturn result;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\treturn contentPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IFigure contentPane;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_70 = " resolveSemanticElement() {" + NL + "\t\tfor(EditPart editPart = this; editPart != null; editPart = editPart.getParent()) {" + NL + "\t\t\tView view = (View)editPart.getModel();" + NL + "\t\t\tif (view != null && view.getElement() != null) {" + NL + "\t\t\t\treturn (";
- protected final String TEXT_71 = ") view.getElement();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL;
- protected final String TEXT_72 = NL;
- protected final String TEXT_73 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_74 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
- protected final String TEXT_75 = " feature, ";
- protected final String TEXT_76 = " 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 HashMap();";
- protected final String TEXT_77 = NL;
- protected final String TEXT_78 = "\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(";
- protected final String TEXT_79 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
- protected final String TEXT_80 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);";
- protected final String TEXT_81 = NL;
- protected final String TEXT_82 = "\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(";
- protected final String TEXT_83 = ".eINSTANCE.getView_Visible(), visibilityRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "//XXX:\t\trefreshBackgroundColor();" + NL + "//XXX:\t\trefreshForegroundColor();" + NL + "//XXX:\t\trefreshFont();" + NL + "\t\trefreshVisibility();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisibility() {" + NL + "\t\tboolean isVisible = ((View)getModel()).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;
- protected final String TEXT_84 = NL;
- protected final String TEXT_85 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_86 = "static ";
- protected final String TEXT_87 = "class Create";
- protected final String TEXT_88 = "Command extends ";
- protected final String TEXT_89 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
- protected final String TEXT_90 = " parent;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_91 = " createdNode;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_92 = "Command(";
- protected final String TEXT_93 = " parent, ";
- protected final String TEXT_94 = ".CreateRequestEx request";
- protected final String TEXT_95 = ", ";
- protected final String TEXT_96 = " constraint";
- protected final String TEXT_97 = ") {" + NL + "\t\t\tthis.parent = parent;" + NL + "\t\t\tcreatedNode = ";
- protected final String TEXT_98 = ".eINSTANCE.createNode();";
- protected final String TEXT_99 = NL + "\t\t\t";
- protected final String TEXT_100 = " createdDomainElement = ";
- protected final String TEXT_101 = ".eINSTANCE.create(" + NL + "\t\t\t\t";
- protected final String TEXT_102 = ".eINSTANCE.get";
- protected final String TEXT_103 = "());";
- protected final String TEXT_104 = NL + "\t\t\t";
- protected final String TEXT_105 = " createdDomainElement = ";
- protected final String TEXT_106 = ".eINSTANCE.create";
- protected final String TEXT_107 = "();";
- protected final String TEXT_108 = "\t\t\tcreatedNode.setElement(createdDomainElement);" + NL + "\t\t\t";
- protected final String TEXT_109 = NL + "\t\t\t";
- protected final String TEXT_110 = ".";
- protected final String TEXT_111 = ".initializeElement(createdDomainElement);" + NL + "\t\t\t";
- protected final String TEXT_112 = ".decorateView(createdNode);";
- protected final String TEXT_113 = NL + "\t\t\t";
- protected final String TEXT_114 = " bounds = ";
- protected final String TEXT_115 = ".eINSTANCE.createBounds();" + NL + "\t\t\tcreatedNode.setLayoutConstraint(bounds);" + NL + "\t\t\tbounds.setX(constraint.x);" + NL + "\t\t\tbounds.setY(constraint.y);";
- protected final String TEXT_116 = NL + "\t\t\tbounds.setWidth(Math.max(constraint.width, ";
- protected final String TEXT_117 = "));" + NL + "\t\t\tbounds.setHeight(Math.max(constraint.height, ";
- protected final String TEXT_118 = "));";
- protected final String TEXT_119 = NL + "\t\t\t";
- protected final String TEXT_120 = " domainModelEditDomain = ";
- protected final String TEXT_121 = ".getEditingDomain(parent.getDiagram().getElement());";
- protected final String TEXT_122 = NL + "\t\t\t";
- protected final String TEXT_123 = " compoundCommand = new ";
- protected final String TEXT_124 = "();" + NL + "\t\t\tcompoundCommand.append(";
- protected final String TEXT_125 = ".create(domainModelEditDomain, ";
- protected final String TEXT_126 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_127 = ".eINSTANCE.get";
- protected final String TEXT_128 = "(), createdNode.getElement()));" + NL + "\t\t\tcompoundCommand.append(";
- protected final String TEXT_129 = ".create(domainModelEditDomain, ";
- protected final String TEXT_130 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_131 = ".eINSTANCE.get";
- protected final String TEXT_132 = "(), createdNode.getElement()));" + NL + "\t\t\tthis.domainModelAddCommand = compoundCommand;";
- protected final String TEXT_133 = NL + "\t\t\tthis.domainModelAddCommand = ";
- protected final String TEXT_134 = ".create(domainModelEditDomain, ";
- protected final String TEXT_135 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_136 = ".eINSTANCE.get";
- protected final String TEXT_137 = "(), createdNode.getElement());";
- protected final String TEXT_138 = NL + "\t\t\trequest.setCreatedObject(createdNode);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\treturn domainModelAddCommand != null && domainModelAddCommand.canExecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn domainModelAddCommand != null && domainModelAddCommand.canUndo();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tparent.insertChild(createdNode);" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tparent.getPersistedChildren().remove(createdNode);" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_139 = NL + "}" + NL;
- protected final String TEXT_140 = NL;
+ protected final String TEXT_12 = " getModelChildren() {" + NL + "\t\treturn getDiagramNode().getChildren();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
+ protected final String TEXT_13 = " getDiagramNode() {" + NL + "\t\treturn (";
+ protected final String TEXT_14 = ") getModel();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createEditPolicies() {";
+ protected final String TEXT_15 = NL + "\t\tinstallEditPolicy(";
+ protected final String TEXT_16 = ".LAYOUT_ROLE, new ";
+ protected final String TEXT_17 = "() {" + NL + "\t\t\tprotected Command createChangeConstraintCommand(final ";
+ protected final String TEXT_18 = " request, final EditPart child, Object constraint) {" + NL + "\t\t\t\tfinal Node node = (Node) child.getModel();" + NL + "\t\t\t\t";
+ protected final String TEXT_19 = " emfCommand = new ";
+ protected final String TEXT_20 = "(\"Change node position/size\") {" + NL + "\t\t\t\t\tprivate ";
+ protected final String TEXT_21 = " moveDelta;" + NL + "\t\t\t\t\tprivate ";
+ protected final String TEXT_22 = " resizeDelta;" + NL + "" + NL + "\t\t\t\t\tpublic boolean canUndo() {" + NL + "\t\t\t\t\t\treturn canExecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tprotected boolean prepare() {" + NL + "\t\t\t\t\t\tif (node.getLayoutConstraint() instanceof Bounds == false) {" + NL + "\t\t\t\t\t\t\treturn false;" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tBounds bounds = (Bounds) node.getLayoutConstraint();" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_23 = " original = new ";
+ protected final String TEXT_24 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_25 = " referenceFigure = ((";
+ protected final String TEXT_26 = ")child).getFigure();" + NL + "\t\t\t\t\t\treferenceFigure.translateToAbsolute(original);" + NL + "\t\t\t\t\t\t";
+ protected final String TEXT_27 = " transformed = request.getTransformedRectangle(original);" + NL + "\t\t\t\t\t\treferenceFigure.translateToRelative(transformed);" + NL + "\t\t\t\t\t\treferenceFigure.translateToRelative(original);" + NL + "\t\t\t\t\t\tresizeDelta = transformed.getSize().expand(original.getSize().negate());" + NL + "\t\t\t\t\t\tmoveDelta = transformed.getTopLeft().translate(original.getTopLeft().negate());" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void undo() {" + NL + "\t\t\t\t\t\texecute(moveDelta.getNegated(), resizeDelta.getNegated());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void execute() {" + NL + "\t\t\t\t\t\texecute(moveDelta, resizeDelta);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void redo() {" + NL + "\t\t\t\t\t\texecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tprivate void execute(";
+ protected final String TEXT_28 = " move, ";
+ protected final String TEXT_29 = " resize) {" + NL + "\t\t\t\t\t\tBounds bounds = (Bounds) node.getLayoutConstraint();" + NL + "\t\t\t\t\t\tbounds.setX(bounds.getX() + move.x);" + NL + "\t\t\t\t\t\tbounds.setY(bounds.getY() + move.y);" + NL + "\t\t\t\t\t\tbounds.setWidth(bounds.getWidth() + resize.width);" + NL + "\t\t\t\t\t\tbounds.setHeight(bounds.getHeight() + resize.height);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t\treturn new WrappingCommand(";
+ protected final String TEXT_30 = ".getEditingDomain(node.getDiagram().getElement()), emfCommand);" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\tassert false;" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_31 = ".INSTANCE;" + NL + "\t\t\t}";
+ protected final String TEXT_32 = NL + "\t\tinstallEditPolicy(";
+ protected final String TEXT_33 = ".LAYOUT_ROLE, new ";
+ protected final String TEXT_34 = "() {" + NL + "\t\t\tprotected Object getConstraintFor(";
+ protected final String TEXT_35 = " rect) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Object getConstraintFor(";
+ protected final String TEXT_36 = " point) {" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\treturn ";
+ protected final String TEXT_37 = ".INSTANCE;" + NL + "\t\t\t}";
+ protected final String TEXT_38 = NL + "\t\t\tprotected Command getCreateCommand(CreateRequest request) {";
+ protected final String TEXT_39 = NL + "\t\t\t\tif (request instanceof ";
+ protected final String TEXT_40 = ".CreateRequestEx) {" + NL + "\t\t\t\t\t";
+ protected final String TEXT_41 = ".CreateRequestEx requestEx = (";
+ protected final String TEXT_42 = ".CreateRequestEx) request;" + NL + "\t\t\t\t\tint[] visualIds = requestEx.getVisualIds();" + NL + "\t\t\t\t\t";
+ protected final String TEXT_43 = " result = new ";
+ protected final String TEXT_44 = "();" + 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) {";
+ protected final String TEXT_45 = NL + "\t\t\t\t\t\tcase ";
+ protected final String TEXT_46 = ".VISUAL_ID:" + NL + "\t\t\t\t\t\t\tresult.append(new Create";
+ protected final String TEXT_47 = "Command((View) getModel(), requestEx";
+ protected final String TEXT_48 = ", " + NL + "\t\t\t\t\t\t\t\t(";
+ protected final String TEXT_49 = ")getConstraintFor(request)";
+ protected final String TEXT_50 = "));" + NL + "\t\t\t\t\t\t\tbreak;";
+ protected final String TEXT_51 = NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\treturn new WrappingCommand(";
+ protected final String TEXT_52 = ".getEditingDomain(((View) getModel()).getDiagram().getElement()), result);" + NL + "\t\t\t\t}";
+ protected final String TEXT_53 = NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\tinstallNotationModelRefresher();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String getTitleName() {" + NL + "\t\treturn \"";
+ protected final String TEXT_54 = "\";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_55 = " createFigure() {" + NL + "\t\t";
+ protected final String TEXT_56 = " result = new ";
+ protected final String TEXT_57 = "();" + NL + "\t\tresult.setLabel(getTitleName());" + NL + "\t\tresult.setOpaque(false);" + NL + "\t\tresult.setLayoutManager(new ";
+ protected final String TEXT_58 = "());" + NL + "\t\t";
+ protected final String TEXT_59 = " scrollPane = new ";
+ protected final String TEXT_60 = "();" + NL + "\t\tresult.add(scrollPane);";
+ protected final String TEXT_61 = NL + "\t\t";
+ protected final String TEXT_62 = " viewport = new ";
+ protected final String TEXT_63 = "();" + NL + "\t\tcontentPane = new ";
+ protected final String TEXT_64 = "();" + NL + "\t\tcontentPane.setLayoutManager(new ";
+ protected final String TEXT_65 = "());";
+ protected final String TEXT_66 = NL + "\t\t";
+ protected final String TEXT_67 = " viewport = new ";
+ protected final String TEXT_68 = "();" + NL + "\t\tcontentPane = new ";
+ protected final String TEXT_69 = "();" + NL + "\t\tcontentPane.setLayoutManager(new ";
+ protected final String TEXT_70 = "());";
+ protected final String TEXT_71 = NL + "\t\tviewport.setContents(contentPane);" + NL + "\t\tscrollPane.setViewport(viewport);" + NL + "\t\treturn result;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\treturn contentPane;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate IFigure contentPane;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_72 = " resolveSemanticElement() {" + NL + "\t\tfor(EditPart editPart = this; editPart != null; editPart = editPart.getParent()) {" + NL + "\t\t\tView view = (View)editPart.getModel();" + NL + "\t\t\tif (view != null && view.getElement() != null) {" + NL + "\t\t\t\treturn (";
+ protected final String TEXT_73 = ") view.getElement();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void activate() {" + NL + "\t\tsuper.activate();" + NL + "\t\tinstallNotationModelRefresher();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void deactivate() {" + NL + "\t\tuninstallNotationModelRefresher();" + NL + "\t\tsuper.deactivate();" + NL + "\t}" + NL;
+ protected final String TEXT_74 = NL;
+ protected final String TEXT_75 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void installNotationModelRefresher() {" + NL + "\t\tNotationModelRefresher refresher = getNotationModelRefresher();" + NL + "\t\tif (refresher.isInstalled()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_76 = " domainModelEditDomain = ";
+ protected final String TEXT_77 = ".getEditingDomain(";
+ protected final String TEXT_78 = ".getElement());" + NL + "\t\trefresher.install(domainModelEditDomain);" + NL + "\t\trefreshNotationModel();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void uninstallNotationModelRefresher() {" + NL + "\t\tgetNotationModelRefresher().uninstall();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate NotationModelRefresher notationModelRefresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate NotationModelRefresher getNotationModelRefresher() {" + NL + "\t\tif (notationModelRefresher == null) {" + NL + "\t\t\tnotationModelRefresher = new NotationModelRefresher();" + NL + "\t\t}" + NL + "\t\treturn notationModelRefresher;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class NotationModelRefresher extends ";
+ protected final String TEXT_79 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_80 = " filter;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_81 = " editingDomain;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic NotationModelRefresher() {" + NL + "\t\t\tcreateFilter();" + NL + "\t\t}";
+ protected final String TEXT_82 = NL + NL + "\t\t/**" + NL + "\t\t * NB: Children of this element are selected based on constraint declared in ";
+ protected final String TEXT_83 = ". " + NL + "\t\t * Since no assumptions may be made concerning the runtime behavior of the constraint, any non-touch notification may result in " + NL + "\t\t * notational model having to be updated." + NL + "\t\t *
User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications" + NL + "\t\t * result in such an update." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_84 = " getConstrainedChildrenFilter() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_85 = ".NOT_TOUCH;" + NL + "\t\t}";
+ protected final String TEXT_86 = NL + NL + "\t\t/**" + NL + "\t\t * Creates a notification filter which filters notifications that may possibly affect the notational model" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void createFilter() {";
+ protected final String TEXT_87 = NL + "\t\t\tfilter = ";
+ protected final String TEXT_88 = ".createFeatureFilter(";
+ protected final String TEXT_89 = ".eINSTANCE.get";
+ protected final String TEXT_90 = "());";
+ protected final String TEXT_91 = NL + "\t\t\tfilter = filter.or(";
+ protected final String TEXT_92 = ".createFeatureFilter(";
+ protected final String TEXT_93 = ".eINSTANCE.get";
+ protected final String TEXT_94 = "()));";
+ protected final String TEXT_95 = NL + "\t\t\tfilter = filter.and(";
+ protected final String TEXT_96 = ".createNotifierFilter(";
+ protected final String TEXT_97 = "));";
+ protected final String TEXT_98 = NL + "\t\t\tfilter = ";
+ protected final String TEXT_99 = ".createNotifierFilter(";
+ protected final String TEXT_100 = ");";
+ protected final String TEXT_101 = NL + "\t\t\tfilter = getConstrainedChildrenFilter().or(filter);";
+ protected final String TEXT_102 = NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void install(";
+ protected final String TEXT_103 = " editingDomain) {" + NL + "\t\t\tif (this.editingDomain != null && !this.editingDomain.equals(editingDomain)) {" + NL + "\t\t\t\tthrow new IllegalStateException(\"Already listening to another editing domain\");" + NL + "\t\t\t}" + NL + "\t\t\tthis.editingDomain = editingDomain;" + NL + "\t\t\tthis.editingDomain.addResourceSetListener(this);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isInstalled() {" + NL + "\t\t\treturn editingDomain != null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void uninstall() {" + NL + "\t\t\tif (isInstalled()) {" + NL + "\t\t\t\teditingDomain.removeResourceSetListener(this);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isPrecommitOnly() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_104 = " transactionAboutToCommit(";
+ protected final String TEXT_105 = " event) {" + NL + "\t\t\treturn getRefreshNotationModelCommand();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_106 = " getFilter() {" + NL + "\t\t\treturn filter;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshNotationModel() {" + NL + "\t\t";
+ protected final String TEXT_107 = " command = getRefreshNotationModelCommand();" + NL + "\t\tif (command == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_108 = " domainModelEditDomain = ";
+ protected final String TEXT_109 = ".getEditingDomain(";
+ protected final String TEXT_110 = ".getElement());" + NL + "\t\tgetViewer().getEditDomain().getCommandStack().execute(new WrappingCommand(domainModelEditDomain, command));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_111 = " getRefreshNotationModelCommand() {" + NL + "\t\t";
+ protected final String TEXT_112 = " semanticChildren = getSemanticChildren();" + NL + "\t\t";
+ protected final String TEXT_113 = " notationalChildren = ";
+ protected final String TEXT_114 = ".getChildren();" + NL + "\t\tfinal ";
+ protected final String TEXT_115 = " semanticToNotational = new ";
+ protected final String TEXT_116 = "();" + NL + "\t\tfor(";
+ protected final String TEXT_117 = " it = notationalChildren.iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_118 = " next = (";
+ protected final String TEXT_119 = ") it.next();" + NL + "\t\t\t";
+ protected final String TEXT_120 = " nextSemantic = next.getElement();" + NL + "\t\t\tif (nextSemantic != null) {" + NL + "\t\t\t\tsemanticToNotational.put(nextSemantic, next);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_121 = " parentView = ";
+ protected final String TEXT_122 = ";" + NL + "\t\t";
+ protected final String TEXT_123 = " command = new ";
+ protected final String TEXT_124 = "();" + NL + "\t\tfor(";
+ protected final String TEXT_125 = " it = semanticChildren.iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_126 = " next = (";
+ protected final String TEXT_127 = ") it.next();" + NL + "\t\t\t";
+ protected final String TEXT_128 = " currentView = (";
+ protected final String TEXT_129 = ") semanticToNotational.remove(next);" + NL + "\t\t\tint nodeVisualID = ";
+ protected final String TEXT_130 = ".INSTANCE.getNodeVisualID(parentView, next);" + NL + "\t\t\tif (currentView == null) {" + NL + "\t\t\t\tif (shouldCreateView(next)) {" + NL + "\t\t\t\t\tcommand.appendIfCanExecute(getCreateNotationalElementCommand(parentView, next, nodeVisualID));" + NL + "\t\t\t\t}" + NL + "\t\t\t} else if (nodeVisualID != ";
+ protected final String TEXT_131 = ".getVisualID(currentView)) {" + NL + "\t\t\t\t";
+ protected final String TEXT_132 = " notationalCommand = getCreateNotationalElementCommand(parentView, next, nodeVisualID);" + NL + "\t\t\t\tif (notationalCommand != null) {" + NL + "\t\t\t\t\tcommand.appendIfCanExecute(new ";
+ protected final String TEXT_133 = "(parentView, notationalCommand, currentView));" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tfor(";
+ protected final String TEXT_134 = " it = semanticToNotational.values().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_135 = " obsoleteView = (";
+ protected final String TEXT_136 = ") it.next();" + NL + "\t\t\tcommand.appendIfCanExecute(new ";
+ protected final String TEXT_137 = "(parentView, obsoleteView));" + NL + "\t\t}" + NL + "\t\treturn command.getCommandList().isEmpty() ? null : command;" + NL + "\t}" + NL + "" + NL + "\tprivate ";
+ protected final String TEXT_138 = " getCreateNotationalElementCommand(";
+ protected final String TEXT_139 = " parentView, ";
+ protected final String TEXT_140 = " domainElement, int nodeVisualID) {" + NL + "\t\tswitch (nodeVisualID) {";
+ protected final String TEXT_141 = NL + "\t\tcase ";
+ protected final String TEXT_142 = ".VISUAL_ID:" + NL + "\t\t\tif (domainElement instanceof ";
+ protected final String TEXT_143 = ") {" + NL + "\t\t\t\treturn new Create";
+ protected final String TEXT_144 = "NotationCommand(parentView, domainElement";
+ protected final String TEXT_145 = ", new Rectangle(0, 0, 0, 0)";
+ protected final String TEXT_146 = ");" + NL + "\t\t\t}" + NL + "\t\t\treturn null;";
+ protected final String TEXT_147 = NL + "\t\tdefault:" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_148 = " getSemanticChildren() {";
+ protected final String TEXT_149 = NL;
+ protected final String TEXT_150 = NL + "\treturn ";
+ protected final String TEXT_151 = ".EMPTY_LIST;";
+ protected final String TEXT_152 = NL + "\t";
+ protected final String TEXT_153 = " result = new ";
+ protected final String TEXT_154 = "();";
+ protected final String TEXT_155 = NL + "\t";
+ protected final String TEXT_156 = " viewObject = ";
+ protected final String TEXT_157 = ";" + NL + "\t";
+ protected final String TEXT_158 = " modelObject = ";
+ protected final String TEXT_159 = ";" + NL + "\t";
+ protected final String TEXT_160 = " nextValue;" + NL + "\tint nodeVID;";
+ protected final String TEXT_161 = NL + "\tfor(";
+ protected final String TEXT_162 = " it = ((";
+ protected final String TEXT_163 = ")modelObject).";
+ protected final String TEXT_164 = "().iterator(); it.hasNext(); ) {" + NL + "\t\tnextValue = (";
+ protected final String TEXT_165 = ") it.next();";
+ protected final String TEXT_166 = NL + "\tnextValue = ((";
+ protected final String TEXT_167 = ")modelObject).";
+ protected final String TEXT_168 = "();";
+ protected final String TEXT_169 = NL + "\tnodeVID = ";
+ protected final String TEXT_170 = ".INSTANCE.getNodeVisualID(viewObject, nextValue);";
+ protected final String TEXT_171 = NL + "\tswitch (nodeVID) {";
+ protected final String TEXT_172 = NL + "\tcase ";
+ protected final String TEXT_173 = ".VISUAL_ID: {";
+ protected final String TEXT_174 = NL + "\tif (";
+ protected final String TEXT_175 = ".VISUAL_ID == nodeVID) {";
+ protected final String TEXT_176 = NL + "\t\tresult.add(nextValue);";
+ protected final String TEXT_177 = NL + "\t\tbreak;" + NL + "\t\t}";
+ protected final String TEXT_178 = NL + "\t\t}";
+ protected final String TEXT_179 = NL + "\t}";
+ protected final String TEXT_180 = NL + "\t}";
+ protected final String TEXT_181 = NL + "\treturn result;";
+ protected final String TEXT_182 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns whether a notational element should be created for the given domain element. " + NL + "\t * The generated code always returns ";
+ protected final String TEXT_183 = ". " + NL + "\t * User can change implementation of this method to handle a more sophisticated logic." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean shouldCreateView(EObject domainElement) {" + NL + "\t\treturn ";
+ protected final String TEXT_184 = ";" + NL + "\t}";
+ protected final String TEXT_185 = NL;
+ protected final String TEXT_186 = NL;
+ protected final String TEXT_187 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_188 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
+ protected final String TEXT_189 = " feature, ";
+ protected final String TEXT_190 = " 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 HashMap();";
+ protected final String TEXT_191 = NL;
+ protected final String TEXT_192 = "\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(";
+ protected final String TEXT_193 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
+ protected final String TEXT_194 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);";
+ protected final String TEXT_195 = NL;
+ protected final String TEXT_196 = "\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(";
+ protected final String TEXT_197 = ".eINSTANCE.getView_Visible(), visibilityRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisuals() {" + NL + "\t\tsuper.refreshVisuals();" + NL + "//XXX:\t\trefreshBackgroundColor();" + NL + "//XXX:\t\trefreshForegroundColor();" + NL + "//XXX:\t\trefreshFont();" + NL + "\t\trefreshVisibility();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshVisibility() {" + NL + "\t\tboolean isVisible = ((View)getModel()).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;
+ protected final String TEXT_198 = NL;
+ protected final String TEXT_199 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_200 = "static ";
+ protected final String TEXT_201 = "class Create";
+ protected final String TEXT_202 = "NotationCommand extends ";
+ protected final String TEXT_203 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate Create";
+ protected final String TEXT_204 = "NotationCommand(";
+ protected final String TEXT_205 = " parent, " + NL + "\t\t\t\t";
+ protected final String TEXT_206 = " domainElement";
+ protected final String TEXT_207 = ", ";
+ protected final String TEXT_208 = " constraint";
+ protected final String TEXT_209 = ") {" + NL + "\t\t\tsuper(parent);" + NL + "\t\t\tNode createdNode = ";
+ protected final String TEXT_210 = ".eINSTANCE.createNode();" + NL + "\t\t\tsetCreatedView(createdNode);" + NL + "\t\t\tcreatedNode.setElement(domainElement);" + NL + "\t\t\t";
+ protected final String TEXT_211 = ".decorateView(createdNode);";
+ protected final String TEXT_212 = NL + "\t\t\t";
+ protected final String TEXT_213 = " bounds = ";
+ protected final String TEXT_214 = ".eINSTANCE.createBounds();" + NL + "\t\t\tcreatedNode.setLayoutConstraint(bounds);" + NL + "\t\t\tbounds.setX(constraint.x);" + NL + "\t\t\tbounds.setY(constraint.y);";
+ protected final String TEXT_215 = NL + "\t\t\tbounds.setWidth(Math.max(constraint.width, ";
+ protected final String TEXT_216 = "));" + NL + "\t\t\tbounds.setHeight(Math.max(constraint.height, ";
+ protected final String TEXT_217 = "));";
+ protected final String TEXT_218 = NL + "\t\t}" + NL + "\t}" + NL;
+ protected final String TEXT_219 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_220 = "static ";
+ protected final String TEXT_221 = "class Create";
+ protected final String TEXT_222 = "Command extends ";
+ protected final String TEXT_223 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final Create";
+ protected final String TEXT_224 = "NotationCommand notationAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_225 = "Command(";
+ protected final String TEXT_226 = " parent, ";
+ protected final String TEXT_227 = ".CreateRequestEx request";
+ protected final String TEXT_228 = ", ";
+ protected final String TEXT_229 = " constraint";
+ protected final String TEXT_230 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_231 = " domainModelEditDomain = ";
+ protected final String TEXT_232 = ".getEditingDomain(parent.getDiagram().getElement());";
+ protected final String TEXT_233 = NL + "\t\t\t";
+ protected final String TEXT_234 = " createdDomainElement = ";
+ protected final String TEXT_235 = ".eINSTANCE.create(" + NL + "\t\t\t\t";
+ protected final String TEXT_236 = ".eINSTANCE.get";
+ protected final String TEXT_237 = "());";
+ protected final String TEXT_238 = NL + "\t\t\t";
+ protected final String TEXT_239 = " createdDomainElement = ";
+ protected final String TEXT_240 = ".eINSTANCE.create";
+ protected final String TEXT_241 = "();";
+ protected final String TEXT_242 = NL + "\t\t\t";
+ protected final String TEXT_243 = NL + "\t\t\t";
+ protected final String TEXT_244 = ".";
+ protected final String TEXT_245 = ".initializeElement(createdDomainElement);";
+ protected final String TEXT_246 = NL + "\t\t\t";
+ protected final String TEXT_247 = " compoundCommand = new ";
+ protected final String TEXT_248 = "();" + NL + "\t\t\tcompoundCommand.append(";
+ protected final String TEXT_249 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_250 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_251 = ".eINSTANCE.get";
+ protected final String TEXT_252 = "(), createdDomainElement));" + NL + "\t\t\tcompoundCommand.append(";
+ protected final String TEXT_253 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_254 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_255 = ".eINSTANCE.get";
+ protected final String TEXT_256 = "(), createdDomainElement));" + NL + "\t\t\tthis.domainModelAddCommand = compoundCommand;";
+ protected final String TEXT_257 = NL + "\t\t\tthis.domainModelAddCommand = ";
+ protected final String TEXT_258 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_259 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_260 = ".eINSTANCE.get";
+ protected final String TEXT_261 = "(), createdDomainElement);";
+ protected final String TEXT_262 = NL + "\t\t\tthis.notationAddCommand = new Create";
+ protected final String TEXT_263 = "NotationCommand(parent, createdDomainElement";
+ protected final String TEXT_264 = ", constraint";
+ protected final String TEXT_265 = ");" + NL + "\t\t\trequest.setCreatedObject(notationAddCommand.getCreatedView());" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\treturn domainModelAddCommand != null" + NL + "\t\t\t\t\t&& domainModelAddCommand.canExecute() && notationAddCommand != null && notationAddCommand.canExecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn domainModelAddCommand != null" + NL + "\t\t\t\t\t&& domainModelAddCommand.canUndo() && notationAddCommand != null && notationAddCommand.canUndo();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t\tnotationAddCommand.execute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tnotationAddCommand.undo();" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_266 = NL + "}" + NL;
+ protected final String TEXT_267 = NL;
public String generate(Object argument)
{
@@ -165,7 +292,9 @@
GenCompartment genCompartment = (GenCompartment) ((Object[]) argument)[0];
GenNode genHost = genCompartment.getNode();
GenDiagram genDiagram = genCompartment.getDiagram();
+List childNodes = genCompartment.getChildNodes();
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+importManager.registerInnerClass("NotationModelRefresher"); //from notationModelRefresher.jetinc
stringBuffer.append(TEXT_1);
@@ -202,229 +331,544 @@
stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_12);
- if (!genCompartment.isListLayout()) {
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
stringBuffer.append(TEXT_14);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.XYLayoutEditPolicy"));
+ if (!genCompartment.isListLayout()) {
stringBuffer.append(TEXT_15);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.ChangeBoundsRequest"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy"));
stringBuffer.append(TEXT_16);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.XYLayoutEditPolicy"));
stringBuffer.append(TEXT_17);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.requests.ChangeBoundsRequest"));
stringBuffer.append(TEXT_18);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
stringBuffer.append(TEXT_19);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
stringBuffer.append(TEXT_20);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
stringBuffer.append(TEXT_21);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
stringBuffer.append(TEXT_22);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
stringBuffer.append(TEXT_23);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
- stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
stringBuffer.append(TEXT_25);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart"));
stringBuffer.append(TEXT_26);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
stringBuffer.append(TEXT_27);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
stringBuffer.append(TEXT_28);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
stringBuffer.append(TEXT_29);
- } else {
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
stringBuffer.append(TEXT_30);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
stringBuffer.append(TEXT_31);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy"));
+ } else {
stringBuffer.append(TEXT_32);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPolicy"));
stringBuffer.append(TEXT_33);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy"));
stringBuffer.append(TEXT_34);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
stringBuffer.append(TEXT_35);
- }
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Point"));
stringBuffer.append(TEXT_36);
- if (null != genDiagram.getPalette()) {
-final Palette palette = genDiagram.getPalette();
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
stringBuffer.append(TEXT_37);
- stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
+ }
stringBuffer.append(TEXT_38);
- stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
+ if (null != genDiagram.getPalette()) {
+final Palette palette = genDiagram.getPalette();
stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
stringBuffer.append(TEXT_40);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
stringBuffer.append(TEXT_41);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
stringBuffer.append(TEXT_42);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_43);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_44);
for(Iterator it = genCompartment.getChildNodes().iterator(); it.hasNext(); ) {
GenChildNode next = (GenChildNode)it.next();
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(importManager.getImportedName(next.getEditPartQualifiedClassName()));
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_46);
stringBuffer.append(next.getDomainMetaClass().getName());
stringBuffer.append(next.getVisualID());
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_47);
if (!genCompartment.isListLayout()) {
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_48);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_49);
}
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_50);
}
- stringBuffer.append(TEXT_49);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
- stringBuffer.append(TEXT_50);
- }/*when there's palette*/
stringBuffer.append(TEXT_51);
- stringBuffer.append(genCompartment.getTitle());
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
stringBuffer.append(TEXT_52);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
+ }/*when there's palette*/
stringBuffer.append(TEXT_53);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LabeledContainer"));
+ stringBuffer.append(genCompartment.getTitle());
stringBuffer.append(TEXT_54);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LabeledContainer"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure"));
stringBuffer.append(TEXT_55);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.StackLayout"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LabeledContainer"));
stringBuffer.append(TEXT_56);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ScrollPane"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LabeledContainer"));
stringBuffer.append(TEXT_57);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ScrollPane"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.StackLayout"));
stringBuffer.append(TEXT_58);
- if (genCompartment.isListLayout()) {
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ScrollPane"));
stringBuffer.append(TEXT_59);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ScrollPane"));
stringBuffer.append(TEXT_60);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
+ if (genCompartment.isListLayout()) {
stringBuffer.append(TEXT_61);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
stringBuffer.append(TEXT_62);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
stringBuffer.append(TEXT_63);
- } else {
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Figure"));
stringBuffer.append(TEXT_64);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ToolbarLayout"));
stringBuffer.append(TEXT_65);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformViewport"));
+ } else {
stringBuffer.append(TEXT_66);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Viewport"));
stringBuffer.append(TEXT_67);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformViewport"));
stringBuffer.append(TEXT_68);
- }
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer"));
stringBuffer.append(TEXT_69);
- stringBuffer.append(importManager.getImportedName(genHost.getDomainMetaClass().getQualifiedInterfaceName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout"));
stringBuffer.append(TEXT_70);
- stringBuffer.append(importManager.getImportedName(genHost.getDomainMetaClass().getQualifiedInterfaceName()));
+ }
stringBuffer.append(TEXT_71);
+ stringBuffer.append(importManager.getImportedName(genHost.getDomainMetaClass().getQualifiedInterfaceName()));
stringBuffer.append(TEXT_72);
+ stringBuffer.append(importManager.getImportedName(genHost.getDomainMetaClass().getQualifiedInterfaceName()));
stringBuffer.append(TEXT_73);
- stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
+
+{
+String _getViewCode = "getDiagramNode()";
+String _getDiagramCode = _getViewCode + ".getDiagram()";
+String _getSemanticElementCode = "resolveSemanticElement()";
+boolean isListLayout = genCompartment.isListLayout();
+
stringBuffer.append(TEXT_74);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
stringBuffer.append(TEXT_75);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
stringBuffer.append(TEXT_76);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
stringBuffer.append(TEXT_77);
+ stringBuffer.append(_getDiagramCode);
stringBuffer.append(TEXT_78);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetListenerImpl"));
stringBuffer.append(TEXT_79);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_80);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
stringBuffer.append(TEXT_81);
- stringBuffer.append(TEXT_82);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_83);
-for(Iterator it = genCompartment.getChildNodes().iterator(); genDiagram.getPalette() != null && it.hasNext(); ) {
- GenChildNode next = (GenChildNode)it.next();
- boolean isStatic = false;
- boolean isListLayout = genCompartment.isListLayout();
- String resolvedSemanticElement = "resolveSemanticElement()";
+boolean hasConstraintsInChildren = false;
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet != null && typeModelFacet.getMetaClass() != null && typeModelFacet.getModelElementSelector() != null) {
+ hasConstraintsInChildren = true;
+ break;
+ }
+}
+
+if (hasConstraintsInChildren) {
+
+ stringBuffer.append(TEXT_82);
+ stringBuffer.append(genDiagram.getVisualIDRegistryQualifiedClassName());
+ stringBuffer.append(TEXT_83);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_84);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_85);
- if (isStatic) {
+
+}
+
stringBuffer.append(TEXT_86);
- }
+
+boolean hasDeclaredFilter = false;
+Set genChildFeatures = new LinkedHashSet();
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (genChildFeatures.contains(childMetaFeature)) {
+ continue;
+ }
+ genChildFeatures.add(childMetaFeature);
+ if (!hasDeclaredFilter) {
+ hasDeclaredFilter = true;
+
stringBuffer.append(TEXT_87);
- stringBuffer.append(next.getDomainMetaClass().getName());
- stringBuffer.append(next.getVisualID());
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_88);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
stringBuffer.append(TEXT_89);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(childMetaFeature.getFeatureAccessorName());
stringBuffer.append(TEXT_90);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
+
+ } else {
+
stringBuffer.append(TEXT_91);
- stringBuffer.append(next.getDomainMetaClass().getName());
- stringBuffer.append(next.getVisualID());
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_92);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
stringBuffer.append(TEXT_93);
- stringBuffer.append(importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName()));
+ stringBuffer.append(childMetaFeature.getFeatureAccessorName());
stringBuffer.append(TEXT_94);
- if (!isListLayout) {
+
+ }
+} //for
+
+
+if (hasDeclaredFilter) {
+
stringBuffer.append(TEXT_95);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_96);
- }
+ stringBuffer.append(_getSemanticElementCode);
stringBuffer.append(TEXT_97);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_98);
-if (next.getDomainMetaClass().isMapEntry()) {
-/*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
+} else {
+ stringBuffer.append(TEXT_98);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_99);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(_getSemanticElementCode);
stringBuffer.append(TEXT_100);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+
+}
+
+
+if (hasConstraintsInChildren) {
+
stringBuffer.append(TEXT_101);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_102);
- stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
- stringBuffer.append(TEXT_103);
-} else {
+}
+ stringBuffer.append(TEXT_102);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(TEXT_103);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
stringBuffer.append(TEXT_104);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetChangeEvent"));
stringBuffer.append(TEXT_105);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
stringBuffer.append(TEXT_106);
- stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
stringBuffer.append(TEXT_107);
-
-}
-
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
stringBuffer.append(TEXT_108);
- /*XXX: Class name DomainElementInitializer should be user-customizable*/
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
stringBuffer.append(TEXT_109);
- stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
+ stringBuffer.append(_getDiagramCode);
stringBuffer.append(TEXT_110);
- stringBuffer.append(next.getUniqueIdentifier());
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
stringBuffer.append(TEXT_111);
- stringBuffer.append(importManager.getImportedName(next.getNotationViewFactoryQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
stringBuffer.append(TEXT_112);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_113);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_114);
+ stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_115);
+ stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
+ stringBuffer.append(TEXT_116);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_117);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_118);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_119);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_120);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_121);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_122);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_123);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_124);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_125);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_126);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_127);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_128);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_129);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_130);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_131);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
+ stringBuffer.append(TEXT_132);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".ReplaceNotationalElementCommand"));
+ stringBuffer.append(TEXT_133);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_134);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_135);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_136);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".RemoveNotationalElementCommand"));
+ stringBuffer.append(TEXT_137);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
+ stringBuffer.append(TEXT_138);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_139);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_140);
+
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName());
+
+ stringBuffer.append(TEXT_141);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_142);
+ stringBuffer.append(childNodeInterfaceName);
+ stringBuffer.append(TEXT_143);
+ stringBuffer.append(nextNode.getDomainMetaClass().getName());
+ stringBuffer.append(nextNode.getVisualID());
+ stringBuffer.append(TEXT_144);
+ if (!isListLayout) {
+ stringBuffer.append(TEXT_145);
+ }
+ stringBuffer.append(TEXT_146);
+
+}
+
+ stringBuffer.append(TEXT_147);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_148);
+ stringBuffer.append(TEXT_149);
+
+if (childNodes.size() == 0) {
+
+ stringBuffer.append(TEXT_150);
+ stringBuffer.append(importManager.getImportedName("java.util.Collections"));
+ stringBuffer.append(TEXT_151);
+
+} else {
+
+ stringBuffer.append(TEXT_152);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_153);
+ stringBuffer.append(importManager.getImportedName("java.util.LinkedList"));
+ stringBuffer.append(TEXT_154);
+
+ Map genFeature2genNodeMap = new LinkedHashMap();
+ for (int nodeIndex = 0; nodeIndex < childNodes.size(); nodeIndex++) {
+ GenNode nextNode = (GenNode) childNodes.get(nodeIndex);
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (!genFeature2genNodeMap.containsKey(childMetaFeature)) {
+ genFeature2genNodeMap.put(childMetaFeature, new ArrayList());
+ }
+ ((Collection) genFeature2genNodeMap.get(childMetaFeature)).add(nextNode);
+ }
+ Set entrySet = genFeature2genNodeMap.entrySet();
+ if (entrySet.size() > 0) {
+
+ stringBuffer.append(TEXT_155);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_156);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_157);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_158);
+ stringBuffer.append(_getSemanticElementCode);
+ stringBuffer.append(TEXT_159);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_160);
+
+ }
+ for (Iterator entries = entrySet.iterator(); entries.hasNext();) {
+ Map.Entry nextEntry = (Map.Entry) entries.next();
+ GenFeature childMetaFeature = (GenFeature) nextEntry.getKey();
+ Collection genNodesCollection = (Collection) nextEntry.getValue();
+ if (childMetaFeature.isListType()) {
+
+ stringBuffer.append(TEXT_161);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_162);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_163);
+ stringBuffer.append(childMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_164);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_165);
+
+ } else {
+
+ stringBuffer.append(TEXT_166);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_167);
+ stringBuffer.append(childMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_168);
+
+ }
+
+ stringBuffer.append(TEXT_169);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_170);
+
+ boolean generateSwitch = genNodesCollection.size() != 1;
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_171);
+
+ }
+ for (Iterator genNodesIterator = genNodesCollection.iterator(); genNodesIterator.hasNext();) {
+ GenNode nextNode = (GenNode) genNodesIterator.next();
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_172);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_173);
+
+ } else {
+
+ stringBuffer.append(TEXT_174);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_175);
+
+ }
+
+ stringBuffer.append(TEXT_176);
+
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_177);
+
+ } else {
+
+ stringBuffer.append(TEXT_178);
+
+ }
+ }
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_179);
+
+ }
+ if (childMetaFeature.isListType()) {
+
+ stringBuffer.append(TEXT_180);
+
+ }
+}
+
+ stringBuffer.append(TEXT_181);
+
+}
+
+ stringBuffer.append(TEXT_182);
+ stringBuffer.append(genDiagram.isSynchronized());
+ stringBuffer.append(TEXT_183);
+ stringBuffer.append(genDiagram.isSynchronized());
+ stringBuffer.append(TEXT_184);
+
+}
+
+ stringBuffer.append(TEXT_185);
+ stringBuffer.append(TEXT_186);
+ stringBuffer.append(TEXT_187);
+ stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
+ stringBuffer.append(TEXT_188);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
+ stringBuffer.append(TEXT_189);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
+ stringBuffer.append(TEXT_190);
+ stringBuffer.append(TEXT_191);
+ stringBuffer.append(TEXT_192);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_193);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_194);
+ stringBuffer.append(TEXT_195);
+ stringBuffer.append(TEXT_196);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_197);
+
+for(Iterator it = genCompartment.getChildNodes().iterator(); it.hasNext(); ) {
+ GenChildNode next = (GenChildNode)it.next();
+ boolean isStatic = false;
+ boolean isListLayout = genCompartment.isListLayout();
+ String resolvedSemanticElement = "resolveSemanticElement()";
+
+ stringBuffer.append(TEXT_198);
+ stringBuffer.append(TEXT_199);
+ if (isStatic) {
+ stringBuffer.append(TEXT_200);
+ }
+ stringBuffer.append(TEXT_201);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_202);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
+ stringBuffer.append(TEXT_203);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_204);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_205);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_206);
+ if (!isListLayout) {
+ stringBuffer.append(TEXT_207);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(TEXT_208);
+ }
+ stringBuffer.append(TEXT_209);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
+ stringBuffer.append(TEXT_210);
+ stringBuffer.append(importManager.getImportedName(next.getNotationViewFactoryQualifiedClassName()));
+ stringBuffer.append(TEXT_211);
if (!isListLayout) {
- stringBuffer.append(TEXT_113);
+ stringBuffer.append(TEXT_212);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
- stringBuffer.append(TEXT_114);
+ stringBuffer.append(TEXT_213);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_115);
+ stringBuffer.append(TEXT_214);
int defaultWidth = 40;
int defaultHeight = 40;
@@ -434,68 +878,140 @@
defaultHeight = defSizeAttrs.getHeight();
}
- stringBuffer.append(TEXT_116);
+ stringBuffer.append(TEXT_215);
stringBuffer.append(defaultWidth);
- stringBuffer.append(TEXT_117);
+ stringBuffer.append(TEXT_216);
stringBuffer.append(defaultHeight);
- stringBuffer.append(TEXT_118);
+ stringBuffer.append(TEXT_217);
}
- stringBuffer.append(TEXT_119);
+ stringBuffer.append(TEXT_218);
+
+if (genDiagram.getPalette() != null) {
+
+ stringBuffer.append(TEXT_219);
+ if (isStatic) {
+ stringBuffer.append(TEXT_220);
+ }
+ stringBuffer.append(TEXT_221);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_222);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(TEXT_223);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_224);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_225);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_226);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName()));
+ stringBuffer.append(TEXT_227);
+ if (!isListLayout) {
+ stringBuffer.append(TEXT_228);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(TEXT_229);
+ }
+ stringBuffer.append(TEXT_230);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
- stringBuffer.append(TEXT_120);
+ stringBuffer.append(TEXT_231);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
- stringBuffer.append(TEXT_121);
+ stringBuffer.append(TEXT_232);
+
+ if (next.getDomainMetaClass().isMapEntry()) {
+ /*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
+
+ stringBuffer.append(TEXT_233);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_234);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+ stringBuffer.append(TEXT_235);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_236);
+ stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(TEXT_237);
+
+ } else {
+
+ stringBuffer.append(TEXT_238);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_239);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+ stringBuffer.append(TEXT_240);
+ stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(TEXT_241);
+
+ }
+
+ stringBuffer.append(TEXT_242);
+ /*XXX: Class name DomainElementInitializer should be user-customizable*/
+ stringBuffer.append(TEXT_243);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
+ stringBuffer.append(TEXT_244);
+ stringBuffer.append(next.getUniqueIdentifier());
+ stringBuffer.append(TEXT_245);
TypeModelFacet facet = next.getModelFacet();
GenFeature childFeature = facet.getChildMetaFeature();
GenFeature containmentFeature = facet.getContainmentMetaFeature();
if (childFeature != null && childFeature != containmentFeature && !childFeature.isDerived()) {
- stringBuffer.append(TEXT_122);
+ stringBuffer.append(TEXT_246);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
- stringBuffer.append(TEXT_123);
+ stringBuffer.append(TEXT_247);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
- stringBuffer.append(TEXT_124);
+ stringBuffer.append(TEXT_248);
stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_125);
+ stringBuffer.append(TEXT_249);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_126);
+ stringBuffer.append(TEXT_250);
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_127);
+ stringBuffer.append(TEXT_251);
stringBuffer.append(containmentFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_128);
+ stringBuffer.append(TEXT_252);
stringBuffer.append(importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_129);
+ stringBuffer.append(TEXT_253);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_130);
+ stringBuffer.append(TEXT_254);
stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_131);
+ stringBuffer.append(TEXT_255);
stringBuffer.append(childFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_132);
+ stringBuffer.append(TEXT_256);
} else {
- stringBuffer.append(TEXT_133);
+ stringBuffer.append(TEXT_257);
stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_134);
+ stringBuffer.append(TEXT_258);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_135);
+ stringBuffer.append(TEXT_259);
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_136);
+ stringBuffer.append(TEXT_260);
stringBuffer.append(containmentFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_137);
+ stringBuffer.append(TEXT_261);
}
- stringBuffer.append(TEXT_138);
+ stringBuffer.append(TEXT_262);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_263);
+ if(!isListLayout) {
+ stringBuffer.append(TEXT_264);
+ }
+ stringBuffer.append(TEXT_265);
}
- stringBuffer.append(TEXT_139);
+
+}
+
+ stringBuffer.append(TEXT_266);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_140);
+ stringBuffer.append(TEXT_267);
return stringBuffer.toString();
}
}
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/parts/DiagramEditPartGenerator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/DiagramEditPartGenerator.java,v
retrieving revision 1.4
diff -u -r1.4 DiagramEditPartGenerator.java
--- src-templates/org/eclipse/gmf/codegen/templates/lite/parts/DiagramEditPartGenerator.java 24 May 2006 18:18:05 -0000 1.4
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/parts/DiagramEditPartGenerator.java 19 Jun 2006 16:46:15 -0000
@@ -47,7 +47,7 @@
protected final String TEXT_28 = " original = new ";
protected final String TEXT_29 = "(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());" + NL + "\t\t\t\t\t\t";
protected final String TEXT_30 = " transformed = request.getTransformedRectangle(original);" + NL + "\t\t\t\t\t\tresizeDelta = transformed.getSize().expand(original.getSize().negate());" + NL + "\t\t\t\t\t\tmoveDelta = transformed.getTopLeft().translate(original.getTopLeft().negate());" + NL + "\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void undo() {" + NL + "\t\t\t\t\t\texecute(moveDelta.getNegated(), resizeDelta.getNegated());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void execute() {" + NL + "\t\t\t\t\t\texecute(moveDelta, resizeDelta);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void redo() {" + NL + "\t\t\t\t\t\texecute();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tprivate void execute(Point move, Dimension resize) {" + NL + "\t\t\t\t\t\tBounds bounds = (Bounds) node.getLayoutConstraint();" + NL + "\t\t\t\t\t\tbounds.setX(bounds.getX() + move.x);" + NL + "\t\t\t\t\t\tbounds.setY(bounds.getY() + move.y);" + NL + "\t\t\t\t\t\tbounds.setWidth(bounds.getWidth() + resize.width);" + NL + "\t\t\t\t\t\tbounds.setHeight(bounds.getHeight() + resize.height);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\t\treturn new WrappingCommand(";
- protected final String TEXT_31 = ".getEditingDomain(getDiagram().getElement()), emfCommand);" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\tassert false;" + NL + "\t\t\t\treturn UnexecutableCommand.INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure createFigure() {" + NL + "\t\tIFigure f = new FreeformLayer();" + NL + "\t\tf.setBorder(new MarginBorder(5));" + NL + "\t\tf.setLayoutManager(new FreeformLayout());" + NL + "\t\treturn f;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key) {" + NL + "\t\tif (";
+ protected final String TEXT_31 = ".getEditingDomain(getDiagram().getElement()), emfCommand);" + NL + "\t\t\t}" + NL + "\t\t\tprotected Command createChangeConstraintCommand(EditPart child, Object constraint) {" + NL + "\t\t\t\tassert false;" + NL + "\t\t\t\treturn UnexecutableCommand.INSTANCE;" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t\tinstallNotationModelRefresher();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure createFigure() {" + NL + "\t\tIFigure f = new FreeformLayer();" + NL + "\t\tf.setBorder(new MarginBorder(5));" + NL + "\t\tf.setLayoutManager(new FreeformLayout());" + NL + "\t\treturn f;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key) {" + NL + "\t\tif (";
protected final String TEXT_32 = ".class == key) {" + NL + "\t\t\treturn new ";
protected final String TEXT_33 = "(this);" + NL + "\t\t}";
protected final String TEXT_34 = NL + "\t\treturn super.getAdapter(key);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List getModelChildren() {" + NL + "\t\treturn getDiagram().getVisibleChildren();" + NL + "\t}" + NL;
@@ -55,86 +55,211 @@
protected final String TEXT_36 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
protected final String TEXT_37 = "static ";
protected final String TEXT_38 = "class Create";
- protected final String TEXT_39 = "Command extends ";
- protected final String TEXT_40 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final ";
- protected final String TEXT_41 = " parent;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_42 = " createdNode;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_43 = "Command(";
- protected final String TEXT_44 = " parent, ";
- protected final String TEXT_45 = ".CreateRequestEx request";
- protected final String TEXT_46 = ", ";
- protected final String TEXT_47 = " constraint";
- protected final String TEXT_48 = ") {" + NL + "\t\t\tthis.parent = parent;" + NL + "\t\t\tcreatedNode = ";
- protected final String TEXT_49 = ".eINSTANCE.createNode();";
- protected final String TEXT_50 = NL + "\t\t\t";
- protected final String TEXT_51 = " createdDomainElement = ";
- protected final String TEXT_52 = ".eINSTANCE.create(" + NL + "\t\t\t\t";
- protected final String TEXT_53 = ".eINSTANCE.get";
- protected final String TEXT_54 = "());";
- protected final String TEXT_55 = NL + "\t\t\t";
- protected final String TEXT_56 = " createdDomainElement = ";
- protected final String TEXT_57 = ".eINSTANCE.create";
- protected final String TEXT_58 = "();";
- protected final String TEXT_59 = "\t\t\tcreatedNode.setElement(createdDomainElement);" + NL + "\t\t\t";
- protected final String TEXT_60 = NL + "\t\t\t";
- protected final String TEXT_61 = ".";
- protected final String TEXT_62 = ".initializeElement(createdDomainElement);" + NL + "\t\t\t";
- protected final String TEXT_63 = ".decorateView(createdNode);";
- protected final String TEXT_64 = NL + "\t\t\t";
- protected final String TEXT_65 = " bounds = ";
- protected final String TEXT_66 = ".eINSTANCE.createBounds();" + NL + "\t\t\tcreatedNode.setLayoutConstraint(bounds);" + NL + "\t\t\tbounds.setX(constraint.x);" + NL + "\t\t\tbounds.setY(constraint.y);";
- protected final String TEXT_67 = NL + "\t\t\tbounds.setWidth(Math.max(constraint.width, ";
- protected final String TEXT_68 = "));" + NL + "\t\t\tbounds.setHeight(Math.max(constraint.height, ";
- protected final String TEXT_69 = "));";
+ protected final String TEXT_39 = "NotationCommand extends ";
+ protected final String TEXT_40 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate Create";
+ protected final String TEXT_41 = "NotationCommand(";
+ protected final String TEXT_42 = " parent, " + NL + "\t\t\t\t";
+ protected final String TEXT_43 = " domainElement";
+ protected final String TEXT_44 = ", ";
+ protected final String TEXT_45 = " constraint";
+ protected final String TEXT_46 = ") {" + NL + "\t\t\tsuper(parent);" + NL + "\t\t\tNode createdNode = ";
+ protected final String TEXT_47 = ".eINSTANCE.createNode();" + NL + "\t\t\tsetCreatedView(createdNode);" + NL + "\t\t\tcreatedNode.setElement(domainElement);" + NL + "\t\t\t";
+ protected final String TEXT_48 = ".decorateView(createdNode);";
+ protected final String TEXT_49 = NL + "\t\t\t";
+ protected final String TEXT_50 = " bounds = ";
+ protected final String TEXT_51 = ".eINSTANCE.createBounds();" + NL + "\t\t\tcreatedNode.setLayoutConstraint(bounds);" + NL + "\t\t\tbounds.setX(constraint.x);" + NL + "\t\t\tbounds.setY(constraint.y);";
+ protected final String TEXT_52 = NL + "\t\t\tbounds.setWidth(Math.max(constraint.width, ";
+ protected final String TEXT_53 = "));" + NL + "\t\t\tbounds.setHeight(Math.max(constraint.height, ";
+ protected final String TEXT_54 = "));";
+ protected final String TEXT_55 = NL + "\t\t}" + NL + "\t}" + NL;
+ protected final String TEXT_56 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_57 = "static ";
+ protected final String TEXT_58 = "class Create";
+ protected final String TEXT_59 = "Command extends ";
+ protected final String TEXT_60 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final Create";
+ protected final String TEXT_61 = "NotationCommand notationAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_62 = "Command(";
+ protected final String TEXT_63 = " parent, ";
+ protected final String TEXT_64 = ".CreateRequestEx request";
+ protected final String TEXT_65 = ", ";
+ protected final String TEXT_66 = " constraint";
+ protected final String TEXT_67 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_68 = " domainModelEditDomain = ";
+ protected final String TEXT_69 = ".getEditingDomain(parent.getDiagram().getElement());";
protected final String TEXT_70 = NL + "\t\t\t";
- protected final String TEXT_71 = " domainModelEditDomain = ";
- protected final String TEXT_72 = ".getEditingDomain(parent.getDiagram().getElement());";
- protected final String TEXT_73 = NL + "\t\t\t";
- protected final String TEXT_74 = " compoundCommand = new ";
- protected final String TEXT_75 = "();" + NL + "\t\t\tcompoundCommand.append(";
- protected final String TEXT_76 = ".create(domainModelEditDomain, ";
- protected final String TEXT_77 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_78 = ".eINSTANCE.get";
- protected final String TEXT_79 = "(), createdNode.getElement()));" + NL + "\t\t\tcompoundCommand.append(";
- protected final String TEXT_80 = ".create(domainModelEditDomain, ";
- protected final String TEXT_81 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_82 = ".eINSTANCE.get";
- protected final String TEXT_83 = "(), createdNode.getElement()));" + NL + "\t\t\tthis.domainModelAddCommand = compoundCommand;";
- protected final String TEXT_84 = NL + "\t\t\tthis.domainModelAddCommand = ";
- protected final String TEXT_85 = ".create(domainModelEditDomain, ";
- protected final String TEXT_86 = ", " + NL + "\t\t\t\t";
- protected final String TEXT_87 = ".eINSTANCE.get";
- protected final String TEXT_88 = "(), createdNode.getElement());";
- protected final String TEXT_89 = NL + "\t\t\trequest.setCreatedObject(createdNode);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\treturn domainModelAddCommand != null && domainModelAddCommand.canExecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn domainModelAddCommand != null && domainModelAddCommand.canUndo();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tparent.insertChild(createdNode);" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tparent.getPersistedChildren().remove(createdNode);" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_90 = NL;
- protected final String TEXT_91 = NL;
- protected final String TEXT_92 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_93 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
- protected final String TEXT_94 = " feature, ";
- protected final String TEXT_95 = " 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 HashMap();";
- protected final String TEXT_96 = NL;
- protected final String TEXT_97 = "\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(";
- protected final String TEXT_98 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
- protected final String TEXT_99 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class UpdateManager extends ";
- protected final String TEXT_100 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
- protected final String TEXT_101 = " 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\t";
- protected final String TEXT_102 = " affectedEditParts = findAffectedParts(msg);" + NL + "\t\t\tfor(";
- protected final String TEXT_103 = " it = affectedEditParts.iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tIUpdatableEditPart next = (IUpdatableEditPart) it.next();" + NL + "\t\t\t\tIUpdatableEditPart.Refresher refresher = next.getRefresher((";
- protected final String TEXT_104 = ")msg.getFeature(), msg);" + NL + "\t\t\t\tif (refresher != null) {" + NL + "\t\t\t\t\trefresher.refresh();" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_105 = "/**/ findAffectedParts(";
- protected final String TEXT_106 = " msg) {" + NL + "\t\t\tObject notifier = msg.getNotifier();" + NL + "\t\t\tif (notifier instanceof ";
- protected final String TEXT_107 = ") {" + NL + "\t\t\t\t";
- protected final String TEXT_108 = " view = getView((EObject) notifier);" + NL + "\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\tEditPart affectedEditPart = (EditPart) getViewer().getEditPartRegistry().get(view);" + NL + "\t\t\t\t\tif (affectedEditPart != null) {" + NL + "\t\t\t\t\t\treturn ";
- protected final String TEXT_109 = ".singleton(affectedEditPart);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn ";
- protected final String TEXT_110 = ".EMPTY_LIST;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
- protected final String TEXT_111 = " getView(EObject offspring) {" + NL + "\t\t\twhile (offspring != null && offspring instanceof View == false) {" + NL + "\t\t\t\toffspring = offspring.eContainer();" + NL + "\t\t\t}" + NL + "\t\t\treturn (";
- protected final String TEXT_112 = ") offspring;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void activate() {" + NL + "\t\tsuper.activate();" + NL + "\t\tgetDiagram().eAdapters().add(updateManager);" + NL + "\t\tgetDiagram().getElement().eAdapters().add(domainModelRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void deactivate() {" + NL + "\t\tgetDiagram().getElement().eAdapters().remove(domainModelRefresher);" + NL + "\t\tgetDiagram().eAdapters().remove(updateManager);" + NL + "\t\tsuper.deactivate();" + NL + "\t}" + NL;
- protected final String TEXT_113 = NL;
- protected final String TEXT_114 = "\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 ";
- protected final String TEXT_115 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
- protected final String TEXT_116 = " 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((";
- protected final String TEXT_117 = ") 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 + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdateManager updateManager = new UpdateManager();" + NL + "}";
- protected final String TEXT_118 = NL;
+ protected final String TEXT_71 = " createdDomainElement = ";
+ protected final String TEXT_72 = ".eINSTANCE.create(" + NL + "\t\t\t\t";
+ protected final String TEXT_73 = ".eINSTANCE.get";
+ protected final String TEXT_74 = "());";
+ protected final String TEXT_75 = NL + "\t\t\t";
+ protected final String TEXT_76 = " createdDomainElement = ";
+ protected final String TEXT_77 = ".eINSTANCE.create";
+ protected final String TEXT_78 = "();";
+ protected final String TEXT_79 = NL + "\t\t\t";
+ protected final String TEXT_80 = NL + "\t\t\t";
+ protected final String TEXT_81 = ".";
+ protected final String TEXT_82 = ".initializeElement(createdDomainElement);";
+ protected final String TEXT_83 = NL + "\t\t\t";
+ protected final String TEXT_84 = " compoundCommand = new ";
+ protected final String TEXT_85 = "();" + NL + "\t\t\tcompoundCommand.append(";
+ protected final String TEXT_86 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_87 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_88 = ".eINSTANCE.get";
+ protected final String TEXT_89 = "(), createdDomainElement));" + NL + "\t\t\tcompoundCommand.append(";
+ protected final String TEXT_90 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_91 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_92 = ".eINSTANCE.get";
+ protected final String TEXT_93 = "(), createdDomainElement));" + NL + "\t\t\tthis.domainModelAddCommand = compoundCommand;";
+ protected final String TEXT_94 = NL + "\t\t\tthis.domainModelAddCommand = ";
+ protected final String TEXT_95 = ".create(domainModelEditDomain, ";
+ protected final String TEXT_96 = ", " + NL + "\t\t\t\t";
+ protected final String TEXT_97 = ".eINSTANCE.get";
+ protected final String TEXT_98 = "(), createdDomainElement);";
+ protected final String TEXT_99 = NL + "\t\t\tthis.notationAddCommand = new Create";
+ protected final String TEXT_100 = "NotationCommand(parent, createdDomainElement";
+ protected final String TEXT_101 = ", constraint";
+ protected final String TEXT_102 = ");" + NL + "\t\t\trequest.setCreatedObject(notationAddCommand.getCreatedView());" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate final org.eclipse.emf.common.command.Command domainModelAddCommand;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canExecute() {" + NL + "\t\t\treturn domainModelAddCommand != null" + NL + "\t\t\t\t\t&& domainModelAddCommand.canExecute() && notationAddCommand != null && notationAddCommand.canExecute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean canUndo() {" + NL + "\t\t\treturn domainModelAddCommand != null" + NL + "\t\t\t\t\t&& domainModelAddCommand.canUndo() && notationAddCommand != null && notationAddCommand.canUndo();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void execute() {" + NL + "\t\t\tdomainModelAddCommand.execute();" + NL + "\t\t\tnotationAddCommand.execute();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void undo() {" + NL + "\t\t\tnotationAddCommand.undo();" + NL + "\t\t\tdomainModelAddCommand.undo();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void redo() {" + NL + "\t\t\texecute();" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_103 = NL;
+ protected final String TEXT_104 = NL;
+ protected final String TEXT_105 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_106 = " structuralFeatures2Refresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Refresher getRefresher(";
+ protected final String TEXT_107 = " feature, ";
+ protected final String TEXT_108 = " 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 HashMap();";
+ protected final String TEXT_109 = NL;
+ protected final String TEXT_110 = "\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(";
+ protected final String TEXT_111 = ".eINSTANCE.getView_PersistedChildren(), childrenRefresher);" + NL + "\t\tstructuralFeatures2Refresher.put(";
+ protected final String TEXT_112 = ".eINSTANCE.getView_TransientChildren(), childrenRefresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class UpdateManager extends ";
+ protected final String TEXT_113 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
+ protected final String TEXT_114 = " 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\t";
+ protected final String TEXT_115 = " affectedEditParts = findAffectedParts(msg);" + NL + "\t\t\tfor(";
+ protected final String TEXT_116 = " it = affectedEditParts.iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tIUpdatableEditPart next = (IUpdatableEditPart) it.next();" + NL + "\t\t\t\tIUpdatableEditPart.Refresher refresher = next.getRefresher((";
+ protected final String TEXT_117 = ")msg.getFeature(), msg);" + NL + "\t\t\t\tif (refresher != null) {" + NL + "\t\t\t\t\trefresher.refresh();" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_118 = "/**/ findAffectedParts(";
+ protected final String TEXT_119 = " msg) {" + NL + "\t\t\tObject notifier = msg.getNotifier();" + NL + "\t\t\tif (notifier instanceof ";
+ protected final String TEXT_120 = ") {" + NL + "\t\t\t\t";
+ protected final String TEXT_121 = " view = getView((EObject) notifier);" + NL + "\t\t\t\tif (view != null) {" + NL + "\t\t\t\t\tEditPart affectedEditPart = (EditPart) getViewer().getEditPartRegistry().get(view);" + NL + "\t\t\t\t\tif (affectedEditPart != null) {" + NL + "\t\t\t\t\t\treturn ";
+ protected final String TEXT_122 = ".singleton(affectedEditPart);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn ";
+ protected final String TEXT_123 = ".EMPTY_LIST;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_124 = " getView(EObject offspring) {" + NL + "\t\t\twhile (offspring != null && offspring instanceof View == false) {" + NL + "\t\t\t\toffspring = offspring.eContainer();" + NL + "\t\t\t}" + NL + "\t\t\treturn (";
+ protected final String TEXT_125 = ") offspring;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void activate() {" + NL + "\t\tsuper.activate();" + NL + "\t\tgetDiagram().eAdapters().add(updateManager);" + NL + "\t\tgetDiagram().getElement().eAdapters().add(domainModelRefresher);" + NL + "\t\tinstallNotationModelRefresher();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void deactivate() {" + NL + "\t\tuninstallNotationModelRefresher();" + NL + "\t\tgetDiagram().getElement().eAdapters().remove(domainModelRefresher);" + NL + "\t\tgetDiagram().eAdapters().remove(updateManager);" + NL + "\t\tsuper.deactivate();" + NL + "\t}" + NL;
+ protected final String TEXT_126 = NL;
+ protected final String TEXT_127 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void installNotationModelRefresher() {" + NL + "\t\tNotationModelRefresher refresher = getNotationModelRefresher();" + NL + "\t\tif (refresher.isInstalled()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_128 = " domainModelEditDomain = ";
+ protected final String TEXT_129 = ".getEditingDomain(";
+ protected final String TEXT_130 = ".getElement());" + NL + "\t\trefresher.install(domainModelEditDomain);" + NL + "\t\trefreshNotationModel();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void uninstallNotationModelRefresher() {" + NL + "\t\tgetNotationModelRefresher().uninstall();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate NotationModelRefresher notationModelRefresher;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate NotationModelRefresher getNotationModelRefresher() {" + NL + "\t\tif (notationModelRefresher == null) {" + NL + "\t\t\tnotationModelRefresher = new NotationModelRefresher();" + NL + "\t\t}" + NL + "\t\treturn notationModelRefresher;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class NotationModelRefresher extends ";
+ protected final String TEXT_131 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_132 = " filter;" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_133 = " editingDomain;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic NotationModelRefresher() {" + NL + "\t\t\tcreateFilter();" + NL + "\t\t}";
+ protected final String TEXT_134 = NL + NL + "\t\t/**" + NL + "\t\t * NB: Children of this element are selected based on constraint declared in ";
+ protected final String TEXT_135 = ". " + NL + "\t\t * Since no assumptions may be made concerning the runtime behavior of the constraint, any non-touch notification may result in " + NL + "\t\t * notational model having to be updated." + NL + "\t\t * User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications" + NL + "\t\t * result in such an update." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ";
+ protected final String TEXT_136 = " getConstrainedChildrenFilter() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_137 = ".NOT_TOUCH;" + NL + "\t\t}";
+ protected final String TEXT_138 = NL + NL + "\t\t/**" + NL + "\t\t * Creates a notification filter which filters notifications that may possibly affect the notational model" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void createFilter() {";
+ protected final String TEXT_139 = NL + "\t\t\tfilter = ";
+ protected final String TEXT_140 = ".createFeatureFilter(";
+ protected final String TEXT_141 = ".eINSTANCE.get";
+ protected final String TEXT_142 = "());";
+ protected final String TEXT_143 = NL + "\t\t\tfilter = filter.or(";
+ protected final String TEXT_144 = ".createFeatureFilter(";
+ protected final String TEXT_145 = ".eINSTANCE.get";
+ protected final String TEXT_146 = "()));";
+ protected final String TEXT_147 = NL + "\t\t\tfilter = filter.and(";
+ protected final String TEXT_148 = ".createNotifierFilter(";
+ protected final String TEXT_149 = "));";
+ protected final String TEXT_150 = NL + "\t\t\tfilter = ";
+ protected final String TEXT_151 = ".createNotifierFilter(";
+ protected final String TEXT_152 = ");";
+ protected final String TEXT_153 = NL + "\t\t\tfilter = getConstrainedChildrenFilter().or(filter);";
+ protected final String TEXT_154 = NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void install(";
+ protected final String TEXT_155 = " editingDomain) {" + NL + "\t\t\tif (this.editingDomain != null && !this.editingDomain.equals(editingDomain)) {" + NL + "\t\t\t\tthrow new IllegalStateException(\"Already listening to another editing domain\");" + NL + "\t\t\t}" + NL + "\t\t\tthis.editingDomain = editingDomain;" + NL + "\t\t\tthis.editingDomain.addResourceSetListener(this);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isInstalled() {" + NL + "\t\t\treturn editingDomain != null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void uninstall() {" + NL + "\t\t\tif (isInstalled()) {" + NL + "\t\t\t\teditingDomain.removeResourceSetListener(this);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic boolean isPrecommitOnly() {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_156 = " transactionAboutToCommit(";
+ protected final String TEXT_157 = " event) {" + NL + "\t\t\treturn getRefreshNotationModelCommand();" + NL + "\t\t}" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_158 = " getFilter() {" + NL + "\t\t\treturn filter;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshNotationModel() {" + NL + "\t\t";
+ protected final String TEXT_159 = " command = getRefreshNotationModelCommand();" + NL + "\t\tif (command == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_160 = " domainModelEditDomain = ";
+ protected final String TEXT_161 = ".getEditingDomain(";
+ protected final String TEXT_162 = ".getElement());" + NL + "\t\tgetViewer().getEditDomain().getCommandStack().execute(new WrappingCommand(domainModelEditDomain, command));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_163 = " getRefreshNotationModelCommand() {" + NL + "\t\t";
+ protected final String TEXT_164 = " semanticChildren = getSemanticChildren();" + NL + "\t\t";
+ protected final String TEXT_165 = " notationalChildren = ";
+ protected final String TEXT_166 = ".getChildren();" + NL + "\t\tfinal ";
+ protected final String TEXT_167 = " semanticToNotational = new ";
+ protected final String TEXT_168 = "();" + NL + "\t\tfor(";
+ protected final String TEXT_169 = " it = notationalChildren.iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_170 = " next = (";
+ protected final String TEXT_171 = ") it.next();" + NL + "\t\t\t";
+ protected final String TEXT_172 = " nextSemantic = next.getElement();" + NL + "\t\t\tif (nextSemantic != null) {" + NL + "\t\t\t\tsemanticToNotational.put(nextSemantic, next);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_173 = " parentView = ";
+ protected final String TEXT_174 = ";" + NL + "\t\t";
+ protected final String TEXT_175 = " command = new ";
+ protected final String TEXT_176 = "();" + NL + "\t\tfor(";
+ protected final String TEXT_177 = " it = semanticChildren.iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_178 = " next = (";
+ protected final String TEXT_179 = ") it.next();" + NL + "\t\t\t";
+ protected final String TEXT_180 = " currentView = (";
+ protected final String TEXT_181 = ") semanticToNotational.remove(next);" + NL + "\t\t\tint nodeVisualID = ";
+ protected final String TEXT_182 = ".INSTANCE.getNodeVisualID(parentView, next);" + NL + "\t\t\tif (currentView == null) {" + NL + "\t\t\t\tif (shouldCreateView(next)) {" + NL + "\t\t\t\t\tcommand.appendIfCanExecute(getCreateNotationalElementCommand(parentView, next, nodeVisualID));" + NL + "\t\t\t\t}" + NL + "\t\t\t} else if (nodeVisualID != ";
+ protected final String TEXT_183 = ".getVisualID(currentView)) {" + NL + "\t\t\t\t";
+ protected final String TEXT_184 = " notationalCommand = getCreateNotationalElementCommand(parentView, next, nodeVisualID);" + NL + "\t\t\t\tif (notationalCommand != null) {" + NL + "\t\t\t\t\tcommand.appendIfCanExecute(new ";
+ protected final String TEXT_185 = "(parentView, notationalCommand, currentView));" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tfor(";
+ protected final String TEXT_186 = " it = semanticToNotational.values().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
+ protected final String TEXT_187 = " obsoleteView = (";
+ protected final String TEXT_188 = ") it.next();" + NL + "\t\t\tcommand.appendIfCanExecute(new ";
+ protected final String TEXT_189 = "(parentView, obsoleteView));" + NL + "\t\t}" + NL + "\t\treturn command.getCommandList().isEmpty() ? null : command;" + NL + "\t}" + NL + "" + NL + "\tprivate ";
+ protected final String TEXT_190 = " getCreateNotationalElementCommand(";
+ protected final String TEXT_191 = " parentView, ";
+ protected final String TEXT_192 = " domainElement, int nodeVisualID) {" + NL + "\t\tswitch (nodeVisualID) {";
+ protected final String TEXT_193 = NL + "\t\tcase ";
+ protected final String TEXT_194 = ".VISUAL_ID:" + NL + "\t\t\tif (domainElement instanceof ";
+ protected final String TEXT_195 = ") {" + NL + "\t\t\t\treturn new Create";
+ protected final String TEXT_196 = "NotationCommand(parentView, domainElement";
+ protected final String TEXT_197 = ", new Rectangle(0, 0, 0, 0)";
+ protected final String TEXT_198 = ");" + NL + "\t\t\t}" + NL + "\t\t\treturn null;";
+ protected final String TEXT_199 = NL + "\t\tdefault:" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_200 = " getSemanticChildren() {";
+ protected final String TEXT_201 = NL;
+ protected final String TEXT_202 = NL + "\treturn ";
+ protected final String TEXT_203 = ".EMPTY_LIST;";
+ protected final String TEXT_204 = NL + "\t";
+ protected final String TEXT_205 = " result = new ";
+ protected final String TEXT_206 = "();";
+ protected final String TEXT_207 = NL + "\t";
+ protected final String TEXT_208 = " viewObject = ";
+ protected final String TEXT_209 = ";" + NL + "\t";
+ protected final String TEXT_210 = " modelObject = ";
+ protected final String TEXT_211 = ";" + NL + "\t";
+ protected final String TEXT_212 = " nextValue;" + NL + "\tint nodeVID;";
+ protected final String TEXT_213 = NL + "\tfor(";
+ protected final String TEXT_214 = " it = ((";
+ protected final String TEXT_215 = ")modelObject).";
+ protected final String TEXT_216 = "().iterator(); it.hasNext(); ) {" + NL + "\t\tnextValue = (";
+ protected final String TEXT_217 = ") it.next();";
+ protected final String TEXT_218 = NL + "\tnextValue = ((";
+ protected final String TEXT_219 = ")modelObject).";
+ protected final String TEXT_220 = "();";
+ protected final String TEXT_221 = NL + "\tnodeVID = ";
+ protected final String TEXT_222 = ".INSTANCE.getNodeVisualID(viewObject, nextValue);";
+ protected final String TEXT_223 = NL + "\tswitch (nodeVID) {";
+ protected final String TEXT_224 = NL + "\tcase ";
+ protected final String TEXT_225 = ".VISUAL_ID: {";
+ protected final String TEXT_226 = NL + "\tif (";
+ protected final String TEXT_227 = ".VISUAL_ID == nodeVID) {";
+ protected final String TEXT_228 = NL + "\t\tresult.add(nextValue);";
+ protected final String TEXT_229 = NL + "\t\tbreak;" + NL + "\t\t}";
+ protected final String TEXT_230 = NL + "\t\t}";
+ protected final String TEXT_231 = NL + "\t}";
+ protected final String TEXT_232 = NL + "\t}";
+ protected final String TEXT_233 = NL + "\treturn result;";
+ protected final String TEXT_234 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns whether a notational element should be created for the given domain element. " + NL + "\t * The generated code always returns ";
+ protected final String TEXT_235 = ". " + NL + "\t * User can change implementation of this method to handle a more sophisticated logic." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean shouldCreateView(EObject domainElement) {" + NL + "\t\treturn ";
+ protected final String TEXT_236 = ";" + NL + "\t}";
+ protected final String TEXT_237 = NL;
+ protected final String TEXT_238 = NL;
+ protected final String TEXT_239 = "\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 ";
+ protected final String TEXT_240 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void notifyChanged(";
+ protected final String TEXT_241 = " 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((";
+ protected final String TEXT_242 = ") 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 + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdateManager updateManager = new UpdateManager();" + NL + "}";
+ protected final String TEXT_243 = NL;
public String generate(Object argument)
{
@@ -142,6 +267,8 @@
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+importManager.registerInnerClass("NotationModelRefresher"); //from notationModelRefresher.jetinc
+List childNodes = genDiagram.getTopLevelNodes();
stringBuffer.append(TEXT_1);
@@ -208,7 +335,7 @@
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
stringBuffer.append(TEXT_18);
-for(Iterator it = genDiagram.getTopLevelNodes().iterator(); it.hasNext(); ) {
+for(Iterator it = childNodes.iterator(); it.hasNext(); ) {
GenTopLevelNode next = (GenTopLevelNode)it.next();
stringBuffer.append(TEXT_19);
@@ -246,7 +373,7 @@
/*@ include file="adapters/propertySource.javajetinc"*/
stringBuffer.append(TEXT_34);
-for(Iterator it = genDiagram.getTopLevelNodes().iterator(); genDiagram.getPalette() != null && it.hasNext(); ) {
+for(Iterator it = childNodes.iterator(); it.hasNext(); ) {
GenTopLevelNode next = (GenTopLevelNode)it.next();
boolean isStatic = true;
boolean isListLayout = false;
@@ -261,189 +388,572 @@
stringBuffer.append(next.getDomainMetaClass().getName());
stringBuffer.append(next.getVisualID());
stringBuffer.append(TEXT_39);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
stringBuffer.append(TEXT_40);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_41);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node"));
- stringBuffer.append(TEXT_42);
stringBuffer.append(next.getDomainMetaClass().getName());
stringBuffer.append(next.getVisualID());
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_42);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_43);
+ if (!isListLayout) {
stringBuffer.append(TEXT_44);
- stringBuffer.append(importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
stringBuffer.append(TEXT_45);
- if (!isListLayout) {
+ }
stringBuffer.append(TEXT_46);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_47);
- }
+ stringBuffer.append(importManager.getImportedName(next.getNotationViewFactoryQualifiedClassName()));
stringBuffer.append(TEXT_48);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
- stringBuffer.append(TEXT_49);
-if (next.getDomainMetaClass().isMapEntry()) {
-/*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
+ if (!isListLayout) {
+ stringBuffer.append(TEXT_49);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
stringBuffer.append(TEXT_50);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
stringBuffer.append(TEXT_51);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+
+ int defaultWidth = 40;
+ int defaultHeight = 40;
+ DefaultSizeAttributes defSizeAttrs = (DefaultSizeAttributes) next.getViewmap().find(DefaultSizeAttributes.class);
+ if (defSizeAttrs != null) {
+ defaultWidth = defSizeAttrs.getWidth();
+ defaultHeight = defSizeAttrs.getHeight();
+ }
+
stringBuffer.append(TEXT_52);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()));
+ stringBuffer.append(defaultWidth);
stringBuffer.append(TEXT_53);
- stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(defaultHeight);
stringBuffer.append(TEXT_54);
-} else {
+ }
stringBuffer.append(TEXT_55);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName()));
+
+if (genDiagram.getPalette() != null) {
+
stringBuffer.append(TEXT_56);
- stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+ if (isStatic) {
stringBuffer.append(TEXT_57);
- stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ }
stringBuffer.append(TEXT_58);
-
-}
-
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
stringBuffer.append(TEXT_59);
- /*XXX: Class name DomainElementInitializer should be user-customizable*/
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
stringBuffer.append(TEXT_60);
- stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
stringBuffer.append(TEXT_61);
- stringBuffer.append(next.getUniqueIdentifier());
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
stringBuffer.append(TEXT_62);
- stringBuffer.append(importManager.getImportedName(next.getNotationViewFactoryQualifiedClassName()));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
stringBuffer.append(TEXT_63);
-
- if (!isListLayout) {
-
+ stringBuffer.append(importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName()));
stringBuffer.append(TEXT_64);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Bounds"));
+ if (!isListLayout) {
stringBuffer.append(TEXT_65);
- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle"));
stringBuffer.append(TEXT_66);
-
- int defaultWidth = 40;
- int defaultHeight = 40;
- DefaultSizeAttributes defSizeAttrs = (DefaultSizeAttributes) next.getViewmap().find(DefaultSizeAttributes.class);
- if (defSizeAttrs != null) {
- defaultWidth = defSizeAttrs.getWidth();
- defaultHeight = defSizeAttrs.getHeight();
- }
-
+ }
stringBuffer.append(TEXT_67);
- stringBuffer.append(defaultWidth);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
stringBuffer.append(TEXT_68);
- stringBuffer.append(defaultHeight);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
stringBuffer.append(TEXT_69);
- }
+ if (next.getDomainMetaClass().isMapEntry()) {
+ /*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
stringBuffer.append(TEXT_70);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_71);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
stringBuffer.append(TEXT_72);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_73);
+ stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(TEXT_74);
+
+ } else {
+
+ stringBuffer.append(TEXT_75);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_76);
+ stringBuffer.append(importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName()));
+ stringBuffer.append(TEXT_77);
+ stringBuffer.append(next.getDomainMetaClass().getClassifierAccessorName());
+ stringBuffer.append(TEXT_78);
+
+ }
+
+ stringBuffer.append(TEXT_79);
+ /*XXX: Class name DomainElementInitializer should be user-customizable*/
+ stringBuffer.append(TEXT_80);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer"));
+ stringBuffer.append(TEXT_81);
+ stringBuffer.append(next.getUniqueIdentifier());
+ stringBuffer.append(TEXT_82);
TypeModelFacet facet = next.getModelFacet();
GenFeature childFeature = facet.getChildMetaFeature();
GenFeature containmentFeature = facet.getContainmentMetaFeature();
if (childFeature != null && childFeature != containmentFeature && !childFeature.isDerived()) {
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_84);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_88);
stringBuffer.append(containmentFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_89);
stringBuffer.append(importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_90);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_82);
+ stringBuffer.append(TEXT_92);
stringBuffer.append(childFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_93);
} else {
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_94);
stringBuffer.append(importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand"));
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_95);
stringBuffer.append(resolvedSemanticElement);
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_96);
stringBuffer.append(importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_97);
stringBuffer.append(containmentFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_98);
}
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_99);
+ stringBuffer.append(next.getDomainMetaClass().getName());
+ stringBuffer.append(next.getVisualID());
+ stringBuffer.append(TEXT_100);
+ if(!isListLayout) {
+ stringBuffer.append(TEXT_101);
+ }
+ stringBuffer.append(TEXT_102);
}
- stringBuffer.append(TEXT_90);
- stringBuffer.append(TEXT_91);
- stringBuffer.append(TEXT_92);
+
+}
+
+ stringBuffer.append(TEXT_103);
+ stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_105);
stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_106);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_107);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
- stringBuffer.append(TEXT_95);
- stringBuffer.append(TEXT_96);
- stringBuffer.append(TEXT_97);
+ stringBuffer.append(TEXT_108);
+ stringBuffer.append(TEXT_109);
+ stringBuffer.append(TEXT_110);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_111);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
- stringBuffer.append(TEXT_99);
+ stringBuffer.append(TEXT_112);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.util.EContentAdapter"));
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_113);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
- stringBuffer.append(TEXT_101);
+ stringBuffer.append(TEXT_114);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_115);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_103);
+ stringBuffer.append(TEXT_116);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_117);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_118);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
- stringBuffer.append(TEXT_106);
+ stringBuffer.append(TEXT_119);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_107);
+ stringBuffer.append(TEXT_120);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_108);
+ stringBuffer.append(TEXT_121);
stringBuffer.append(importManager.getImportedName("java.util.Collections"));
- stringBuffer.append(TEXT_109);
+ stringBuffer.append(TEXT_122);
stringBuffer.append(importManager.getImportedName("java.util.Collections"));
- stringBuffer.append(TEXT_110);
+ stringBuffer.append(TEXT_123);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_111);
+ stringBuffer.append(TEXT_124);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_112);
- stringBuffer.append(TEXT_113);
- stringBuffer.append(TEXT_114);
+ stringBuffer.append(TEXT_125);
+
+{
+String _getDiagramCode = "getDiagram()";
+String _getViewCode = "getDiagram()";
+String _getSemanticElementCode = "getDiagram().getElement()";
+boolean isListLayout = false;
+
+ stringBuffer.append(TEXT_126);
+ stringBuffer.append(TEXT_127);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(TEXT_128);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
+ stringBuffer.append(TEXT_129);
+ stringBuffer.append(_getDiagramCode);
+ stringBuffer.append(TEXT_130);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetListenerImpl"));
+ stringBuffer.append(TEXT_131);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_132);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(TEXT_133);
+
+boolean hasConstraintsInChildren = false;
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet != null && typeModelFacet.getMetaClass() != null && typeModelFacet.getModelElementSelector() != null) {
+ hasConstraintsInChildren = true;
+ break;
+ }
+}
+
+
+if (hasConstraintsInChildren) {
+
+ stringBuffer.append(TEXT_134);
+ stringBuffer.append(genDiagram.getVisualIDRegistryQualifiedClassName());
+ stringBuffer.append(TEXT_135);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_136);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_137);
+
+}
+
+ stringBuffer.append(TEXT_138);
+
+boolean hasDeclaredFilter = false;
+Set genChildFeatures = new LinkedHashSet();
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (genChildFeatures.contains(childMetaFeature)) {
+ continue;
+ }
+ genChildFeatures.add(childMetaFeature);
+ if (!hasDeclaredFilter) {
+ hasDeclaredFilter = true;
+
+ stringBuffer.append(TEXT_139);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_140);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_141);
+ stringBuffer.append(childMetaFeature.getFeatureAccessorName());
+ stringBuffer.append(TEXT_142);
+
+ } else {
+
+ stringBuffer.append(TEXT_143);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_144);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_145);
+ stringBuffer.append(childMetaFeature.getFeatureAccessorName());
+ stringBuffer.append(TEXT_146);
+
+ }
+} //for
+
+
+if (hasDeclaredFilter) {
+
+ stringBuffer.append(TEXT_147);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_148);
+ stringBuffer.append(_getSemanticElementCode);
+ stringBuffer.append(TEXT_149);
+
+} else {
+
+ stringBuffer.append(TEXT_150);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_151);
+ stringBuffer.append(_getSemanticElementCode);
+ stringBuffer.append(TEXT_152);
+
+}
+
+
+if (hasConstraintsInChildren) {
+
+ stringBuffer.append(TEXT_153);
+
+}
+
+ stringBuffer.append(TEXT_154);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(TEXT_155);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
+ stringBuffer.append(TEXT_156);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetChangeEvent"));
+ stringBuffer.append(TEXT_157);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter"));
+ stringBuffer.append(TEXT_158);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
+ stringBuffer.append(TEXT_159);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain"));
+ stringBuffer.append(TEXT_160);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil"));
+ stringBuffer.append(TEXT_161);
+ stringBuffer.append(_getDiagramCode);
+ stringBuffer.append(TEXT_162);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.Command"));
+ stringBuffer.append(TEXT_163);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_164);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_165);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_166);
+ stringBuffer.append(importManager.getImportedName("java.util.Map"));
+ stringBuffer.append(TEXT_167);
+ stringBuffer.append(importManager.getImportedName("java.util.HashMap"));
+ stringBuffer.append(TEXT_168);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_169);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_170);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_171);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_172);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_173);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_174);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_175);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand"));
+ stringBuffer.append(TEXT_176);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_177);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_178);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_179);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_180);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_181);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_182);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_183);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
+ stringBuffer.append(TEXT_184);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".ReplaceNotationalElementCommand"));
+ stringBuffer.append(TEXT_185);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_186);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_187);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_188);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".RemoveNotationalElementCommand"));
+ stringBuffer.append(TEXT_189);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand"));
+ stringBuffer.append(TEXT_190);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_191);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_192);
+
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName());
+
+ stringBuffer.append(TEXT_193);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_194);
+ stringBuffer.append(childNodeInterfaceName);
+ stringBuffer.append(TEXT_195);
+ stringBuffer.append(nextNode.getDomainMetaClass().getName());
+ stringBuffer.append(nextNode.getVisualID());
+ stringBuffer.append(TEXT_196);
+ if (!isListLayout) {
+ stringBuffer.append(TEXT_197);
+ }
+ stringBuffer.append(TEXT_198);
+
+}
+
+ stringBuffer.append(TEXT_199);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_200);
+ stringBuffer.append(TEXT_201);
+
+if (childNodes.size() == 0) {
+
+ stringBuffer.append(TEXT_202);
+ stringBuffer.append(importManager.getImportedName("java.util.Collections"));
+ stringBuffer.append(TEXT_203);
+
+} else {
+
+ stringBuffer.append(TEXT_204);
+ stringBuffer.append(importManager.getImportedName("java.util.List"));
+ stringBuffer.append(TEXT_205);
+ stringBuffer.append(importManager.getImportedName("java.util.LinkedList"));
+ stringBuffer.append(TEXT_206);
+
+ Map genFeature2genNodeMap = new LinkedHashMap();
+ for (int nodeIndex = 0; nodeIndex < childNodes.size(); nodeIndex++) {
+ GenNode nextNode = (GenNode) childNodes.get(nodeIndex);
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (!genFeature2genNodeMap.containsKey(childMetaFeature)) {
+ genFeature2genNodeMap.put(childMetaFeature, new ArrayList());
+ }
+ ((Collection) genFeature2genNodeMap.get(childMetaFeature)).add(nextNode);
+ }
+ Set entrySet = genFeature2genNodeMap.entrySet();
+ if (entrySet.size() > 0) {
+
+ stringBuffer.append(TEXT_207);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_208);
+ stringBuffer.append(_getViewCode);
+ stringBuffer.append(TEXT_209);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_210);
+ stringBuffer.append(_getSemanticElementCode);
+ stringBuffer.append(TEXT_211);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_212);
+
+ }
+ for (Iterator entries = entrySet.iterator(); entries.hasNext();) {
+ Map.Entry nextEntry = (Map.Entry) entries.next();
+ GenFeature childMetaFeature = (GenFeature) nextEntry.getKey();
+ Collection genNodesCollection = (Collection) nextEntry.getValue();
+ if (childMetaFeature.isListType()) {
+
+ stringBuffer.append(TEXT_213);
+ stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_214);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_215);
+ stringBuffer.append(childMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_216);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_217);
+
+ } else {
+
+ stringBuffer.append(TEXT_218);
+ stringBuffer.append(importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName()));
+ stringBuffer.append(TEXT_219);
+ stringBuffer.append(childMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_220);
+
+ }
+
+ stringBuffer.append(TEXT_221);
+ stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName()));
+ stringBuffer.append(TEXT_222);
+
+ boolean generateSwitch = genNodesCollection.size() != 1;
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_223);
+
+ }
+ for (Iterator genNodesIterator = genNodesCollection.iterator(); genNodesIterator.hasNext();) {
+ GenNode nextNode = (GenNode) genNodesIterator.next();
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_224);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_225);
+
+ } else {
+
+ stringBuffer.append(TEXT_226);
+ stringBuffer.append(importManager.getImportedName(nextNode.getEditPartQualifiedClassName()));
+ stringBuffer.append(TEXT_227);
+
+ }
+
+ stringBuffer.append(TEXT_228);
+
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_229);
+
+ } else {
+
+ stringBuffer.append(TEXT_230);
+
+ }
+ }
+ if (generateSwitch) {
+
+ stringBuffer.append(TEXT_231);
+
+ }
+ if (childMetaFeature.isListType()) {
+
+ stringBuffer.append(TEXT_232);
+
+ }
+}
+
+ stringBuffer.append(TEXT_233);
+
+}
+
+ stringBuffer.append(TEXT_234);
+ stringBuffer.append(genDiagram.isSynchronized());
+ stringBuffer.append(TEXT_235);
+ stringBuffer.append(genDiagram.isSynchronized());
+ stringBuffer.append(TEXT_236);
+
+}
+
+ stringBuffer.append(TEXT_237);
+ stringBuffer.append(TEXT_238);
+ stringBuffer.append(TEXT_239);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.impl.AdapterImpl"));
- stringBuffer.append(TEXT_115);
+ stringBuffer.append(TEXT_240);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.notify.Notification"));
- stringBuffer.append(TEXT_116);
+ stringBuffer.append(TEXT_241);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
- stringBuffer.append(TEXT_117);
+ stringBuffer.append(TEXT_242);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_118);
+ stringBuffer.append(TEXT_243);
return stringBuffer.toString();
}
}
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/parts/NodeEditPartGenerator.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/parts/NodeEditPartGenerator.java,v
retrieving revision 1.10
diff -u -r1.10 NodeEditPartGenerator.java
--- src-templates/org/eclipse/gmf/codegen/templates/lite/parts/NodeEditPartGenerator.java 16 Jun 2006 07:52:07 -0000 1.10
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/parts/NodeEditPartGenerator.java 19 Jun 2006 16:46:22 -0000
@@ -280,9 +280,9 @@
protected final String TEXT_259 = " 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((";
protected final String TEXT_260 = ") 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;
protected final String TEXT_261 = NL;
- protected final String TEXT_262 = "\tpublic void addRefresher(";
- protected final String TEXT_263 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tpublic void removeRefresher(";
- protected final String TEXT_264 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
+ protected final String TEXT_262 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addRefresher(";
+ protected final String TEXT_263 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.addRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void removeRefresher(";
+ protected final String TEXT_264 = " feature, Refresher refresher) {" + NL + "\t\tCompositeRefresher compositeRefresher = getCompositeRefresher(feature);" + NL + "\t\tcompositeRefresher.removeRefresher(refresher);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CompositeRefresher getCompositeRefresher(";
protected final String TEXT_265 = " 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;
protected final String TEXT_266 = NL;
protected final String TEXT_267 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void refreshFont() {" + NL + "\t\t";
Index: templates/parts/createNodeCommand.javajetinc
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/parts/createNodeCommand.javajetinc,v
retrieving revision 1.2
diff -u -r1.2 createNodeCommand.javajetinc
--- templates/parts/createNodeCommand.javajetinc 22 May 2006 18:22:10 -0000 1.2
+++ templates/parts/createNodeCommand.javajetinc 19 Jun 2006 16:46:24 -0000
@@ -1,37 +1,16 @@
/**
* @generated
*/
- private <%if (isStatic) {%>static <%}%>class Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>Command extends <%=importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")%> {
+ private <%if (isStatic) {%>static <%}%>class Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>NotationCommand extends <%=importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand")%> {
/**
* @generated
*/
- private final <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent;
-
- /**
- * @generated
- */
- private <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> createdNode;
- /**
- * @generated
- */
- public Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>Command(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent, <%=importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName())%>.CreateRequestEx request<%if (!isListLayout) {%>, <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")%> constraint<%}%>) {
- this.parent = parent;
- createdNode = <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")%>.eINSTANCE.createNode();
-<%
-if (next.getDomainMetaClass().isMapEntry()) {
-/*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
-%>
- <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> createdDomainElement = <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName())%>.eINSTANCE.create(
- <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=next.getDomainMetaClass().getClassifierAccessorName()%>());
-<%
-} else {
-%>
- <%=importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName())%> createdDomainElement = <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName())%>.eINSTANCE.create<%=next.getDomainMetaClass().getClassifierAccessorName()%>();
-<%
-}
-%> createdNode.setElement(createdDomainElement);
- <%/*XXX: Class name DomainElementInitializer should be user-customizable*/%>
- <%=importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")%>.<%=next.getUniqueIdentifier()%>.initializeElement(createdDomainElement);
+ private Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>NotationCommand(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent,
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> domainElement<%if (!isListLayout) {%>, <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")%> constraint<%}%>) {
+ super(parent);
+ Node createdNode = <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")%>.eINSTANCE.createNode();
+ setCreatedView(createdNode);
+ createdNode.setElement(domainElement);
<%=importManager.getImportedName(next.getNotationViewFactoryQualifiedClassName())%>.decorateView(createdNode);
<%
if (!isListLayout) {
@@ -54,8 +33,42 @@
<%
}
%>
+ }
+ }
+
+<%
+if (genDiagram.getPalette() != null) {
+%>
+ /**
+ * @generated
+ */
+ private <%if (isStatic) {%>static <%}%>class Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>Command extends <%=importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")%> {
+ /**
+ * @generated
+ */
+ private final Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>NotationCommand notationAddCommand;
+
+ /**
+ * @generated
+ */
+ public Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>Command(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent, <%=importManager.getImportedName(genDiagram.getPalette().getFactoryQualifiedClassName())%>.CreateRequestEx request<%if (!isListLayout) {%>, <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")%> constraint<%}%>) {
<%=importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")%> domainModelEditDomain = <%=importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil")%>.getEditingDomain(parent.getDiagram().getElement());
<%
+ if (next.getDomainMetaClass().isMapEntry()) {
+ /*Workaround for Ecore example: map entries cannot be created using factory, only using reflective EFactory.create() method*/
+%>
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> createdDomainElement = <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName())%>.eINSTANCE.create(
+ <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=next.getDomainMetaClass().getClassifierAccessorName()%>());
+<%
+ } else {
+%>
+ <%=importManager.getImportedName(next.getDomainMetaClass().getQualifiedInterfaceName())%> createdDomainElement = <%=importManager.getImportedName(next.getDomainMetaClass().getGenPackage().getQualifiedFactoryInterfaceName())%>.eINSTANCE.create<%=next.getDomainMetaClass().getClassifierAccessorName()%>();
+<%
+ }
+%>
+ <%/*XXX: Class name DomainElementInitializer should be user-customizable*/%>
+ <%=importManager.getImportedName(genDiagram.getNotationViewFactoriesPackageName() + ".DomainElementInitializer")%>.<%=next.getUniqueIdentifier()%>.initializeElement(createdDomainElement);
+<%
TypeModelFacet facet = next.getModelFacet();
GenFeature childFeature = facet.getChildMetaFeature();
GenFeature containmentFeature = facet.getContainmentMetaFeature();
@@ -63,19 +76,20 @@
%>
<%=importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")%> compoundCommand = new <%=importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")%>();
compoundCommand.append(<%=importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")%>.create(domainModelEditDomain, <%=resolvedSemanticElement%>,
- <%=importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=containmentFeature.getFeatureAccessorName()%>(), createdNode.getElement()));
+ <%=importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=containmentFeature.getFeatureAccessorName()%>(), createdDomainElement));
compoundCommand.append(<%=importManager.getImportedName(childFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")%>.create(domainModelEditDomain, <%=resolvedSemanticElement%>,
- <%=importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=childFeature.getFeatureAccessorName()%>(), createdNode.getElement()));
+ <%=importManager.getImportedName(childFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=childFeature.getFeatureAccessorName()%>(), createdDomainElement));
this.domainModelAddCommand = compoundCommand;
<%
} else {
%>
this.domainModelAddCommand = <%=importManager.getImportedName(containmentFeature.getEcoreFeature().isMany() ? "org.eclipse.emf.edit.command.AddCommand" : "org.eclipse.emf.edit.command.SetCommand")%>.create(domainModelEditDomain, <%=resolvedSemanticElement%>,
- <%=importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=containmentFeature.getFeatureAccessorName()%>(), createdNode.getElement());
+ <%=importManager.getImportedName(containmentFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=containmentFeature.getFeatureAccessorName()%>(), createdDomainElement);
<%
}
%>
- request.setCreatedObject(createdNode);
+ this.notationAddCommand = new Create<%=next.getDomainMetaClass().getName()%><%=next.getVisualID()%>NotationCommand(parent, createdDomainElement<%if(!isListLayout) {%>, constraint<%}%>);
+ request.setCreatedObject(notationAddCommand.getCreatedView());
}
/**
@@ -87,29 +101,31 @@
* @generated
*/
public boolean canExecute() {
- return domainModelAddCommand != null && domainModelAddCommand.canExecute();
+ return domainModelAddCommand != null
+ && domainModelAddCommand.canExecute() && notationAddCommand != null && notationAddCommand.canExecute();
}
/**
* @generated
*/
public boolean canUndo() {
- return domainModelAddCommand != null && domainModelAddCommand.canUndo();
+ return domainModelAddCommand != null
+ && domainModelAddCommand.canUndo() && notationAddCommand != null && notationAddCommand.canUndo();
}
/**
* @generated
*/
public void execute() {
- parent.insertChild(createdNode);
domainModelAddCommand.execute();
+ notationAddCommand.execute();
}
/**
* @generated
*/
public void undo() {
- parent.getPersistedChildren().remove(createdNode);
+ notationAddCommand.undo();
domainModelAddCommand.undo();
}
/**
@@ -119,3 +135,6 @@
execute();
}
}
+<%
+}
+%>
\ No newline at end of file
Index: templates/parts/DiagramEditPart.javajet
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/parts/DiagramEditPart.javajet,v
retrieving revision 1.4
diff -u -r1.4 DiagramEditPart.javajet
--- templates/parts/DiagramEditPart.javajet 24 May 2006 18:18:05 -0000 1.4
+++ templates/parts/DiagramEditPart.javajet 19 Jun 2006 16:46:24 -0000
@@ -3,6 +3,8 @@
<%
GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0];
ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+importManager.registerInnerClass("NotationModelRefresher"); //from notationModelRefresher.jetinc
+List childNodes = genDiagram.getTopLevelNodes();
%>
<%
@@ -80,7 +82,7 @@
int nextVisualId = visualIds[i];
switch (nextVisualId) {
<%
-for(Iterator it = genDiagram.getTopLevelNodes().iterator(); it.hasNext(); ) {
+for(Iterator it = childNodes.iterator(); it.hasNext(); ) {
GenTopLevelNode next = (GenTopLevelNode)it.next();
%>
case <%=importManager.getImportedName(next.getEditPartQualifiedClassName())%>.VISUAL_ID:
@@ -140,6 +142,7 @@
return UnexecutableCommand.INSTANCE;
}
});
+ installNotationModelRefresher();
}
/**
@@ -171,7 +174,7 @@
}
<%
-for(Iterator it = genDiagram.getTopLevelNodes().iterator(); genDiagram.getPalette() != null && it.hasNext(); ) {
+for(Iterator it = childNodes.iterator(); it.hasNext(); ) {
GenTopLevelNode next = (GenTopLevelNode)it.next();
boolean isStatic = true;
boolean isListLayout = false;
@@ -249,17 +252,31 @@
super.activate();
getDiagram().eAdapters().add(updateManager);
getDiagram().getElement().eAdapters().add(domainModelRefresher);
+ installNotationModelRefresher();
}
/**
* @generated
*/
public void deactivate() {
+ uninstallNotationModelRefresher();
getDiagram().getElement().eAdapters().remove(domainModelRefresher);
getDiagram().eAdapters().remove(updateManager);
super.deactivate();
}
+<%
+{
+String _getDiagramCode = "getDiagram()";
+String _getViewCode = "getDiagram()";
+String _getSemanticElementCode = "getDiagram().getElement()";
+boolean isListLayout = false;
+%>
+<%@ include file="notationModelRefresher.jetinc"%>
+<%
+}
+%>
+
<%@ include file="refreshers.javajetinc/domainModelRefresher.javajetinc"%>
/**
Index: templates/parts/CompartmentEditPart.javajet
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/parts/CompartmentEditPart.javajet,v
retrieving revision 1.4
diff -u -r1.4 CompartmentEditPart.javajet
--- templates/parts/CompartmentEditPart.javajet 24 May 2006 18:18:05 -0000 1.4
+++ templates/parts/CompartmentEditPart.javajet 19 Jun 2006 16:46:24 -0000
@@ -4,7 +4,9 @@
GenCompartment genCompartment = (GenCompartment) ((Object[]) argument)[0];
GenNode genHost = genCompartment.getNode();
GenDiagram genDiagram = genCompartment.getDiagram();
+List childNodes = genCompartment.getChildNodes();
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+importManager.registerInnerClass("NotationModelRefresher"); //from notationModelRefresher.jetinc
%>
<%@ include file="../copyright4java.jetinc"%>
<%importManager.emitPackageStatement(stringBuffer);
@@ -37,14 +39,20 @@
* @generated
*/
protected <%=importManager.getImportedName("java.util.List")%> getModelChildren() {
- return ((View) getModel()).getChildren();
+ return getDiagramNode().getChildren();
+ }
+
+ /**
+ * @generated
+ */
+ protected <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%> getDiagramNode() {
+ return (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Node")%>) getModel();
}
/**
* @generated
*/
protected void createEditPolicies() {
- //XXX: install correct edit policies!
<%if (!genCompartment.isListLayout()) {%>
installEditPolicy(<%=importManager.getImportedName("org.eclipse.gef.EditPolicy")%>.LAYOUT_ROLE, new <%=importManager.getImportedName("org.eclipse.gef.editpolicies.XYLayoutEditPolicy")%>() {
protected Command createChangeConstraintCommand(final <%=importManager.getImportedName("org.eclipse.gef.requests.ChangeBoundsRequest")%> request, final EditPart child, Object constraint) {
@@ -135,6 +143,7 @@
return null;
}
});
+ installNotationModelRefresher();
}
/**
@@ -193,6 +202,34 @@
return null;
}
+ /**
+ * @generated
+ */
+ public void activate() {
+ super.activate();
+ installNotationModelRefresher();
+ }
+
+ /**
+ * @generated
+ */
+ public void deactivate() {
+ uninstallNotationModelRefresher();
+ super.deactivate();
+ }
+
+<%
+{
+String _getViewCode = "getDiagramNode()";
+String _getDiagramCode = _getViewCode + ".getDiagram()";
+String _getSemanticElementCode = "resolveSemanticElement()";
+boolean isListLayout = genCompartment.isListLayout();
+%>
+<%@ include file="notationModelRefresher.jetinc"%>
+<%
+}
+%>
+
<%@ include file="refresher.javajetinc"%>
/**
@@ -233,7 +270,7 @@
}
<%
-for(Iterator it = genCompartment.getChildNodes().iterator(); genDiagram.getPalette() != null && it.hasNext(); ) {
+for(Iterator it = genCompartment.getChildNodes().iterator(); it.hasNext(); ) {
GenChildNode next = (GenChildNode)it.next();
boolean isStatic = false;
boolean isListLayout = genCompartment.isListLayout();
Index: templates/parts/refreshers.javajetinc/externalRefreshers.javajetinc
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/parts/refreshers.javajetinc/externalRefreshers.javajetinc,v
retrieving revision 1.1
diff -u -r1.1 externalRefreshers.javajetinc
--- templates/parts/refreshers.javajetinc/externalRefreshers.javajetinc 13 Apr 2006 21:20:16 -0000 1.1
+++ templates/parts/refreshers.javajetinc/externalRefreshers.javajetinc 19 Jun 2006 16:46:24 -0000
@@ -1,13 +1,22 @@
+ /**
+ * @generated
+ */
public void addRefresher(<%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> feature, Refresher refresher) {
CompositeRefresher compositeRefresher = getCompositeRefresher(feature);
compositeRefresher.addRefresher(refresher);
}
+ /**
+ * @generated
+ */
public void removeRefresher(<%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> feature, Refresher refresher) {
CompositeRefresher compositeRefresher = getCompositeRefresher(feature);
compositeRefresher.removeRefresher(refresher);
}
+ /**
+ * @generated
+ */
private CompositeRefresher getCompositeRefresher(<%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> feature) {
if (structuralFeatures2Refresher == null) {
createRefreshers();
Index: templates/commands/ReplaceNotationalElementCommand.javajet
===================================================================
RCS file: templates/commands/ReplaceNotationalElementCommand.javajet
diff -N templates/commands/ReplaceNotationalElementCommand.javajet
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/commands/ReplaceNotationalElementCommand.javajet 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,100 @@
+<%@ jet package="org.eclipse.gmf.codegen.templates.lite.commands" class="ReplaceNotationalElementCommandGenerator"
+ imports="org.eclipse.gmf.common.codegen.*"%>
+
+<%
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+%>
+
+<%
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+%>
+
+/**
+ * @generated
+ */
+public class ReplaceNotationalElementCommand extends <%=importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")%> {
+ /**
+ * @generated
+ */
+ private final CreateNotationalElementCommand createCommand;
+ /**
+ * @generated
+ */
+ private final RemoveNotationalElementCommand removeCommand;
+ /**
+ * @generated
+ */
+ private final <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> obsoleteView;
+
+ /**
+ * @generated
+ */
+ public ReplaceNotationalElementCommand(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parentView, CreateNotationalElementCommand createCommand, <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> obsoleteView) {
+ this.createCommand = createCommand;
+ this.obsoleteView = obsoleteView;
+ this.removeCommand = new RemoveNotationalElementCommand(parentView, obsoleteView);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ return createCommand != null && createCommand.canExecute() && removeCommand != null && removeCommand.canExecute();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canUndo() {
+ return createCommand != null && createCommand.canUndo() && removeCommand != null && removeCommand.canUndo();
+ }
+
+ /**
+ * @generated
+ */
+ public void execute() {
+ createCommand.execute();
+ removeCommand.execute();
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> createdView = createCommand.getCreatedView();
+ if (createdView == null || obsoleteView == null || !createdView.eClass().equals(obsoleteView.eClass())) {
+ return;
+ }
+ if (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")%>.eINSTANCE.getNode().equals(createdView.eClass())) {
+ copy(obsoleteView, createdView, <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")%>.eINSTANCE.getNode_LayoutConstraint());
+ } else if (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")%>.eINSTANCE.getEdge().equals(createdView.eClass())) {
+ copy(obsoleteView, createdView, <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage")%>.eINSTANCE.getEdge_Bendpoints());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void copy(<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> source, <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> target, <%=importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%> feature) {
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> oldValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) source.eGet(feature);
+ if (oldValue == null) {
+ return; //nothing to copy
+ }
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> newValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) target.eGet(feature);
+ if (newValue != null && !newValue.eClass().equals(oldValue.eClass())) {
+ return; //incompatible instances.
+ }
+ target.eSet(feature, oldValue);
+ }
+
+ /**
+ * @generated
+ */
+ public void undo() {
+ removeCommand.undo();
+ createCommand.undo();
+ }
+
+ /**
+ * @generated
+ */
+ public void redo() {
+ execute();
+ }
+}
+<%importManager.emitSortedImports();%>
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java
===================================================================
RCS file: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java
diff -N src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,87 @@
+package org.eclipse.gmf.codegen.templates.lite.commands;
+
+import org.eclipse.gmf.common.codegen.*;
+
+public class ReplaceNotationalElementCommandGenerator
+{
+ protected static String nl;
+ public static synchronized ReplaceNotationalElementCommandGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ ReplaceNotationalElementCommandGenerator result = new ReplaceNotationalElementCommandGenerator();
+ nl = null;
+ return result;
+ }
+
+ protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
+ protected final String TEXT_1 = "";
+ protected final String TEXT_2 = NL;
+ protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ReplaceNotationalElementCommand extends ";
+ protected final String TEXT_4 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final CreateNotationalElementCommand createCommand;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final RemoveNotationalElementCommand removeCommand;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final ";
+ protected final String TEXT_5 = " obsoleteView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ReplaceNotationalElementCommand(";
+ protected final String TEXT_6 = " parentView, CreateNotationalElementCommand createCommand, ";
+ protected final String TEXT_7 = " obsoleteView) {" + NL + "\t\tthis.createCommand = createCommand;" + NL + "\t\tthis.obsoleteView = obsoleteView;" + NL + "\t\tthis.removeCommand = new RemoveNotationalElementCommand(parentView, obsoleteView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canExecute() {" + NL + "\t\treturn createCommand != null && createCommand.canExecute() && removeCommand != null && removeCommand.canExecute();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canUndo() {" + NL + "\t\treturn createCommand != null && createCommand.canUndo() && removeCommand != null && removeCommand.canUndo();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void execute() {" + NL + "\t\tcreateCommand.execute();" + NL + "\t\tremoveCommand.execute();" + NL + "\t\t";
+ protected final String TEXT_8 = " createdView = createCommand.getCreatedView();" + NL + "\t\tif (createdView == null || obsoleteView == null || !createdView.eClass().equals(obsoleteView.eClass())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (";
+ protected final String TEXT_9 = ".eINSTANCE.getNode().equals(createdView.eClass())) {" + NL + "\t\t\tcopy(obsoleteView, createdView, ";
+ protected final String TEXT_10 = ".eINSTANCE.getNode_LayoutConstraint());" + NL + "\t\t} else if (";
+ protected final String TEXT_11 = ".eINSTANCE.getEdge().equals(createdView.eClass())) {" + NL + "\t\t\tcopy(obsoleteView, createdView, ";
+ protected final String TEXT_12 = ".eINSTANCE.getEdge_Bendpoints());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void copy(";
+ protected final String TEXT_13 = " source, ";
+ protected final String TEXT_14 = " target, ";
+ protected final String TEXT_15 = " feature) {" + NL + "\t\t";
+ protected final String TEXT_16 = " oldValue = (";
+ protected final String TEXT_17 = ") source.eGet(feature);" + NL + "\t\tif (oldValue == null) {" + NL + "\t\t\treturn;\t//nothing to copy" + NL + "\t\t}" + NL + "\t\t";
+ protected final String TEXT_18 = " newValue = (";
+ protected final String TEXT_19 = ") target.eGet(feature);" + NL + "\t\tif (newValue != null && !newValue.eClass().equals(oldValue.eClass())) {" + NL + "\t\t\treturn;\t//incompatible instances." + NL + "\t\t}" + NL + "\t\ttarget.eSet(feature, oldValue);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void undo() {" + NL + "\t\tremoveCommand.undo();" + NL + "\t\tcreateCommand.undo();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void redo() {" + NL + "\t\texecute();" + NL + "\t}" + NL + "}";
+ protected final String TEXT_20 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append(TEXT_1);
+
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+
+ stringBuffer.append(TEXT_2);
+
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+
+ stringBuffer.append(TEXT_3);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_9);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_10);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_11);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationPackage"));
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_13);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_16);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_18);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
+ stringBuffer.append(TEXT_19);
+ importManager.emitSortedImports();
+ stringBuffer.append(TEXT_20);
+ return stringBuffer.toString();
+ }
+}
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/CreateNotationalElementCommandGenerator.java
===================================================================
RCS file: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/CreateNotationalElementCommandGenerator.java
diff -N src-templates/org/eclipse/gmf/codegen/templates/lite/commands/CreateNotationalElementCommandGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/commands/CreateNotationalElementCommandGenerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,57 @@
+package org.eclipse.gmf.codegen.templates.lite.commands;
+
+import org.eclipse.gmf.common.codegen.*;
+
+public class CreateNotationalElementCommandGenerator
+{
+ protected static String nl;
+ public static synchronized CreateNotationalElementCommandGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ CreateNotationalElementCommandGenerator result = new CreateNotationalElementCommandGenerator();
+ nl = null;
+ return result;
+ }
+
+ protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
+ protected final String TEXT_1 = "";
+ protected final String TEXT_2 = NL;
+ protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class CreateNotationalElementCommand extends ";
+ protected final String TEXT_4 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final ";
+ protected final String TEXT_5 = " parent;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_6 = " createdView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic CreateNotationalElementCommand(";
+ protected final String TEXT_7 = " parent) {" + NL + "\t\tthis.parent = parent;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected final void setCreatedView(";
+ protected final String TEXT_8 = " view) {" + NL + "\t\tthis.createdView = view;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_9 = " getCreatedView() {" + NL + "\t\treturn createdView;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canExecute() {" + NL + "\t\treturn createdView != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canUndo() {" + NL + "\t\treturn true;" + NL + "\t}" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void execute() {" + NL + "\t\tparent.insertChild(createdView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void undo() {" + NL + "\t\tparent.removeChild(createdView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void redo() {" + NL + "\t\texecute();" + NL + "\t}" + NL + "}";
+ protected final String TEXT_10 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append(TEXT_1);
+
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+
+ stringBuffer.append(TEXT_2);
+
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+
+ stringBuffer.append(TEXT_3);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_9);
+ importManager.emitSortedImports();
+ stringBuffer.append(TEXT_10);
+ return stringBuffer.toString();
+ }
+}
Index: templates/parts/notationModelRefresher.jetinc
===================================================================
RCS file: templates/parts/notationModelRefresher.jetinc
diff -N templates/parts/notationModelRefresher.jetinc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/parts/notationModelRefresher.jetinc 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,271 @@
+ /**
+ * @generated
+ */
+ private void installNotationModelRefresher() {
+ NotationModelRefresher refresher = getNotationModelRefresher();
+ if (refresher.isInstalled()) {
+ return;
+ }
+ <%=importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")%> domainModelEditDomain = <%=importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil")%>.getEditingDomain(<%=_getDiagramCode%>.getElement());
+ refresher.install(domainModelEditDomain);
+ refreshNotationModel();
+ }
+
+ /**
+ * @generated
+ */
+ private void uninstallNotationModelRefresher() {
+ getNotationModelRefresher().uninstall();
+ }
+
+ /**
+ * @generated
+ */
+ private NotationModelRefresher notationModelRefresher;
+
+ /**
+ * @generated
+ */
+ private NotationModelRefresher getNotationModelRefresher() {
+ if (notationModelRefresher == null) {
+ notationModelRefresher = new NotationModelRefresher();
+ }
+ return notationModelRefresher;
+ }
+
+ /**
+ * @generated
+ */
+ private class NotationModelRefresher extends <%=importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetListenerImpl")%> {
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%> filter;
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")%> editingDomain;
+
+ /**
+ * @generated
+ */
+ public NotationModelRefresher() {
+ createFilter();
+ }
+<%
+boolean hasConstraintsInChildren = false;
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet != null && typeModelFacet.getMetaClass() != null && typeModelFacet.getModelElementSelector() != null) {
+ hasConstraintsInChildren = true;
+ break;
+ }
+}
+%>
+<%
+if (hasConstraintsInChildren) {
+%>
+
+ /**
+ * NB: Children of this element are selected based on constraint declared in <%=genDiagram.getVisualIDRegistryQualifiedClassName()%>.
+ * Since no assumptions may be made concerning the runtime behavior of the constraint, any non-touch notification may result in
+ * notational model having to be updated.
+ * User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications
+ * result in such an update.
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%> getConstrainedChildrenFilter() {
+ return <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%>.NOT_TOUCH;
+ }
+<%
+}
+%>
+
+ /**
+ * Creates a notification filter which filters notifications that may possibly affect the notational model
+ * @generated
+ */
+ private void createFilter() {
+<%
+boolean hasDeclaredFilter = false;
+Set genChildFeatures = new LinkedHashSet();
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (genChildFeatures.contains(childMetaFeature)) {
+ continue;
+ }
+ genChildFeatures.add(childMetaFeature);
+ if (!hasDeclaredFilter) {
+ hasDeclaredFilter = true;
+%>
+ filter = <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%>.createFeatureFilter(<%=importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=childMetaFeature.getFeatureAccessorName()%>());
+<%
+ } else {
+%>
+ filter = filter.or(<%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%>.createFeatureFilter(<%=importManager.getImportedName(childMetaFeature.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=childMetaFeature.getFeatureAccessorName()%>()));
+<%
+ }
+} //for
+%>
+<%
+if (hasDeclaredFilter) {
+%>
+ filter = filter.and(<%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%>.createNotifierFilter(<%=_getSemanticElementCode%>));
+<%
+} else {
+%>
+ filter = <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%>.createNotifierFilter(<%=_getSemanticElementCode%>);
+<%
+}
+%>
+<%
+if (hasConstraintsInChildren) {
+%>
+ filter = getConstrainedChildrenFilter().or(filter);
+<%
+}
+%>
+ }
+ /**
+ * @generated
+ */
+ public void install(<%=importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")%> editingDomain) {
+ if (this.editingDomain != null && !this.editingDomain.equals(editingDomain)) {
+ throw new IllegalStateException("Already listening to another editing domain");
+ }
+ this.editingDomain = editingDomain;
+ this.editingDomain.addResourceSetListener(this);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isInstalled() {
+ return editingDomain != null;
+ }
+
+ /**
+ * @generated
+ */
+ public void uninstall() {
+ if (isInstalled()) {
+ editingDomain.removeResourceSetListener(this);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isPrecommitOnly() {
+ return true;
+ }
+ /**
+ * @generated
+ */
+ public <%=importManager.getImportedName("org.eclipse.emf.common.command.Command")%> transactionAboutToCommit(<%=importManager.getImportedName("org.eclipse.emf.transaction.ResourceSetChangeEvent")%> event) {
+ return getRefreshNotationModelCommand();
+ }
+ /**
+ * @generated
+ */
+ public <%=importManager.getImportedName("org.eclipse.emf.transaction.NotificationFilter")%> getFilter() {
+ return filter;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshNotationModel() {
+ <%=importManager.getImportedName("org.eclipse.emf.common.command.Command")%> command = getRefreshNotationModelCommand();
+ if (command == null) {
+ return;
+ }
+ <%=importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")%> domainModelEditDomain = <%=importManager.getImportedName("org.eclipse.emf.transaction.util.TransactionUtil")%>.getEditingDomain(<%=_getDiagramCode%>.getElement());
+ getViewer().getEditDomain().getCommandStack().execute(new WrappingCommand(domainModelEditDomain, command));
+ }
+
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.emf.common.command.Command")%> getRefreshNotationModelCommand() {
+ <%=importManager.getImportedName("java.util.List")%> semanticChildren = getSemanticChildren();
+ <%=importManager.getImportedName("java.util.List")%> notationalChildren = <%=_getViewCode%>.getChildren();
+ final <%=importManager.getImportedName("java.util.Map")%> semanticToNotational = new <%=importManager.getImportedName("java.util.HashMap")%>();
+ for(<%=importManager.getImportedName("java.util.Iterator")%> it = notationalChildren.iterator(); it.hasNext(); ) {
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> next = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%>) it.next();
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> nextSemantic = next.getElement();
+ if (nextSemantic != null) {
+ semanticToNotational.put(nextSemantic, next);
+ }
+ }
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parentView = <%=_getViewCode%>;
+ <%=importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")%> command = new <%=importManager.getImportedName("org.eclipse.emf.common.command.CompoundCommand")%>();
+ for(<%=importManager.getImportedName("java.util.Iterator")%> it = semanticChildren.iterator(); it.hasNext(); ) {
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> next = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) it.next();
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> currentView = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%>) semanticToNotational.remove(next);
+ int nodeVisualID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getNodeVisualID(parentView, next);
+ if (currentView == null) {
+ if (shouldCreateView(next)) {
+ command.appendIfCanExecute(getCreateNotationalElementCommand(parentView, next, nodeVisualID));
+ }
+ } else if (nodeVisualID != <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.getVisualID(currentView)) {
+ <%=importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand")%> notationalCommand = getCreateNotationalElementCommand(parentView, next, nodeVisualID);
+ if (notationalCommand != null) {
+ command.appendIfCanExecute(new <%=importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".ReplaceNotationalElementCommand")%>(parentView, notationalCommand, currentView));
+ }
+ }
+ }
+ for(<%=importManager.getImportedName("java.util.Iterator")%> it = semanticToNotational.values().iterator(); it.hasNext(); ) {
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> obsoleteView = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%>) it.next();
+ command.appendIfCanExecute(new <%=importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".RemoveNotationalElementCommand")%>(parentView, obsoleteView));
+ }
+ return command.getCommandList().isEmpty() ? null : command;
+ }
+
+ private <%=importManager.getImportedName(genDiagram.getEditCommandsPackageName() + ".CreateNotationalElementCommand")%> getCreateNotationalElementCommand(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parentView, <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> domainElement, int nodeVisualID) {
+ switch (nodeVisualID) {
+<%
+for (Iterator it = childNodes.iterator(); it.hasNext(); ) {
+ GenNode nextNode = (GenNode) it.next();
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ String childNodeInterfaceName = importManager.getImportedName(nextNode.getDomainMetaClass().getQualifiedInterfaceName());
+%>
+ case <%=importManager.getImportedName(nextNode.getEditPartQualifiedClassName())%>.VISUAL_ID:
+ if (domainElement instanceof <%=childNodeInterfaceName%>) {
+ return new Create<%=nextNode.getDomainMetaClass().getName()%><%=nextNode.getVisualID()%>NotationCommand(parentView, domainElement<%if (!isListLayout) {%>, new Rectangle(0, 0, 0, 0)<%}%>);
+ }
+ return null;
+<%
+}
+%>
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("java.util.List")%> getSemanticChildren() {
+<%@ include file="semanticChildren.jetinc" %>
+ }
+
+ /**
+ * Returns whether a notational element should be created for the given domain element.
+ * The generated code always returns <%=genDiagram.isSynchronized()%>.
+ * User can change implementation of this method to handle a more sophisticated logic.
+ * @generated
+ */
+ private boolean shouldCreateView(EObject domainElement) {
+ return <%=genDiagram.isSynchronized()%>;
+ }
Index: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/RemoveNotationalElementCommandGenerator.java
===================================================================
RCS file: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/RemoveNotationalElementCommandGenerator.java
diff -N src-templates/org/eclipse/gmf/codegen/templates/lite/commands/RemoveNotationalElementCommandGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/commands/RemoveNotationalElementCommandGenerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,54 @@
+package org.eclipse.gmf.codegen.templates.lite.commands;
+
+import org.eclipse.gmf.common.codegen.*;
+
+public class RemoveNotationalElementCommandGenerator
+{
+ protected static String nl;
+ public static synchronized RemoveNotationalElementCommandGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ RemoveNotationalElementCommandGenerator result = new RemoveNotationalElementCommandGenerator();
+ nl = null;
+ return result;
+ }
+
+ protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
+ protected final String TEXT_1 = "";
+ protected final String TEXT_2 = NL;
+ protected final String TEXT_3 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class RemoveNotationalElementCommand extends ";
+ protected final String TEXT_4 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final ";
+ protected final String TEXT_5 = " childView;" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final ";
+ protected final String TEXT_6 = " parentView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic RemoveNotationalElementCommand(";
+ protected final String TEXT_7 = " parentView, ";
+ protected final String TEXT_8 = " childView) {" + NL + "\t\tthis.parentView = parentView;" + NL + "\t\tthis.childView = childView;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canExecute() {" + NL + "\t\treturn parentView.getChildren().contains(childView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canUndo() {" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void execute() {" + NL + "\t\tparentView.removeChild(childView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void redo() {" + NL + "\t\texecute();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void undo() {" + NL + "\t\tparentView.insertChild(childView);" + NL + "\t}" + NL + "}";
+ protected final String TEXT_9 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ stringBuffer.append(TEXT_1);
+
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+
+ stringBuffer.append(TEXT_2);
+
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+
+ stringBuffer.append(TEXT_3);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand"));
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_5);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
+ stringBuffer.append(TEXT_8);
+ importManager.emitSortedImports();
+ stringBuffer.append(TEXT_9);
+ return stringBuffer.toString();
+ }
+}
Index: templates/parts/semanticChildren.jetinc
===================================================================
RCS file: templates/parts/semanticChildren.jetinc
diff -N templates/parts/semanticChildren.jetinc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/parts/semanticChildren.jetinc 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,95 @@
+<%
+if (childNodes.size() == 0) {
+%>
+ return <%=importManager.getImportedName("java.util.Collections")%>.EMPTY_LIST;
+<%
+} else {
+%>
+ <%=importManager.getImportedName("java.util.List")%> result = new <%=importManager.getImportedName("java.util.LinkedList")%>();
+<%
+ Map genFeature2genNodeMap = new LinkedHashMap();
+ for (int nodeIndex = 0; nodeIndex < childNodes.size(); nodeIndex++) {
+ GenNode nextNode = (GenNode) childNodes.get(nodeIndex);
+ TypeModelFacet typeModelFacet = nextNode.getModelFacet();
+ if (typeModelFacet == null) {
+ continue;
+ }
+ GenFeature childMetaFeature = typeModelFacet.getChildMetaFeature();
+ if (!genFeature2genNodeMap.containsKey(childMetaFeature)) {
+ genFeature2genNodeMap.put(childMetaFeature, new ArrayList());
+ }
+ ((Collection) genFeature2genNodeMap.get(childMetaFeature)).add(nextNode);
+ }
+ Set entrySet = genFeature2genNodeMap.entrySet();
+ if (entrySet.size() > 0) {
+%>
+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> viewObject = <%=_getViewCode%>;
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> modelObject = <%=_getSemanticElementCode%>;
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> nextValue;
+ int nodeVID;
+<%
+ }
+ for (Iterator entries = entrySet.iterator(); entries.hasNext();) {
+ Map.Entry nextEntry = (Map.Entry) entries.next();
+ GenFeature childMetaFeature = (GenFeature) nextEntry.getKey();
+ Collection genNodesCollection = (Collection) nextEntry.getValue();
+ if (childMetaFeature.isListType()) {
+%>
+ for(<%=importManager.getImportedName("java.util.Iterator")%> it = ((<%=importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName())%>)modelObject).<%=childMetaFeature.getGetAccessor()%>().iterator(); it.hasNext(); ) {
+ nextValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) it.next();
+<%
+ } else {
+%>
+ nextValue = ((<%=importManager.getImportedName(childMetaFeature.getGenClass().getQualifiedInterfaceName())%>)modelObject).<%=childMetaFeature.getGetAccessor()%>();
+<%
+ }
+%>
+ nodeVID = <%=importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())%>.INSTANCE.getNodeVisualID(viewObject, nextValue);
+<%
+ boolean generateSwitch = genNodesCollection.size() != 1;
+ if (generateSwitch) {
+%>
+ switch (nodeVID) {
+<%
+ }
+ for (Iterator genNodesIterator = genNodesCollection.iterator(); genNodesIterator.hasNext();) {
+ GenNode nextNode = (GenNode) genNodesIterator.next();
+ if (generateSwitch) {
+%>
+ case <%=importManager.getImportedName(nextNode.getEditPartQualifiedClassName())%>.VISUAL_ID: {
+<%
+ } else {
+%>
+ if (<%=importManager.getImportedName(nextNode.getEditPartQualifiedClassName())%>.VISUAL_ID == nodeVID) {
+<%
+ }
+%>
+ result.add(nextValue);
+<%
+ if (generateSwitch) {
+%>
+ break;
+ }
+<%
+ } else {
+%>
+ }
+<%
+ }
+ }
+ if (generateSwitch) {
+%>
+ }
+<%
+ }
+ if (childMetaFeature.isListType()) {
+%>
+ }
+<%
+ }
+}
+%>
+ return result;
+<%
+}
+%>
Index: templates/commands/CreateNotationalElementCommand.javajet
===================================================================
RCS file: templates/commands/CreateNotationalElementCommand.javajet
diff -N templates/commands/CreateNotationalElementCommand.javajet
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/commands/CreateNotationalElementCommand.javajet 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,82 @@
+<%@ jet package="org.eclipse.gmf.codegen.templates.lite.commands" class="CreateNotationalElementCommandGenerator"
+ imports="org.eclipse.gmf.common.codegen.*"%>
+
+<%
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+%>
+
+<%
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+%>
+
+/**
+ * @generated
+ */
+public class CreateNotationalElementCommand extends <%=importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")%> {
+ /**
+ * @generated
+ */
+ private final <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent;
+
+ /**
+ * @generated
+ */
+ private <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> createdView;
+
+ /**
+ * @generated
+ */
+ public CreateNotationalElementCommand(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * @generated
+ */
+ protected final void setCreatedView(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> view) {
+ this.createdView = view;
+ }
+
+ /**
+ * @generated
+ */
+ public <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> getCreatedView() {
+ return createdView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ return createdView != null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canUndo() {
+ return true;
+ }
+ /**
+ * @generated
+ */
+ public void execute() {
+ parent.insertChild(createdView);
+ }
+
+ /**
+ * @generated
+ */
+ public void undo() {
+ parent.removeChild(createdView);
+ }
+
+ /**
+ * @generated
+ */
+ public void redo() {
+ execute();
+ }
+}
+<%importManager.emitSortedImports();%>
Index: templates/commands/RemoveNotationalElementCommand.javajet
===================================================================
RCS file: templates/commands/RemoveNotationalElementCommand.javajet
diff -N templates/commands/RemoveNotationalElementCommand.javajet
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/commands/RemoveNotationalElementCommand.javajet 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,69 @@
+<%@ jet package="org.eclipse.gmf.codegen.templates.lite.commands" class="RemoveNotationalElementCommandGenerator"
+ imports="org.eclipse.gmf.common.codegen.*"%>
+
+<%
+ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1];
+%>
+
+<%
+importManager.emitPackageStatement(stringBuffer);
+importManager.markImportLocation(stringBuffer);
+%>
+
+/**
+ * @generated
+ */
+public class RemoveNotationalElementCommand extends <%=importManager.getImportedName("org.eclipse.emf.common.command.AbstractCommand")%> {
+ /**
+ * @generated
+ */
+ private final <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> childView;
+ /**
+ * @generated
+ */
+ private final <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parentView;
+
+ /**
+ * @generated
+ */
+ public RemoveNotationalElementCommand(<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> parentView, <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> childView) {
+ this.parentView = parentView;
+ this.childView = childView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ return parentView.getChildren().contains(childView);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canUndo() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void execute() {
+ parentView.removeChild(childView);
+ }
+
+ /**
+ * @generated
+ */
+ public void redo() {
+ execute();
+ }
+
+ /**
+ * @generated
+ */
+ public void undo() {
+ parentView.insertChild(childView);
+ }
+}
+<%importManager.emitSortedImports();%>