Showing validation error at the right eStructural feature [message #1202969] |
Fri, 22 November 2013 12:10 |
Ashwini Nayak Messages: 19 Registered: July 2013 |
Junior Member |
|
|
Hello,
I am facing a problem while showing a validation error in my xText editor.
My xcore model looks like this:
class Application
{
String name
contains User[] users
}
class User
{
String name
String address
}
My xText grammar looks as below:
Application:
"system" name=ID
users+=User*
;
User:
"userName" userName=ID "{"
"address" address=STRING
"}"
;
I have a java validation method which looks as below:
@Check
public void testApplication(Application app){
//other method calls
for(User user :app.getUsers()){
//validation part goes here...
error("Error!!!", user.eClass().getEStructuralFeature(UserPackage.USER_NAME));
}
}
I need to show a validation error at the EStructural Feature, 'userName' in my editor. I am not able to show validation error at the right place.
I throws runtime exception : "The sources EClass 'Application' does not expose the feature 'User.userName'". I can show error at the right place if I pass 'User' as the parameter for my validation method.
But, for some reason, I take 'Application' as the parameter for my validation method.
Can anyone help me by suggesting how I can resolve this?
Thanks in advance
[Updated on: Fri, 22 November 2013 12:11] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03430 seconds