Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] replace automated messages with mine
[EVL] replace automated messages with mine [message #713553] Mon, 08 August 2011 15:38 Go to next message
Aris  is currently offline Aris Friend
Messages: 14
Registered: July 2011
Junior Member
Hi,

I am using EVL for diagram validation of my GMF editor.

I would like to replace the automated messages of GMF (e.g. the required feature " " must be set) with my own messages. So for example if I have the following class:

class{
attr String[1]name;
}

the validation produce a message as I mentioned above. I want to replace this message(or disable it) and use my own message that I wrote with in my evl file.
Do anyone know if that is possible?

Thanks in advance,

Aris
Re: [EVL] replace automated messages with mine [message #714461 is a reply to message #713553] Wed, 10 August 2011 14:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Aris,

The messages you mention are produced by the EMF validator. The following post seems to suggest that you need to implement a fragment which overrides the default messages: http://stackoverflow.com/questions/5861948/changing-default-validation-messages

Another option would be to customise your GMF code so that it does not invoke the EMF validator at all - but invokes a custom validator that only evaluates the EVL constraints instead.

Cheers,
Dimitris
Re: [EVL] replace automated messages with mine [message #714748 is a reply to message #714461] Thu, 11 August 2011 12:36 Go to previous messageGo to next message
Aris  is currently offline Aris Friend
Messages: 14
Registered: July 2011
Junior Member
Hi Dimitris,

Thanks for the reply.

The option to not invoke the emf validator at all sounds good. Do you have any idea how that will be possible?

Thanks,

Aris
Re: [EVL] replace automated messages with mine [message #714760 is a reply to message #714748] Thu, 11 August 2011 12:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Aris,

Unfortunately, I haven't done this before so I too would have to investigate. I think I'd start by looking at the generated ValidateAction class.

Cheers,
Dimitris
Re: [EVL] replace automated messages with mine [message #716094 is a reply to message #714760] Tue, 16 August 2011 12:53 Go to previous messageGo to next message
Aris  is currently offline Aris Friend
Messages: 14
Registered: July 2011
Junior Member
Hi Dimitris,

Unfortunately I didn't have time to solve it.
I posted a similar question to GMF forum. I put the link here with the answer I got if someone is interested in(despite the suggestion there is how to change the default messages, no disable them).

http://www.eclipse.org/forums/index.php/t/234205/



Thanks,

Aris
Re: [EVL] replace automated messages with mine [message #1691058 is a reply to message #716094] Wed, 01 April 2015 22:55 Go to previous messageGo to next message
Nikos Margaritis is currently offline Nikos MargaritisFriend
Messages: 65
Registered: September 2014
Member

Hello there,

I was just working on this issue and it turns out that all the validation results are included in the
Diagnostic diagnostics
object under the
private static void validate(DiagramEditPart diagramEditPart, View view)in the ValidateAction class. 


Now diagnostics related with the GMF editor have a code attribute with the value of 1 while errors from the EVL validator have a code of 0 (e.g diagnostics.getChildren().get(0).getCode())

I tried to modify the list but it is unmodifiable. So diagnostics can not change and you can not instantiate a Diagnostic object either!!

So I came up with a dirty solution of modifying the
private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) 
and the 
private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List allDiagnostics)



In the first locate the
List data = nextDiagnostic.getData();
and replace it with the following
List data = null;
					
if(nextDiagnostic.getCode() == 0){	
    data = nextDiagnostic.getData();
}


In the second method locate the
		
collectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);
and replace it the following:

Diagnostic p = (Diagnostic) it.next();
if (p.getCode() == 0 && it.hasNext()) {		
    collectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);
}


Hope it is useful.

[Updated on: Sat, 18 April 2015 13:43]

Report message to a moderator

Re: [EVL] replace automated messages with mine [message #1691319 is a reply to message #1691058] Sun, 05 April 2015 18:32 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Niko,

Many thanks for sharing this!

Cheers,
Dimitris
Previous Topic:EVL - Validation error for attribute "function"
Next Topic:How to measure the memory usage
Goto Forum:
  


Current Time: Thu Apr 18 05:05:50 GMT 2024

Powered by FUDForum. Page generated in 0.02986 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top