Community
Participate
Working Groups
It should be possible to specify and validate graphical rules (on Notation). e.g. Same color expected for every representation of a specific type of element.
It is currently possible to verify some graphical info by using the cross referencer (example below). public class PortShownInNoDiagram extends AbstractModelConstraint { @Override public IStatus validate(IValidationContext ctx) { Port elt = (Port) ctx.getTarget (); EReference[] ref = { NotationPackage.eINSTANCE.getView_Element() }; Collection<?> refs = EMFCoreUtil.getReferencers(elt, ref); if (refs.isEmpty()) { return ctx.createFailureStatus ("Port should be shown at least in one diagram ("+elt.getQualifiedName()+")"); } return ctx.createSuccessStatus(); } }
Cross referencers are dangerous for performances, but I guess they may be required in this case. The validation should run on Notation elements (This would not cover this specific example however). I think that currently, the validation only runs for semantic (UML) elements and stereotype applications.