Skip to main content
summaryrefslogtreecommitdiffstats
blob: 59a3010c294814e5041ed2f87e47f69b854e88f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package org.eclipse.papyrus.moka.fuml.debug;

import org.eclipse.debug.core.DebugException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.moka.debug.MokaDebugTarget;
import org.eclipse.papyrus.moka.debug.MokaStackFrame;
import org.eclipse.papyrus.moka.debug.MokaThread;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.CallBehaviorAction;
import org.eclipse.uml2.uml.CallOperationAction;

public class FumlThread extends MokaThread {

	public FumlThread(MokaDebugTarget debugTarget) {
		super(debugTarget);
	}

	@Override
	public boolean canStepInto() {
		boolean canStepInto = super.canStepInto() ;
		if (canStepInto) {
			try {
				MokaStackFrame topStackFrame = (MokaStackFrame)this.getTopStackFrame() ;
				EObject modelElement = topStackFrame.getModelElement() ;
				if (modelElement instanceof CallOperationAction) {
					CallOperationAction action = (CallOperationAction)modelElement ;
					canStepInto = action.getOperation().getMethods().get(0) instanceof Activity ;
				}
				else if (modelElement instanceof CallBehaviorAction) {
					CallBehaviorAction action = (CallBehaviorAction)modelElement ;
					canStepInto = action.getBehavior() instanceof Activity ;
				}
				else {
					canStepInto = false ;
				}
			} catch (DebugException e) {
				canStepInto = false ;
			} catch (NullPointerException e) {
				canStepInto = false ;
			}
		}
		return canStepInto ;
	}
	
}

Back to the top