| Summary: | [Validation] It should be possible to validate graphical rules (on Notation) | ||
|---|---|---|---|
| Product: | [Modeling] Papyrus | Reporter: | Yann Tanguy <yann.tanguy> |
| Component: | Diagram | Assignee: | Ansgar Radermacher <ansgar.radermacher> |
| Status: | ASSIGNED --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | cletavernier, papyrus-bugs, sebastien.gerard |
| Version: | 0.8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 313986 | ||
|
Description
Yann Tanguy
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. |