diff options
author | Matthias Tichy | 2018-08-29 09:14:04 +0000 |
---|---|---|
committer | Matthias Tichy | 2019-07-09 11:20:43 +0000 |
commit | 633d1b087dda7b01deb06df8c361450acae92aeb (patch) | |
tree | aea040157bcd36c114243d6dddeab66c89ae8e32 | |
parent | 894b9373ebcaf341a08b38eaa5a0e62ddf710e2c (diff) | |
download | org.eclipse.emft.henshin-633d1b087dda7b01deb06df8c361450acae92aeb.tar.gz org.eclipse.emft.henshin-633d1b087dda7b01deb06df8c361450acae92aeb.tar.xz org.eclipse.emft.henshin-633d1b087dda7b01deb06df8c361450acae92aeb.zip |
constraint type and instance breakpoints
9 files changed, 376 insertions, 34 deletions
diff --git a/plugins/org.eclipse.emf.henshin.interpreter.ui/plugin.xml b/plugins/org.eclipse.emf.henshin.interpreter.ui/plugin.xml index 5e97f5a1e..5ce612965 100644 --- a/plugins/org.eclipse.emf.henshin.interpreter.ui/plugin.xml +++ b/plugins/org.eclipse.emf.henshin.interpreter.ui/plugin.xml @@ -88,6 +88,28 @@ </parameter> </defaultHandler> </command> + <command + id="org.eclipse.emf.henshin.interpreter.ui.wizard.add.ConstraintTypeBreakpoint" + name="Add Constraint Type Breakpoint"> + <defaultHandler + class="org.eclipse.emf.henshin.interpreter.ui.handlers.AddConstraintTypeBreakpoint"> + <parameter + name="org.eclipse.emf.henshin.interpreter.ui.parameter1" + value="org.eclipse.emf.henshin.interpreter.ui.parameter1"> + </parameter> + </defaultHandler> + </command> + <command + id="org.eclipse.emf.henshin.interpreter.ui.wizard.add.ConstraintInstanceBreakpoint" + name="Add Constraint Instance Breakpoint"> + <defaultHandler + class="org.eclipse.emf.henshin.interpreter.ui.handlers.AddConstraintInstanceBreakpoint"> + <parameter + name="org.eclipse.emf.henshin.interpreter.ui.parameter2" + value="org.eclipse.emf.henshin.interpreter.ui.parameter2"> + </parameter> + </defaultHandler> + </command> </extension> <!-- <extension @@ -262,6 +284,18 @@ label="Add Variable Breakpoint" menubarPath="org.eclipse.emf.henshin.interpreter.ui.menu1/group1"> </action> + <action + class="org.eclipse.emf.henshin.interpreter.ui.handlers.AddConstraintTypeBreakpoint" + id="org.eclipse.emf.henshin.interpreter.ui.addConstraintTypeBreakpoint" + label="Add Constraint Type Breakpoint" + menubarPath="org.eclipse.emf.henshin.interpreter.ui.menu1/group1"> + </action> + <action + class="org.eclipse.emf.henshin.interpreter.ui.handlers.AddConstraintInstanceBreakpoint" + id="org.eclipse.emf.henshin.interpreter.ui.addConstraintInstanceBreakpoint" + label="Add Constraint Instance Breakpoint" + menubarPath="org.eclipse.emf.henshin.interpreter.ui.menu1/group1"> + </action> </objectContribution> </extension> <extension @@ -307,6 +341,16 @@ id="org.eclipse.emf.henshin.model" markerType="org.eclipse.emf.henshin.interpreter.matching.conditions.VariableBreakpoint"> </breakpoint> + <breakpoint + class="org.eclipse.emf.henshin.interpreter.matching.conditions.ConstraintTypeBreakpoint" + id="org.eclipse.emf.henshin.model" + markerType="org.eclipse.emf.henshin.interpreter.matching.conditions.ConstraintTypeBreakpoint"> + </breakpoint> + <breakpoint + class="org.eclipse.emf.henshin.interpreter.matching.conditions.ConstraintInstanceBreakpoint" + id="org.eclipse.emf.henshin.model" + markerType="org.eclipse.emf.henshin.interpreter.matching.conditions.ConstraintInstanceBreakpoint"> + </breakpoint> </extension> <extension point="org.eclipse.debug.ui.debugModelPresentations"> diff --git a/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintInstanceBreakpoint.java b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintInstanceBreakpoint.java new file mode 100644 index 000000000..beb8c0acb --- /dev/null +++ b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintInstanceBreakpoint.java @@ -0,0 +1,48 @@ +package org.eclipse.emf.henshin.interpreter.ui.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.debug.core.DebugException; +import org.eclipse.emf.henshin.interpreter.debug.DebugValueObject; +import org.eclipse.emf.henshin.interpreter.debug.HenshinDebugVariable; +import org.eclipse.emf.henshin.interpreter.matching.conditions.DebugApplicationCondition; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IActionDelegate; + +public class AddConstraintInstanceBreakpoint extends AbstractHandler implements IActionDelegate { + + private HenshinDebugVariable var; + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void run(IAction action) { + // get the current variable and set a breakpoint for it + if (var != null) { + DebugValueObject value; + try { + value = (DebugValueObject)var.getValue(); + DebugApplicationCondition.getInstance().setConstraintInstanceBreakpoint(value.getValueString()); + } catch (DebugException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + var = (HenshinDebugVariable) structuredSelection.getFirstElement(); + + action.setEnabled(var != null && var.isConstraint()); + } + +} diff --git a/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintTypeBreakpoint.java b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintTypeBreakpoint.java new file mode 100644 index 000000000..3f4802fab --- /dev/null +++ b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddConstraintTypeBreakpoint.java @@ -0,0 +1,48 @@ +package org.eclipse.emf.henshin.interpreter.ui.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.debug.core.DebugException; +import org.eclipse.emf.henshin.interpreter.debug.DebugValueObject; +import org.eclipse.emf.henshin.interpreter.debug.HenshinDebugVariable; +import org.eclipse.emf.henshin.interpreter.matching.conditions.DebugApplicationCondition; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IActionDelegate; + +public class AddConstraintTypeBreakpoint extends AbstractHandler implements IActionDelegate { + + private HenshinDebugVariable var; + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void run(IAction action) { + // get the current variable and set a breakpoint for it + if (var != null) { + DebugValueObject value; + try { + value = (DebugValueObject)var.getValue(); + DebugApplicationCondition.getInstance().setConstraintTypeBreakpoint(value.getValueString().toUpperCase()); + } catch (DebugException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + var = (HenshinDebugVariable) structuredSelection.getFirstElement(); + + action.setEnabled(var != null && var.isConstraintType()); + } + +} diff --git a/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddValueBreakpoint.java b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddValueBreakpoint.java index a7286b4fb..94ed5535b 100644 --- a/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddValueBreakpoint.java +++ b/plugins/org.eclipse.emf.henshin.interpreter.ui/src/org/eclipse/emf/henshin/interpreter/ui/handlers/AddValueBreakpoint.java @@ -12,7 +12,6 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IActionDelegate; -import org.eclipse.ui.internal.PluginAction; public class AddValueBreakpoint extends AbstractHandler implements IActionDelegate { diff --git a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/DebugValueObject.java b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/DebugValueObject.java index 9fdbea333..f5a6012c0 100644 --- a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/DebugValueObject.java +++ b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/DebugValueObject.java @@ -12,7 +12,7 @@ public class DebugValueObject extends HenshinDebugValue { public DebugValueObject(IDebugTarget target, EGraph graph, String declaredType, Object value, int indexInDomain) { super(target, graph, declaredType); - // neede to set value breakpoint + // needed to set value breakpoint this.indexInDomain = indexInDomain; valueString = value.toString(); diff --git a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/HenshinDebugVariable.java b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/HenshinDebugVariable.java index dd0b7f8ce..9b5e54f34 100644 --- a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/HenshinDebugVariable.java +++ b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/debug/HenshinDebugVariable.java @@ -12,6 +12,8 @@ public class HenshinDebugVariable extends HenshinDebugElement implements IVariab private String name; private HenshinDebugValue value; private Variable variable; + private final boolean isConstraintType; + private final boolean isConstraint; /** * for a variable with a primitive / human readable value @@ -32,6 +34,16 @@ public class HenshinDebugVariable extends HenshinDebugElement implements IVariab super(target); this.name = name; this.value = value; + isConstraintType = "Constraint Type".equals(name); + isConstraint = "Constraint".equals(name); + } + + public boolean isConstraint() { + return isConstraint; + } + + public boolean isConstraintType() { + return isConstraintType; } public Variable getVariable() { diff --git a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintInstanceBreakpoint.java b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintInstanceBreakpoint.java new file mode 100644 index 000000000..8ed1cb39a --- /dev/null +++ b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintInstanceBreakpoint.java @@ -0,0 +1,32 @@ +package org.eclipse.emf.henshin.interpreter.matching.conditions; + +import org.eclipse.core.runtime.CoreException; + +public class ConstraintInstanceBreakpoint extends HenshinBreakpoint { + + /** + * Retrieve the brekpoint's type. (type of the value we set the breakpoint for) + * @return + */ + public String getConstraintInstance() { + return getAttribute("ConstraintInstance", ""); + } + + public void setConstraintInstance(String constraintInstance) { + try { + setAttribute("ConstraintInstance", constraintInstance); + updateMessage(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Updates the message (label of the breakpoint in the debug view). + */ + private void updateMessage() { + setMessage("Constraint instance breakpoint on '" + getConstraintInstance() + "'"); + } + +} diff --git a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintTypeBreakpoint.java b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintTypeBreakpoint.java new file mode 100644 index 000000000..6ac464554 --- /dev/null +++ b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/ConstraintTypeBreakpoint.java @@ -0,0 +1,37 @@ +package org.eclipse.emf.henshin.interpreter.matching.conditions; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.henshin.interpreter.matching.conditions.DebugApplicationCondition.ConstraintType; + +public class ConstraintTypeBreakpoint extends HenshinBreakpoint { + + /** + * Retrieve the brekpoint's type. (type of the value we set the breakpoint for) + * @return + */ + public ConstraintType getType() { + return ConstraintType.valueOf(getAttribute("Type", ConstraintType.NONE.toString())); + } + + /** + * Set the type string (type of value) of the breakpoint to be represented in the debugger ui. + * @param type + */ + public void setType(ConstraintType type) { + try { + setAttribute("Type", type.name()); + updateMessage(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Updates the message (label of the breakpoint in the debug view). + */ + private void updateMessage() { + setMessage("Constraint type breakpoint on '" + getType() + "'"); + } + +} diff --git a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/DebugApplicationCondition.java b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/DebugApplicationCondition.java index 3ce951377..02f565401 100644 --- a/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/DebugApplicationCondition.java +++ b/plugins/org.eclipse.emf.henshin.interpreter/src/org/eclipse/emf/henshin/interpreter/matching/conditions/DebugApplicationCondition.java @@ -242,13 +242,7 @@ public class DebugApplicationCondition extends ApplicationCondition { if (debugTarget != null) { debugTarget.fireChangeEvent(DebugEvent.CONTENT); debugTarget.fireSuspendEvent(DebugEvent.STEP_END); - } - - // TODO: Remove code below when using eclipse extension to set henshin breakpoints via GUI - // set sample constraint type breakpoint -// if (getHenshinBreakpoints().size() <= 0) { -// setVariableBreakpoint(); -// } + } } /** @@ -448,7 +442,7 @@ public class DebugApplicationCondition extends ApplicationCondition { public void suspend() throws DebugException { synchronized (this) { setCurrentDebugState(DebugState.SUSPENDED); - } + } } public boolean canStep() { @@ -556,10 +550,7 @@ public class DebugApplicationCondition extends ApplicationCondition { String currentNodePath = EcoreUtil.getRelativeURIFragmentPath(null, currentNode); // get the current type constraint to compare in shouldStopAtVariableBreakpoint later String currentTypeName = currentVariable.typeConstraint.type.getName(); - - // also consider comparing to name of the node - // String currentNodeName = currentNode.getName(); - + // handle variable breakpoints ArrayList<VariableBreakpoint> variableBreakpoints = filterVariableBreakpoints(henshinBreakpoints); if (variableBreakpoints.size() > 0 && currentDebugLevel == DebugLevel.VARIABLE) { @@ -571,7 +562,7 @@ public class DebugApplicationCondition extends ApplicationCondition { } } - // value breakpoints + // handle value breakpoints if (currentSlot.getValue() != null) { // get complete domain (e.g. domain for :Client could be 'charles', 'bob', 'alice') List<EObject> domain = graph.getDomain(currentSlot.getValue().eClass(), false); @@ -592,20 +583,25 @@ public class DebugApplicationCondition extends ApplicationCondition { } } + // handle constraint type breakpoints + ArrayList<ConstraintTypeBreakpoint> constraintTypeBreakpoints = filterConstraintTypeBreakpoints(henshinBreakpoints); + if (constraintTypeBreakpoints.size() > 0 && currentDebugLevel == DebugLevel.CONSTRAINT_TYPE) { + for (ConstraintTypeBreakpoint constraintTypeBreakpoint : constraintTypeBreakpoints) { + if (shouldStopAtConstraintTypeBreakpoint(constraintTypeBreakpoint)) { + suspendApplication(); + } + } + } - // handle value breakpoints -// TreeIterator<EObject> allContents = ruleInfo.getRule().eResource().getAllContents(); - - // code from TransformOperation.java -// ResourceSet resourceSet; -// if (unit.eResource() != null && unit.eResource().getResourceSet() != null) { -// resourceSet = unit.eResource().getResourceSet(); -// } else { -// resourceSet = new ResourceSetImpl(); -// } -// -// -// Resource input = resourceSet.getResource(inputUri, true); + // handle constraint instance breakpoints + ArrayList<ConstraintInstanceBreakpoint> constraintInstanceBreakpoints = filterConstraintInstanceBreakpoints(henshinBreakpoints); + if (constraintInstanceBreakpoints.size() > 0 && currentDebugLevel == DebugLevel.CONSTRAINT) { + for (ConstraintInstanceBreakpoint constraintInstanceBreakpoint : constraintInstanceBreakpoints) { + if (shouldStopAtConstraintInstanceBreakpoint(constraintInstanceBreakpoint)) { + suspendApplication(); + } + } + } if (debugTarget != null) { debugTarget.fireSuspendEvent(DebugEvent.STEP_END); @@ -911,6 +907,60 @@ public void stepReturn() throws DebugException { } } + public void setConstraintTypeBreakpoint(String constraintType) { + // get all breakpoints + IBreakpointManager manager = getManager(); + // create breakpoint + IFile moduleFile = debugTarget.getModuleFile(); + IMarker marker = HenshinMarkerNavigationProvider.addMarker(moduleFile, HenshinModelPlugin.PLUGIN_ID, "/constraintType", "Sample ConstraintTypeBreakpoint", IStatus.OK); + ConstraintTypeBreakpoint breakpoint = new ConstraintTypeBreakpoint(); + try { + // set marker for breakpoint + breakpoint.setMarker(marker); + breakpoint.setEnabled(true); + // configure breakpoint + breakpoint.setType(ConstraintType.valueOf(constraintType)); + breakpoint.setDebugLevel(DebugLevel.CONSTRAINT_TYPE); + // add breakpoint to manager to keep track + manager.addBreakpoint(breakpoint); + } catch (CoreException e1) { + System.out.println("Unable to create custom ConstraintTypeBreakpoint."); + e1.printStackTrace(); + } + } + + public void setConstraintInstanceBreakpoint(String constraintInstance) { + // get all breakpoints + IBreakpointManager manager = getManager(); + // create breakpoint + IFile moduleFile = debugTarget.getModuleFile(); + IMarker marker = HenshinMarkerNavigationProvider.addMarker(moduleFile, HenshinModelPlugin.PLUGIN_ID, "/constraintInstance", "Sample ConstraintInstanceBreakpoint", IStatus.OK); + ConstraintInstanceBreakpoint breakpoint = new ConstraintInstanceBreakpoint(); + try { + // set marker for breakpoint + breakpoint.setMarker(marker); + breakpoint.setEnabled(true); + // configure breakpoint + + breakpoint.setConstraintInstance(removeRuntimeValuesFromConstraintInstance(constraintInstance)); + breakpoint.setDebugLevel(DebugLevel.CONSTRAINT); + // add breakpoint to manager to keep track + manager.addBreakpoint(breakpoint); + } catch (CoreException e1) { + System.out.println("Unable to create custom ConstraintInstanceBreakpoint."); + e1.printStackTrace(); + } + } + + private String removeRuntimeValuesFromConstraintInstance(String constraintInstance) { + // Remove runtime values from the constraint instance string + final int indexOfParenthesis = constraintInstance.indexOf('('); + if (indexOfParenthesis > 0) { + constraintInstance = constraintInstance.substring(0, indexOfParenthesis - 1); + } + return constraintInstance; + } + /** * Returns an array list containing all HenshinBreakpoints currently available @@ -967,6 +1017,63 @@ public void stepReturn() throws DebugException { } /** + * Filter all constraint type breakpoints and returns an array list. + * @param henshinBreakpoints + * @return + */ + public ArrayList<ConstraintTypeBreakpoint> filterConstraintTypeBreakpoints(ArrayList<HenshinBreakpoint> henshinBreakpoints) { + ArrayList<ConstraintTypeBreakpoint> constraintTypeBreakpoints = new ArrayList<ConstraintTypeBreakpoint>(); + + // loop through all breakpoints and return the ones which are of type ConstraintTypeBreakpoint + for (HenshinBreakpoint henshinBreakpoint : henshinBreakpoints) { + // local variable + if (isConstraintTypeBreakpoint(henshinBreakpoint)) { + // cast to VariableBreakpoint + ConstraintTypeBreakpoint constraintTypeBreakpoint = (ConstraintTypeBreakpoint) henshinBreakpoint; + constraintTypeBreakpoints.add(constraintTypeBreakpoint); + } + } + + return constraintTypeBreakpoints; + } + + /** + * Checks whether a given breakpoint is of type ConstraintTypeBreakpoint + */ + public boolean isConstraintTypeBreakpoint(HenshinBreakpoint breakpoint) { + return breakpoint instanceof ConstraintTypeBreakpoint; + } + + /** + * Filter all constraint instance breakpoints and returns an array list. + * @param henshinBreakpoints + * @return + */ + public ArrayList<ConstraintInstanceBreakpoint> filterConstraintInstanceBreakpoints(ArrayList<HenshinBreakpoint> henshinBreakpoints) { + ArrayList<ConstraintInstanceBreakpoint> constraintInstanceBreakpoints = new ArrayList<ConstraintInstanceBreakpoint>(); + + // loop through all breakpoints and return the ones which are of type ConstraintTypeBreakpoint + for (HenshinBreakpoint henshinBreakpoint : henshinBreakpoints) { + // local variable + if (isConstraintInstanceBreakpoint(henshinBreakpoint)) { + // cast to VariableBreakpoint + ConstraintInstanceBreakpoint constraintInstanceBreakpoint = (ConstraintInstanceBreakpoint) henshinBreakpoint; + constraintInstanceBreakpoints.add(constraintInstanceBreakpoint); + } + } + + return constraintInstanceBreakpoints; + } + + /** + * Checks whether a given breakpoint is of type ConstraintTypeBreakpoint + */ + public boolean isConstraintInstanceBreakpoint(HenshinBreakpoint breakpoint) { + return breakpoint instanceof ConstraintInstanceBreakpoint; + } + + + /** * Checks all the necessary parameters to determine whether to stop at this variable or not. * @param variableBreakpoint * @param currentTypeName @@ -1042,6 +1149,24 @@ public void stepReturn() throws DebugException { } /** + * + * @param constraintTypeBreakpoint + * @return + */ + public boolean shouldStopAtConstraintTypeBreakpoint(ConstraintTypeBreakpoint constraintTypeBreakpoint) { + return constraintTypeBreakpoint.getType() == currentConstraintType; + } + + /** + * + * @param constraintTypeBreakpoint + * @return + */ + public boolean shouldStopAtConstraintInstanceBreakpoint(ConstraintInstanceBreakpoint constraintInstanceBreakpoint) { + return removeRuntimeValuesFromConstraintInstance(retrieveConstraintLabel()).equals(constraintInstanceBreakpoint.getConstraintInstance()); + } + + /** * Checks if there are any variables left. * * @return true if current variable is last variable @@ -1362,14 +1487,12 @@ public void stepReturn() throws DebugException { */ @SuppressWarnings("unchecked") private synchronized String retrieveConstraintLabel() { - String label = "Constraint " + currentConstraintIndex; + String label = ""; if (currentDebugLevel != DebugLevel.CONSTRAINT) { - return label; + return "Constraint " + currentConstraintIndex; } - label += ": '"; - switch (currentConstraintType) { case TYPE: label += ("Type = " + currentVariable.typeConstraint.type.getName()); @@ -1393,7 +1516,7 @@ public void stepReturn() throws DebugException { */ if (currentSlot.getValue() != null) { String attValue = String.valueOf(currentSlot.getValue().eGet(currentSlot.getValue().eClass().getEStructuralFeature(attName))); - label += attValue + " = " + paramValue + " (" + attName + " = " + paramName + ")"; + label += attName + " = " + paramName + " (" + attValue + " = " + paramValue + ")"; } break; case CONTAINMENT: @@ -1450,7 +1573,6 @@ public void stepReturn() throws DebugException { throw new IllegalStateException("missing ConstraintType in switch statement?"); } - label += "'"; return label; } |