[EVL] replace automated messages with mine [message #713553] |
Mon, 08 August 2011 11:38  |
Eclipse User |
|
|
|
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 #1691058 is a reply to message #716094] |
Wed, 01 April 2015 18:55   |
Eclipse User |
|
|
|
Hello there,
I was just working on this issue and it turns out that all the validation results are included in the 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 09:43] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.09566 seconds