Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] Status of EMF Validation

Dear all,

I just fixed a refresh problem (the code from the GMF templates installed a refresh listener per diagram type. But the listener had a diagram (instance) attribute which is used to obtain the editing domain. Thus, it failed once two models were opened the same time). Unfortunately, it implies that you have to regenerate the diagrams. Now, the main part of the ValidationDecorator support is in the generic class diagrams.common.providers.ValidationDecoratorsProviders.

The current status of EMF validation is as follows:
- error decorators are supported on all diagrams. A tooltip shows the error message(s)
- error decorators are supported in the model explorer. A tooltip shows the error message. There are two inconsistencies between model explorer and diagrams.
   (1) In the model explorer, I add decorators to parents of elements that have an error, e.g. to a package if a contained class has errors.
(text tooltip text indicates this). I don't know if it is a good idea to do the same on the diagrams.
  (2) The tooltip on a treeviewer (jface.viewers.CellLabelProvider) is just a string, thus the message text can not be prefixed by the appropriate icon (it's just a "-" sign) as the GMF viewers do. [well, I could add a single icon to the tooltip, but this would not be very useful for multiple messages].
- A validation command is available in the context menu of the model explorer (I don't know why it does not appear on the diagrams)

The error markers are registered with the .uml file, thus double clicking on these opens an editor registered for the UML extension. For testing, I registered Papyrus with the uml extension as well. It works out of the box, but is very problematic since it allows you to open two editors on the same resource.
The options are to
(1) if possbile manipulate the openEditor function to activate an existing editor opened on the di (uml), if the user double-clicks on the uml (di) file. 
(2) Register Papyrus only as an editor for .uml files
(3) only register Papyrus for di files and don't care that the tree-based UML editor is opened when double-clicking on a problem, since nobody will use the problem view if there are more than a 20-30 errors (probably for different UML resources). My experience with Java is that I only relied on the error decorators, not on the problem view.
(4) store error markers on the di file and re-enable the "hack" used before

Another issue: there is a small problem with regard to the differences between EValidator + EMF Validation (see 
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.emf.validation.doc/tutorials/validationAdapterTutorial.html): out of the box, user defined rules based on the extension point emf.validation.constraintProviders are not executed during validation. As described in the article, an EValidatorAdaptor is required and needs to be registered. Such an EvalidatorAdater already exists in MoDisco, but it is marked as internal (discouraged access).

I currently use the following line to the Activator of the uml.modelexplorer to register this Adapter:
EValidator.Registry.INSTANCE.put(UMLPackage.eINSTANCE, new EValidatorAdapter());
@MoDisco experts: is this registration possible by a cleaner means?

Best regards

Ansgar


-- 
Ansgar Radermacher                CEA/DRT/DILS/LISE
http://www-list.cea.fr/index.htm
phone: +33 16908 3812
mailto: ansgar.radermacher@xxxxxx



Back to the top