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

comments utility methods

refs 2553
parent 47605cda
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity;
import org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum;
import org.fortiss.tooling.kernel.model.constraints.ConstraintsFactory;
import org.fortiss.tooling.kernel.model.constraints.ErrorVerificationStatus;
import org.fortiss.tooling.kernel.model.constraints.FailVerificationStatus;
......@@ -33,6 +34,7 @@ import org.fortiss.tooling.kernel.model.constraints.IConstraint;
import org.fortiss.tooling.kernel.model.constraints.IConstraintVerificationStatus;
import org.fortiss.tooling.kernel.model.constraints.OutdatedVerificationStatus;
import org.fortiss.tooling.kernel.model.constraints.SuccessVerificationStatus;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
/**
* Utility functions for constraints.
......@@ -40,7 +42,7 @@ import org.fortiss.tooling.kernel.model.constraints.SuccessVerificationStatus;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 6D5AD8843A4CA208840DD7AA8E3968C2
* @ConQAT.Rating YELLOW Hash: 20D9E980F0519B44760383E485DBE87C
*/
public class ConstraintsUtils {
/**
......@@ -136,6 +138,14 @@ public class ConstraintsUtils {
}
}
/**
* @param sev
* @param modelElement
* @return the maximum severity between <code>sev</code> and the severity resulting of possibly
* unsatisfied constraints on <code>modelElement</code>.
*
* Note: if, later on, {@link IConstraintViolation}
*/
public static ESeverity augmentSeverityWithConstraintSeverity(ESeverity sev,
EObject modelElement) {
if(modelElement instanceof IConstrained) {
......@@ -146,4 +156,15 @@ public class ConstraintsUtils {
}
return sev == null ? ESeverity.lowest() : sev;
}
/**
* @param c
* Sends (kernel-specific) refresh notifications to the constrained elements to
* trigger a refresh of the marker decorations.
*/
public static void triggerMarkersRefresh(IConstraint c) {
for(ConstrainedWithChecksum cwc : c.getConstrainedsWithChecksum()) {
EcoreUtils.postRefreshNotification(cwc.getConstrained());
}
}
}
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