Error Markers and Quick Fixes in GMF editors using EVL

The Epsilon Validation Language (EVL) is a model validation language that provides additional features to OCL, such as guards, constraint dependency management, user interaction, access to Java objects, and the ability to specify a number of fixes for each constraint, that the user can invoke if the constraint fails in order to repair the model. We’ve been recently working on integrating EVL with GMF so that failed constraints can appear as error/warning markers in GMF editors, and fixes can be invoked using the standard Quick Fix mechanism. An example follows:

The following screenshot shows a file system model in a GMF-based editor (constructed here).


We now specify the following EVL constraints and bind them to the editor (using the instructions provided here):

context File {
    constraint HasName {
        check :
        message : 'Unnamed ' + self.eClass().name + ' not allowed'
context Folder {
    critique NameStartsWithCapital {
        guard : self.satisfies('HasName')
        check : =
        message : 'Folder ' + +
            ' should start with an upper-case letter'
        fix {
            title : 'Rename to ' +
            do {
context Sync {
    constraint MustLinkSame {
        check : self.source.eClass() =
        message : 'Cannot synchronize a ' + self.source.eClass().name
            + ' with a ' +
        fix {
            title : 'Synchronize with another ' +
            do {
                var target := UserInput.choose('Select target',
                if (target.isDefined()) := target;

Then, we evaluate the constraints by clicking Diagram->Validate, and our editor and Problems view now look like this:



We can now right click on the warning and invoke quick fix we have defined for the NameStartsWithCapital critique.


By clicking Finish, the fix is executed and the warning disappears.


A complete reference of the syntax and semantics of EVL can be found in Chapter 6 of the Epsilon Book (PDF). Also, instructions for binding EVL constraints with an existing GMF editor can be found here. Finally, a Flash screencast of this example is available here.

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Error Markers and Quick Fixes in GMF editors using EVL

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s