File tree Expand file tree Collapse file tree 4 files changed +22
-17
lines changed
examples/org.eclipse.epsilon.examples.eol.dap
org.eclipse.epsilon.evl.engine/src/org/eclipse/epsilon/evl
org.eclipse.epsilon.workflow/ant/org/eclipse/epsilon/workflow/tasks Expand file tree Collapse file tree 4 files changed +22
-17
lines changed Original file line number Diff line number Diff line change 4242 <epsilon .emf.loadModel name =" M"
4343 metamodelfile=" epsilon/models/person.ecore"
4444 modelfile=" epsilon/models/invalidPerson.model"
45- read=" true" store =" false " />
45+ read=" true" store =" true " />
4646
47- <epsilon .evl src =" epsilon/09-validate.evl" debug =" true" debugPort =" 4040" failOnErrors =" false" >
47+ <epsilon .evl src =" epsilon/09-validate.evl" debug =" true" debugPort =" 4040" failOnErrors =" false" fix = " true " >
4848 <model ref =" M" />
4949 </epsilon .evl>
5050
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ protected boolean isStructuralBlock(ModuleElement ast) {
2727 @ Override
2828 public boolean isDoneAfterModuleElement (ModuleElement ast ) {
2929 if (super .isDoneAfterModuleElement (ast )) {
30+ if (getModule ().getUnsatisfiedConstraintFixer () == null ) {
31+ // There is no fixer to apply the fixes
32+ return true ;
33+ }
34+
3035 for (UnsatisfiedConstraint unsatisfied : getModule ().getContext ().getUnsatisfiedConstraints ()) {
3136 if (!unsatisfied .isFixed () && !unsatisfied .getFixes ().isEmpty ()) {
3237 // There is at least one unfixed unsatisfied constraint with fixes: leave it running
Original file line number Diff line number Diff line change 1717
1818public class CommandLineFixer implements IEvlFixer {
1919
20- protected boolean fix = false ;
21-
2220 @ Override
2321 public void fix (IEvlModule module ) throws EolRuntimeException {
2422 IEvlContext context = module .getContext ();
2523 IUserInput userInput = context .getUserInput ();
2624
2725 for (UnsatisfiedConstraint unsatisfiedConstraint : context .getUnsatisfiedConstraints ()) {
2826 context .getOutputStream ().println (unsatisfiedConstraint .getMessage ());
29- boolean fixIt = fix && ( unsatisfiedConstraint .getFixes ().size () > 0 ) && userInput .confirm ("Fix error?" , true );
27+ boolean fixIt = unsatisfiedConstraint .getFixes ().size () > 0 && userInput .confirm ("Fix error?" , true );
3028
3129 if (fixIt ) {
3230 FixInstance fixInstance = (FixInstance ) userInput .choose (unsatisfiedConstraint .getMessage (), unsatisfiedConstraint .getFixes (), null );
@@ -37,12 +35,4 @@ public void fix(IEvlModule module) throws EolRuntimeException {
3735 }
3836 }
3937
40- public boolean isFix () {
41- return fix ;
42- }
43-
44- public void setFix (boolean fix ) {
45- this .fix = fix ;
46- }
47-
4838}
Original file line number Diff line number Diff line change 2121public class EvlTask extends ExportableModuleTask {
2222
2323 protected String exportConstraintTrace ;
24+ protected boolean fix = false ;
2425
2526 public String getExportConstraintTrace () {
2627 return exportConstraintTrace ;
@@ -31,7 +32,15 @@ public void setExportConstraintTrace(String exportConstraintTrace) {
3132 ((IEvlModule ) module ).getContext ().setOptimizeConstraintTrace (false );
3233 }
3334 }
34-
35+
36+ public boolean isFix () {
37+ return fix ;
38+ }
39+
40+ public void setFix (boolean fix ) {
41+ this .fix = fix ;
42+ }
43+
3544 @ Override
3645 protected IEvlModule createDefaultModule () {
3746 return new EvlModuleParallelAnnotation ();
@@ -40,9 +49,10 @@ protected IEvlModule createDefaultModule() {
4049 @ Override
4150 protected void initialize () throws Exception {
4251 IEvlModule evlModule = (IEvlModule ) module ;
43- CommandLineFixer clf = new CommandLineFixer ();
44- clf .setFix (false );
45- evlModule .setUnsatisfiedConstraintFixer (clf );
52+ if (isFix ()) {
53+ CommandLineFixer clf = new CommandLineFixer ();
54+ evlModule .setUnsatisfiedConstraintFixer (clf );
55+ }
4656 }
4757
4858 @ Override
You can’t perform that action at this time.
0 commit comments