Skip to content
Snippets Groups Projects
Commit f44f3616 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

adds setAutoCheck to ConstraintsUtils

refs 2553
parent 688a829f
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,11 @@
upperBound="-1" eType="#//constraints/ConstrainedWithChecksum" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="verificationStatus" eType="#//constraints/IConstraintVerificationStatus"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="autoCheck" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="autoCheck" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="&lt;b>Do not set this field directly!&lt;/b> Use ConstraintsUtils.setAutoCheck instead: this will trigger the check immediatly if you set &lt;code>autocheck&lt;/code> to &lt;code>true&lt;/code>."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IConstraintVerificationStatus" abstract="true"
interface="true">
......
......@@ -24,6 +24,7 @@ import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraint;
import org.fortiss.tooling.kernel.model.constraints.OutdatedVerificationStatus;
import org.fortiss.tooling.kernel.model.constraints.SuccessVerificationStatus;
import org.fortiss.tooling.kernel.service.IConstraintVerificationService;
/**
* Utility methods for dealing with constraints.
......@@ -31,7 +32,7 @@ import org.fortiss.tooling.kernel.model.constraints.SuccessVerificationStatus;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 1325BAE0A0C28B3F093D89D912BE1AFF
* @ConQAT.Rating YELLOW Hash: 16AE39268EA05749A3262EFCF0601695
*/
public class ConstraintsUtils {
/**
......@@ -108,4 +109,19 @@ public class ConstraintsUtils {
c.setVerificationStatus(status);
return status;
}
/**
* @param c
* @param value
* Sets the <code>autoCheck</code> field of <code>c</code> to <code>value</code>
* <b>and triggers the verification of <code>c</code> if <code>value</code> is
* <code>true</code>.</b>
* Use this instead of directly setting <code>autocheck</code>.
*/
public static void setAutoCheck(IConstraint c, boolean value) {
c.setAutoCheck(value);
if(value) {
IConstraintVerificationService.INSTANCE.verify(c);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment