Skip to content
Snippets Groups Projects
Commit ddafd5d0 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

fill in default predicate for custom execute dialog

parent 6c42828d
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ public class CustomPreconditionInputDialog extends InputDialog { ...@@ -28,7 +28,7 @@ public class CustomPreconditionInputDialog extends InputDialog {
public CustomPreconditionInputDialog(final Shell parentShell, Operation op, Animator a) { public CustomPreconditionInputDialog(final Shell parentShell, Operation op, Animator a) {
super(parentShell, "Execute with additional Guard Constraint", getMenuText(op,a), super(parentShell, "Execute with additional Guard Constraint", getMenuText(op,a),
"", new EventBInputValidator()); getDefaultPredicate(op,a), new EventBInputValidator());
this.op = op; this.op = op;
animator = a; animator = a;
} }
...@@ -38,24 +38,30 @@ public class CustomPreconditionInputDialog extends InputDialog { ...@@ -38,24 +38,30 @@ public class CustomPreconditionInputDialog extends InputDialog {
sb.append("Enter Guard Constraint to be added to the Event \""); sb.append("Enter Guard Constraint to be added to the Event \"");
sb.append(op.getName()); sb.append(op.getName());
sb.append("\" before execution."); sb.append("\" before execution.");
List<String> params = getOperationParams(op,animator);
if(params.size()>0) {
sb.append("\nParameters are:"); sb.append("\nParameters are:");
sb.append(getOperationParams(op,animator)); for (String arg : params) {
if (op.getArguments().size()>0) {
sb.append("\nValues are:");
for (String arg : op.getArguments()) {
sb.append(" "); sb.append(" ");
sb.append(arg); // these are the parameter values not the parameter names !!! sb.append(arg);
} }
} }
// sb.append("\nYou may use the parameters: "); return sb.toString();
}
// List<String> arguments = op.getArguments(); private static String getDefaultPredicate(Operation op, Animator animator) {
// for (int i = 0; i < arguments.size() - 1; i++) { // get a predicate with all parameters and filling in values from selected operation in view
// sb.append(arguments.get(i)); StringBuffer sb = new StringBuffer();
// sb.append("' "); List<String> params = getOperationParams(op,animator);
// } List<String> vals = op.getArguments();
// sb.append(arguments.get(arguments.size() - 1)); int sze = Math.min(params.size(),vals.size());
for (int i = 0; i < sze - 1; i++) {
sb.append(params.get(i));
sb.append(" = ");
sb.append(vals.get(i));
if(i!=sze-1) { sb.append(" & ");}
}
return sb.toString(); return sb.toString();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment