Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2014-05-07 05:30:54 +0000
committerEd Willink2014-05-07 05:30:54 +0000
commitb12dccec2a594db3d815529a32807304f296c788 (patch)
treef2aaaaa01b6c85be17ce6a00e9ddb44b9cb3c11b
parentdad4266ff24f2f587d6187860865ef0ade8c7f74 (diff)
downloadorg.eclipse.qvtd-b12dccec2a594db3d815529a32807304f296c788.tar.gz
org.eclipse.qvtd-b12dccec2a594db3d815529a32807304f296c788.tar.xz
org.eclipse.qvtd-b12dccec2a594db3d815529a32807304f296c788.zip
[422933] Improve stepping and presentation
-rw-r--r--plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/pages/QVTiDebugModelPresentation.java46
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiStepperVisitor.java17
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTbaseStepperVisitor.java87
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTcoreBaseStepperVisitor.java82
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java74
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/NonStepper.java36
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PrePostStepper.java36
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PreStepper.java36
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java80
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java129
10 files changed, 548 insertions, 75 deletions
diff --git a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/pages/QVTiDebugModelPresentation.java b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/pages/QVTiDebugModelPresentation.java
index c27d9336e..38539c3df 100644
--- a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/pages/QVTiDebugModelPresentation.java
+++ b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/pages/QVTiDebugModelPresentation.java
@@ -45,7 +45,6 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.FileEditorInput;
-
public class QVTiDebugModelPresentation implements IDebugModelPresentation, IDebugEditorPresentation, IDebugModelPresentationExtension, IColorProvider, ILabelProvider {
public QVTiDebugModelPresentation() {
@@ -56,9 +55,15 @@ public class QVTiDebugModelPresentation implements IDebugModelPresentation, IDeb
}
public Image getImage(Object element) {
-// System.out.println("getImage: " + element.getClass().getSimpleName() + " " + element);
- if (element instanceof VMStackFrame) {
- VMStackFrame frame = (VMStackFrame) element;
+ if (element instanceof VMDebugTarget) {
+ return QVTiDebugImages.getImage(QVTiDebugImages.TRANSFORMATION);
+ }
+ else if (element instanceof VMThread) {
+ return null;
+ }
+ else if (element instanceof VMStackFrame) {
+ return null;
+/* VMStackFrame frame = (VMStackFrame) element;
VMLocationData location = frame.getLocation();
String elementSignature = location.getElementSignature();
if (elementSignature != null) {
@@ -66,7 +71,7 @@ public class QVTiDebugModelPresentation implements IDebugModelPresentation, IDeb
}
else {
return QVTiDebugImages.getImage(QVTiDebugImages.TRANSFORMATION);
- }
+ } */
}
else if(element instanceof VMVariable) {
VMVariable var = (VMVariable) element;
@@ -111,17 +116,28 @@ public class QVTiDebugModelPresentation implements IDebugModelPresentation, IDeb
}
public String getText(Object element) {
-// System.out.println("getText: " + element.getClass().getSimpleName() + " " + element);
- if (element instanceof VMStackFrame) {
+ if (element instanceof VMDebugTarget) {
+ VMDebugTarget debugTarget = (VMDebugTarget) element;
+ String moduleName = debugTarget.getMainModuleName();
+ String launchConfigName = debugTarget.getLaunch().getLaunchConfiguration().getName();
+ return NLS.bind(DebugUIMessages.QVTiDebugModelPresentation_TransformationLabel, moduleName, launchConfigName);
+ }
+ else if (element instanceof VMThread) {
+ VMThread thread = (VMThread) element;
+ String name = "main"; //$NON-NLS-1$
+ String state = thread.isSuspended() ? DebugUIMessages.QVTiDebugModelPresentation_Suspended : DebugUIMessages.QVTiDebugModelPresentation_Running;
+ return MessageFormat.format(DebugUIMessages.QVTiDebugModelPresentation_ThreadLabel, name, state);
+ }
+ else if (element instanceof VMStackFrame) {
VMStackFrame frame = (VMStackFrame) element;
VMLocationData location = frame.getLocation();
String source = frame.getUnitURI().lastSegment();
int line = frame.getLineNumber();
StringBuilder s = new StringBuilder();
- s.append(location.getModule());
+// s.append(location.getModule());
String elementSignature = location.getElementSignature();
if (elementSignature != null) {
- s.append("::");
+// s.append("::");
s.append(elementSignature);
}
s.append(" - ");
@@ -130,18 +146,6 @@ public class QVTiDebugModelPresentation implements IDebugModelPresentation, IDeb
s.append(line);
return s.toString();
}
- else if (element instanceof VMThread) {
- VMThread thread = (VMThread) element;
- String name = "main"; //$NON-NLS-1$
- String state = thread.isSuspended() ? DebugUIMessages.QVTiDebugModelPresentation_Suspended : DebugUIMessages.QVTiDebugModelPresentation_Running;
- return MessageFormat.format(DebugUIMessages.QVTiDebugModelPresentation_ThreadLabel, name, state);
- }
- else if (element instanceof VMDebugTarget) {
- VMDebugTarget debugTarget = (VMDebugTarget) element;
- String moduleName = debugTarget.getMainModuleName();
- String launchConfigName = debugTarget.getLaunch().getLaunchConfiguration().getName();
- return NLS.bind(DebugUIMessages.QVTiDebugModelPresentation_TransformationLabel, moduleName, launchConfigName);
- }
return null;
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiStepperVisitor.java
deleted file mode 100644
index 3fae84f86..000000000
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiStepperVisitor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 E.D.Willink and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.debug.evaluator;
-
-import org.eclipse.ocl.examples.debug.stepper.OCLStepperVisitor;
-
-public class QVTiStepperVisitor extends OCLStepperVisitor {
-
-}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTbaseStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTbaseStepperVisitor.java
new file mode 100644
index 000000000..6113bb640
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTbaseStepperVisitor.java
@@ -0,0 +1,87 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2013 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * This code is auto-generated
+ * from: org.eclipse.qvtd.pivot.qvtbase/model/QVTbase.genmodel
+ *
+ * Do not edit it.
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.ocl.examples.debug.stepper.OCLStepperVisitor;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IStepper;
+import org.eclipse.qvtd.pivot.qvtbase.util.QVTbaseVisitor;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * An AbstractQVTbaseStepperVisitor provides a default implementation for each
+ * visitXxx method that delegates to the visitYyy method of the first
+ * super class, (or transitively its first super class' first super class
+ * until a non-interface super-class is found). In the absence of any
+ * suitable first super class, the method delegates to visiting().
+ */
+public abstract class AbstractQVTbaseStepperVisitor
+ extends OCLStepperVisitor
+ implements QVTbaseVisitor<IStepper>
+{
+ /**
+ * Initializes me with an initial value for my result.
+ *
+ * @param context my initial result value
+ */
+ protected AbstractQVTbaseStepperVisitor(@NonNull Object context) {
+ super();
+ }
+
+ public @Nullable IStepper visitBaseModel(@NonNull org.eclipse.qvtd.pivot.qvtbase.BaseModel object) {
+ return visitRoot(object);
+ }
+
+ public @Nullable IStepper visitDomain(@NonNull org.eclipse.qvtd.pivot.qvtbase.Domain object) {
+ return visitNamedElement(object);
+ }
+
+ public @Nullable IStepper visitFunction(@NonNull org.eclipse.qvtd.pivot.qvtbase.Function object) {
+ return visitOperation(object);
+ }
+
+ public @Nullable IStepper visitFunctionParameter(@NonNull org.eclipse.qvtd.pivot.qvtbase.FunctionParameter object) {
+ return visitParameter(object);
+ }
+
+ public @Nullable IStepper visitPattern(@NonNull org.eclipse.qvtd.pivot.qvtbase.Pattern object) {
+ return visitElement(object);
+ }
+
+ public @Nullable IStepper visitPredicate(@NonNull org.eclipse.qvtd.pivot.qvtbase.Predicate object) {
+ return visitElement(object);
+ }
+
+ public @Nullable IStepper visitRule(@NonNull org.eclipse.qvtd.pivot.qvtbase.Rule object) {
+ return visitNamedElement(object);
+ }
+
+ public @Nullable IStepper visitTransformation(@NonNull org.eclipse.qvtd.pivot.qvtbase.Transformation object) {
+ return visitClass(object);
+ }
+
+ public @Nullable IStepper visitTypedModel(@NonNull org.eclipse.qvtd.pivot.qvtbase.TypedModel object) {
+ return visitNamedElement(object);
+ }
+
+ public @Nullable IStepper visitUnit(@NonNull org.eclipse.qvtd.pivot.qvtbase.Unit object) {
+ return visitNamedElement(object);
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTcoreBaseStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTcoreBaseStepperVisitor.java
new file mode 100644
index 000000000..96e4701f1
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTcoreBaseStepperVisitor.java
@@ -0,0 +1,82 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2013 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * This code is auto-generated
+ * from: org.eclipse.qvtd.pivot.qvtcorebase/model/QVTcoreBase.genmodel
+ *
+ * Do not edit it.
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IStepper;
+import org.eclipse.qvtd.pivot.qvtcorebase.util.QVTcoreBaseVisitor;
+
+/**
+ * An AbstractQVTcoreBaseStepperVisitor provides a default implementation for each
+ * visitXxx method that delegates to the visitYyy method of the first
+ * super class, (or transitively its first super class' first super class
+ * until a non-interface super-class is found). In the absence of any
+ * suitable first super class, the method delegates to visiting().
+ */
+public abstract class AbstractQVTcoreBaseStepperVisitor
+ extends AbstractQVTbaseStepperVisitor
+ implements QVTcoreBaseVisitor<IStepper>
+{
+ /**
+ * Initializes me with an initial value for my result.
+ *
+ * @param context my initial result value
+ */
+ protected AbstractQVTcoreBaseStepperVisitor(@NonNull Object context) {
+ super(context);
+ }
+
+ public @Nullable IStepper visitAssignment(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.Assignment object) {
+ return visitElement(object);
+ }
+
+ public @Nullable IStepper visitBottomPattern(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.BottomPattern object) {
+ return visitCorePattern(object);
+ }
+
+ public @Nullable IStepper visitCoreDomain(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.CoreDomain object) {
+ return visitDomain(object);
+ }
+
+ public @Nullable IStepper visitCorePattern(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.CorePattern object) {
+ return visitPattern(object);
+ }
+
+ public @Nullable IStepper visitEnforcementOperation(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.EnforcementOperation object) {
+ return visitElement(object);
+ }
+
+ public @Nullable IStepper visitGuardPattern(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.GuardPattern object) {
+ return visitCorePattern(object);
+ }
+
+ public @Nullable IStepper visitPropertyAssignment(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.PropertyAssignment object) {
+ return visitAssignment(object);
+ }
+
+ public @Nullable IStepper visitRealizedVariable(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.RealizedVariable object) {
+ return visitVariable(object);
+ }
+
+ public @Nullable IStepper visitVariableAssignment(@NonNull org.eclipse.qvtd.pivot.qvtcorebase.VariableAssignment object) {
+ return visitAssignment(object);
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java
new file mode 100644
index 000000000..b87218670
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java
@@ -0,0 +1,74 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2013 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * This code is auto-generated
+ * from: org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.genmodel
+ *
+ * Do not edit it.
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IStepper;
+import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
+
+/**
+ * An AbstractQVTimperativeStepperVisitor provides a default implementation for each
+ * visitXxx method that delegates to the visitYyy method of the first
+ * super class, (or transitively its first super class' first super class
+ * until a non-interface super-class is found). In the absence of any
+ * suitable first super class, the method delegates to visiting().
+ */
+public abstract class AbstractQVTimperativeStepperVisitor
+ extends AbstractQVTcoreBaseStepperVisitor
+ implements QVTimperativeVisitor<IStepper>
+{
+ /**
+ * Initializes me with an initial value for my result.
+ *
+ * @param context my initial result value
+ */
+ protected AbstractQVTimperativeStepperVisitor(@NonNull Object context) {
+ super(context);
+ }
+
+ public @Nullable IStepper visitImperativeModel(@NonNull org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel object) {
+ return visitBaseModel(object);
+ }
+
+ public @Nullable IStepper visitMapping(@NonNull org.eclipse.qvtd.pivot.qvtimperative.Mapping object) {
+ return visitRule(object);
+ }
+
+ public @Nullable IStepper visitMappingCall(@NonNull org.eclipse.qvtd.pivot.qvtimperative.MappingCall object) {
+ return visitOCLExpression(object);
+ }
+
+ public @Nullable IStepper visitMappingCallBinding(@NonNull org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding object) {
+ return visitElement(object);
+ }
+
+ public @Nullable IStepper visitMiddlePropertyAssignment(@NonNull org.eclipse.qvtd.pivot.qvtimperative.MiddlePropertyAssignment object) {
+ return visitPropertyAssignment(object);
+ }
+
+ public @Nullable IStepper visitMiddlePropertyCallExp(@NonNull org.eclipse.qvtd.pivot.qvtimperative.MiddlePropertyCallExp object) {
+ return visitOppositePropertyCallExp(object);
+ }
+
+ public @Nullable IStepper visitVariablePredicate(@NonNull org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate object) {
+ return visitPredicate(object);
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/NonStepper.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/NonStepper.java
new file mode 100644
index 000000000..5d90cf404
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/NonStepper.java
@@ -0,0 +1,36 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2014 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.stepper.AbstractStepper;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IRootVMEvaluationVisitor;
+import org.eclipse.ocl.examples.pivot.Element;
+
+public class NonStepper extends AbstractStepper
+{
+ public static @NonNull NonStepper INSTANCE = new NonStepper();
+
+ @Override
+ public @Nullable Element isPostStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element childElement, @Nullable Element parentElement) {
+ return null;
+ }
+
+ @Override
+ public boolean isPreStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element element) {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PrePostStepper.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PrePostStepper.java
new file mode 100644
index 000000000..e6230d9a9
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PrePostStepper.java
@@ -0,0 +1,36 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2014 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.stepper.AbstractStepper;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IRootVMEvaluationVisitor;
+import org.eclipse.ocl.examples.pivot.Element;
+
+public class PrePostStepper extends AbstractStepper
+{
+ public static @NonNull PrePostStepper INSTANCE = new PrePostStepper();
+
+ @Override
+ public @Nullable Element isPostStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element childElement, @Nullable Element parentElement) {
+ return childElement;
+ }
+
+ @Override
+ public boolean isPreStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element element) {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PreStepper.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PreStepper.java
new file mode 100644
index 000000000..d46440304
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/PreStepper.java
@@ -0,0 +1,36 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2014 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.stepper.AbstractStepper;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IRootVMEvaluationVisitor;
+import org.eclipse.ocl.examples.pivot.Element;
+
+public class PreStepper extends AbstractStepper
+{
+ public static @NonNull PreStepper INSTANCE = new PreStepper();
+
+ @Override
+ public @Nullable Element isPostStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element childElement, @Nullable Element parentElement) {
+ return null;
+ }
+
+ @Override
+ public boolean isPreStoppable(@NonNull IRootVMEvaluationVisitor<?> rootVMEvaluationVisitor, @NonNull Element element) {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java
new file mode 100644
index 000000000..51bf42e98
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2014 E.D.Willink and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.qvtd.debug.stepper;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.debug.stepper.OCLStepperVisitor;
+import org.eclipse.ocl.examples.debug.stepper.PostStepper;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IStepper;
+import org.eclipse.qvtd.pivot.qvtbase.Domain;
+import org.eclipse.qvtd.pivot.qvtbase.Predicate;
+import org.eclipse.qvtd.pivot.qvtbase.Transformation;
+import org.eclipse.qvtd.pivot.qvtcorebase.Assignment;
+import org.eclipse.qvtd.pivot.qvtcorebase.BottomPattern;
+import org.eclipse.qvtd.pivot.qvtcorebase.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtcorebase.RealizedVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
+import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
+
+public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
+{
+ public static @NonNull OCLStepperVisitor INSTANCE = new QVTiStepperVisitor(QVTiStepperVisitor.class);
+
+ protected QVTiStepperVisitor(@NonNull Object context) {
+ super(context);
+ }
+
+ @Override
+ public @Nullable IStepper visitAssignment(@NonNull Assignment object) {
+ return PostStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitBottomPattern(@NonNull BottomPattern object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitDomain(@NonNull Domain object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitGuardPattern(@NonNull GuardPattern object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitMapping(@NonNull Mapping object) {
+ return PreStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitMappingCall(@NonNull MappingCall object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitPredicate(@NonNull Predicate object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitRealizedVariable(@NonNull RealizedVariable object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitTransformation(@NonNull Transformation object) {
+ return PrePostStepper.INSTANCE;
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
index 40885df98..4854a19c9 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
@@ -14,7 +14,9 @@ package org.eclipse.qvtd.debug.vm;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.debug.vm.UnitLocation;
import org.eclipse.ocl.examples.debug.vm.VMVirtualMachine;
import org.eclipse.ocl.examples.debug.vm.VariableFinder;
@@ -22,17 +24,101 @@ import org.eclipse.ocl.examples.debug.vm.data.VMStackFrameData;
import org.eclipse.ocl.examples.debug.vm.data.VMVariableData;
import org.eclipse.ocl.examples.debug.vm.evaluator.IVMEvaluationEnvironment;
import org.eclipse.ocl.examples.debug.vm.launching.DebuggableRunner;
-import org.eclipse.ocl.examples.pivot.NamedElement;
+import org.eclipse.ocl.examples.pivot.Constraint;
+import org.eclipse.ocl.examples.pivot.Element;
+import org.eclipse.ocl.examples.pivot.Feature;
import org.eclipse.ocl.examples.pivot.Operation;
import org.eclipse.ocl.examples.pivot.Parameter;
import org.eclipse.ocl.examples.pivot.Root;
import org.eclipse.ocl.examples.pivot.Type;
import org.eclipse.qvtd.debug.core.QVTiDebugCore;
import org.eclipse.qvtd.debug.core.QVTiEvaluationContext;
+import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
+import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
public class QVTiVMVirtualMachine extends VMVirtualMachine
{
+ private static boolean appendElementSignature(@NonNull StringBuilder s, @Nullable EObject eObject) {
+ if (eObject instanceof Root) {
+ return false;
+ }
+ else if (eObject instanceof org.eclipse.ocl.examples.pivot.Package) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((org.eclipse.ocl.examples.pivot.Package)eObject).getName());
+ return true;
+ }
+ else if (eObject instanceof Type) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((Type)eObject).getName());
+ return true;
+ }
+ else if (eObject instanceof Mapping) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((Mapping)eObject).getName());
+ return true;
+ }
+ else if (eObject instanceof Domain) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((Domain)eObject).getName());
+ return true;
+ }
+ else if (eObject instanceof MappingCall) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((MappingCall)eObject).getReferredMapping().getName());
+ return true;
+ }
+ else if (eObject instanceof Operation) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ Operation operation = (Operation)eObject;
+ s.append(operation.getName());
+ s.append("(");
+ boolean isFirst = true;;
+ for (Parameter param : operation.getOwnedParameter()) {
+ if (!isFirst) {
+ s.append(", ");
+ }
+ Type type = param.getType();
+ s.append(type.getName());
+ isFirst = false;
+ }
+ s.append(")");
+ return true;
+ }
+ else if (eObject instanceof Feature) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((Feature)eObject).getName());
+ return true;
+ }
+ else if (eObject instanceof Constraint) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append("::");
+ }
+ s.append(((Constraint)eObject).getName());
+ return true;
+ }
+ else if (eObject != null) {
+ return appendElementSignature(s, eObject.eContainer());
+ }
+ else {
+ return false;
+ }
+ }
+
public static @NonNull VMStackFrameData[] createStackFrame(List<UnitLocation> stack) {
List<VMStackFrameData> result = new ArrayList<VMStackFrameData>();
@@ -50,15 +136,16 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
public VMStackFrameData createStackFrame(@NonNull UnitLocation location) {
return createStackFrame(location, true);
}
-
+
private static @NonNull VMStackFrameData createStackFrame(@NonNull UnitLocation location, boolean includeVars) {
IVMEvaluationEnvironment<?> evalEnv = location.getEvalEnv();
Root module = location.getModule();
String moduleName = (module != null) ? module.getName() : "<null>"; //$NON-NLS-1$
- NamedElement operation = location.getOperation();
- String operSignature = (operation != null) ? getElementSignature(operation)
- : null; //MessageFormat.format("<{0}>", moduleName); //$NON-NLS-1$
+ Element element = location.getElement();
+ StringBuilder s = new StringBuilder();
+ appendElementSignature(s, element);
+ String operSignature = s.toString(); //MessageFormat.format("<{0}>", moduleName); //$NON-NLS-1$
List<VMVariableData> vars = VariableFinder.getVariables(evalEnv);
VMStackFrameData vmStackFrame = new VMStackFrameData(evalEnv.getID(), location.getURI().toString(), moduleName,
@@ -67,38 +154,6 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
}
- private static String getElementSignature(NamedElement operation) {
- StringBuilder buf = new StringBuilder();
-
- buf.append(operation.getName());
- buf.append('(');
- if (operation instanceof Operation) {
- boolean isFirst = true;;
- for (Parameter param : ((Operation)operation).getOwnedParameter()) {
- if (!isFirst) {
- buf.append(", ");
- }
- Type type = param.getType();
- buf.append(type.getName());
- isFirst = false;
- }
- }
- else if (operation instanceof Mapping) {
-/* boolean isFirst = true;;
- for (Variable param : ((Mapping)operation).getAllVariables()) {
- if (!isFirst) {
- buf.append(", ");
- }
- Type type = param.getType();
- buf.append(type.getName());
- isFirst = false;
- } */
- }
- buf.append(')');
-
- return buf.toString();
- }
-
public QVTiVMVirtualMachine(@NonNull DebuggableRunner runner, @NonNull QVTiEvaluationContext evaluationContext) {
super(runner, runner.createDebuggableAdapter(evaluationContext));
}

Back to the top