Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329735 - [Validation] It should be possible to validate graphical rules (on Notation)
Summary: [Validation] It should be possible to validate graphical rules (on Notation)
Status: ASSIGNED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Diagram (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ansgar Radermacher CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 313986
  Show dependency tree
 
Reported: 2010-11-09 04:17 EST by Yann Tanguy CLA
Modified: 2017-08-02 13:19 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Tanguy CLA 2010-11-09 04:17:54 EST
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.
Comment 1 Yann Tanguy CLA 2011-02-02 12:49:13 EST
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();
	}
}
Comment 2 Camille Letavernier CLA 2013-10-16 07:03:01 EDT
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.