package hu.eltesoft.modelexecution.ide.debug.ui;

import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.moka.ui.presentation.AnimationUtils;

public class MokaAnimationBase {

	protected static final AnimationUtils UTILS = AnimationUtils.getInstance();

	public MokaAnimationBase() {
		super();
	}

	protected void openContainingDiagram(EObject element) {
		List<Diagram> diagrams = UTILS.getDiagrams(element);
		for (Diagram diagram : diagrams) {
			UTILS.openDiagram(diagram, false);
		}
	}

}
@@ -224,16 +224,57 @@
 nUtils;%0D
+%0Aimport org.eclipse.swt.widgets.Display;%0D
 %0A%0D%0Apubli
@@ -491,16 +491,59 @@
 ent) %7B%0D%0A
+%09%09Display.getDefault().asyncExec(() -%3E %7B%0D%0A%09
 %09%09List%3CD
@@ -596,44 +596,38 @@
 %0D%0A%09%09
-for (Diagram diagram : diagrams
+%09if (!diagrams.isEmpty()
 ) %7B%0D%0A
+%09
 %09%09%09U
@@ -650,16 +650,24 @@
 (diagram
+s.get(0)
 , false)
@@ -671,17 +671,25 @@
 se);%0D%0A%09%09
-%7D
+%09%7D%0D%0A%09%09%7D);
 %0D%0A%09%7D%0D%0A%0D%0A

Put opening diagrams to a UI thread