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

(-)src-templates/org/eclipse/gmf/codegen/templates/lite/commands/RemoveNotationalElementCommandGenerator.java (-1 / +1 lines)
Lines 29-35 Link Here
29
  protected final String TEXT_13 = " next = (";
29
  protected final String TEXT_13 = " next = (";
30
  protected final String TEXT_14 = ") it.next();" + NL + "\t\t\tremoveEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));" + NL + "\t\t}" + NL + "\t\tfor(Iterator it = childView.getTargetEdges().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
30
  protected final String TEXT_14 = ") it.next();" + NL + "\t\t\tremoveEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));" + NL + "\t\t}" + NL + "\t\tfor(Iterator it = childView.getTargetEdges().iterator(); it.hasNext(); ) {" + NL + "\t\t\t";
31
  protected final String TEXT_15 = " next = (";
31
  protected final String TEXT_15 = " next = (";
32
  protected final String TEXT_16 = ") it.next();" + NL + "\t\t\tremoveEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));" + NL + "\t\t}" + NL + "\t\treturn removeEdgeCommands.canExecute();" + 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\tremoveEdgeCommands.execute();" + NL + "\t\tsweepElement();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void sweepElement() {" + NL + "\t\tif (childView.isSetElement()) {" + NL + "\t\t\tdomainElement = childView.getElement();" + NL + "\t\t\tchildView.setElement(null);" + NL + "\t\t}" + 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\trestoreElement();" + NL + "\t\tremoveEdgeCommands.undo();" + NL + "\t\tparentView.insertChild(childView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void restoreElement() {" + NL + "\t\tif (childView.isSetElement()) {" + NL + "\t\t\tchildView.setElement(domainElement);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected final ";
32
  protected final String TEXT_16 = ") it.next();" + NL + "\t\t\tremoveEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));" + NL + "\t\t}" + NL + "\t\tif (removeEdgeCommands.isEmpty()) {" + NL + "\t\t\treturn true;" + NL + "\t\t}" + NL + "\t\treturn removeEdgeCommands.canExecute();" + 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\tif (!removeEdgeCommands.isEmpty()) {" + NL + "\t\t\tremoveEdgeCommands.execute();" + NL + "\t\t}" + NL + "\t\tsweepElement();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void sweepElement() {" + NL + "\t\tif (childView.isSetElement()) {" + NL + "\t\t\tdomainElement = childView.getElement();" + NL + "\t\t\tchildView.setElement(null);" + NL + "\t\t}" + 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\trestoreElement();" + NL + "\t\tremoveEdgeCommands.undo();" + NL + "\t\tparentView.insertChild(childView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void restoreElement() {" + NL + "\t\tif (childView.isSetElement()) {" + NL + "\t\t\tchildView.setElement(domainElement);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected final ";
33
  protected final String TEXT_17 = " getChildView() {" + NL + "\t\treturn childView;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected final ";
33
  protected final String TEXT_17 = " getChildView() {" + NL + "\t\treturn childView;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected final ";
34
  protected final String TEXT_18 = " getParent() {" + NL + "\t\treturn parentView;" + NL + "\t}" + NL + "}";
34
  protected final String TEXT_18 = " getParent() {" + NL + "\t\treturn parentView;" + NL + "\t}" + NL + "}";
35
  protected final String TEXT_19 = NL;
35
  protected final String TEXT_19 = NL;
(-)templates/commands/RemoveNotationalElementCommand.javajet (-1 / +6 lines)
Lines 57-62 Link Here
57
			<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%> next = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%>) it.next();
57
			<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%> next = (<%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.Edge")%>) it.next();
58
			removeEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));
58
			removeEdgeCommands.append(new RemoveNotationalEdgeCommand(childView.getDiagram(), next));
59
		}
59
		}
60
		if (removeEdgeCommands.isEmpty()) {
61
			return true;
62
		}
60
		return removeEdgeCommands.canExecute();
63
		return removeEdgeCommands.canExecute();
61
	}
64
	}
62
65
Lines 72-78 Link Here
72
	 */
75
	 */
73
	public void execute() {
76
	public void execute() {
74
		parentView.removeChild(childView);
77
		parentView.removeChild(childView);
75
		removeEdgeCommands.execute();
78
		if (!removeEdgeCommands.isEmpty()) {
79
			removeEdgeCommands.execute();
80
		}
76
		sweepElement();
81
		sweepElement();
77
	}
82
	}
78
83

Return to bug 152851