瀏覽代碼

Bugfix: Undo SubdiagramRefactoring

Andreas Mülder 12 年之前
父節點
當前提交
544d3f345a

+ 10 - 1
plugins/org.yakindu.sct.refactoring/src/org/yakindu/sct/refactoring/refactor/impl/ExtractSubdiagramRefactoring.java

@@ -72,7 +72,16 @@ public class ExtractSubdiagramRefactoring extends AbstractRefactoring<View> {
 
 	@Override
 	protected boolean internalDoUndo() {
-		return DiagramPartitioningUtil.closeSubdiagramEditors((State) subdiagram.getElement());
+		boolean close = DiagramPartitioningUtil.closeSubdiagramEditors((State) subdiagram.getElement());
+		if (!close)
+			return false;
+		// Since the canonical edit policy creates edges for the semantic
+		// transitions and it is not done within the TransactionalCommand we
+		// have to delete the created edges manually when undo is executed.
+		while (subdiagram.getEdges().size() > 0) {
+			EcoreUtil.delete((EObject) subdiagram.getEdges().get(0));
+		}
+		return true;
 	}
 
 	@SuppressWarnings("unchecked")