Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracuccuru2013-04-23 14:16:09 -0400
committeracuccuru2013-04-23 14:16:09 -0400
commitf70b0bba32e4d2813a0c2a9ed20213d7e07b7857 (patch)
tree9c498f6c282e46a9893d6670e9345ab97be740cd /sandbox
parent743b4ebef9f9ecf1a09be3f3d96906c3f4d78e2a (diff)
downloadorg.eclipse.papyrus-f70b0bba32e4d2813a0c2a9ed20213d7e07b7857.tar.gz
org.eclipse.papyrus-f70b0bba32e4d2813a0c2a9ed20213d7e07b7857.tar.xz
org.eclipse.papyrus-f70b0bba32e4d2813a0c2a9ed20213d7e07b7857.zip
405391: [Moka] Moka shall provide an implementation of the fUML Execution Model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405391 Comments + Minor changes
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java156
1 files changed, 153 insertions, 3 deletions
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java
index b0796075a3a..6bab2865426 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java
@@ -10,16 +10,34 @@ import org.eclipse.swt.graphics.Image;
public class FUMLThread extends MokaThread implements IPresentation {
+ /**
+ * Determines if this thread is terminated
+ */
protected boolean isTerminated = false ;
-
+
+ /**
+ * Determines if this thread is waiting
+ */
+ protected boolean isWaiting = false ;
+
+ /**
+ * The reason for suspending this thread,
+ * where -1 means that there is no reason to suspend this thread
+ */
protected int reasonForSuspending = -1 ;
+ /**
+ * The reason for resuming this thread
+ */
protected int reasonForResuming = DebugEvent.CLIENT_REQUEST ;
public FUMLThread(MokaDebugTarget debugTarget) {
super(debugTarget);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.ui.presentation.IPresentation#getLabel()
+ */
public String getLabel() {
String label = "" ;
try {
@@ -27,6 +45,9 @@ public class FUMLThread extends MokaThread implements IPresentation {
if (this.isTerminated()) {
label += "TERMINATED]" ;
}
+ else if (this.isWaiting()) {
+ label += "WAITING]" ;
+ }
else if (this.isStepping()) {
label += "STEPPING]" ;
}
@@ -43,39 +64,168 @@ public class FUMLThread extends MokaThread implements IPresentation {
return label ;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.ui.presentation.IPresentation#getDetails()
+ */
public String getDetails() {
- // TODO Auto-generated method stub
+ // Not applicable
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.ui.presentation.IPresentation#getImage()
+ */
public Image getImage() {
- // TODO Auto-generated method stub
+ // By returning null, default images are used
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#isTerminated()
+ */
@Override
public boolean isTerminated() {
return this.isTerminated ;
}
+ /**
+ * Returns true if is thread is in the Waiting state, false otherwise
+ *
+ * @return true if is thread is in the Waiting state, false otherwise
+ */
+ public boolean isWaiting() {
+ return this.isWaiting ;
+ }
+
+ /**
+ * Convenience method for determining if this thread terminated
+ *
+ * @param isTerminated
+ */
public void setIsTerminated(boolean isTerminated) {
this.isTerminated = isTerminated ;
}
+ /**
+ * Returns any reason for suspending this thread (e.g., CLIENT_REQUEST, BREAKPOINT, etc.),
+ * or -1 if no reason to suspend.
+ *
+ * @return any reason for suspending this thread, or -1 if no reason to suspend
+ */
public int getReasonForSuspending() {
return reasonForSuspending;
}
+ /**
+ * Convenience method for setting a reason to suspend this thread
+ *
+ * @param reasonForSuspending
+ */
public void setReasonForSuspending(int reasonForSuspending) {
this.reasonForSuspending = reasonForSuspending;
}
+ /**
+ * Returns the reason for resuming this thread
+ *
+ * @return the reason for resuming this thread
+ */
public int getReasonForResuming() {
return reasonForResuming;
}
+ /**
+ * Convenience method for setting the reason to resume this thread
+ *
+ * @param reasonForResuming
+ */
public void setReasonForResuming(int reasonForResuming) {
this.reasonForResuming = reasonForResuming;
}
+ /**
+ * Convenience method for determining if this thread is in the waiting state
+ *
+ * @param isWaiting
+ */
+ public void setIsWaiting(boolean isWaiting) {
+ this.isWaiting = isWaiting ;
+ }
+
+ /**
+ * Convenience method for determining if this thread is stepping
+ *
+ * @param isStepping
+ */
+ public void setIsStepping(boolean isStepping) {
+ this.isStepping = isStepping ;
+ }
+
+ /**
+ * Extended to account for the waiting state.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#canResume()
+ */
+ @Override
+ public boolean canResume() {
+ if (this.isWaiting)
+ return false ;
+ return super.canResume();
+ }
+
+ /**
+ * Extended to account for the waiting state.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#canSuspend()
+ */
+ @Override
+ public boolean canSuspend() {
+ if (this.isWaiting || this.isTerminated)
+ return false ;
+ return super.canSuspend();
+ }
+
+ /**
+ * Extended to account for the waiting state.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#canStepInto()
+ */
+ @Override
+ public boolean canStepInto() {
+ if (this.isWaiting)
+ return false ;
+ return super.canStepInto();
+ }
+
+ /**
+ * Extended to account for the waiting state.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#canStepOver()
+ */
+ @Override
+ public boolean canStepOver() {
+ if (this.isWaiting)
+ return false ;
+ return super.canStepOver();
+ }
+
+ /**
+ * Extended to account for the waiting state.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.papyrus.moka.debug.MokaThread#canStepReturn()
+ */
+ @Override
+ public boolean canStepReturn() {
+ if (this.isWaiting)
+ return false ;
+ return super.canStepReturn();
+ }
+
+
+
}

Back to the top