issues when importing grammar [message #651172] |
Fri, 28 January 2011 07:44 |
Aleks Mising name Messages: 8 Registered: November 2010 |
Junior Member |
|
|
Hi guys,
I have run into a problem that I have been unsuccessful to solve all day. I have two Xtext models - A and B, and B uses elements from A. Now I have managed to figure out what I need to import the elements and use them when specifying the 'B' model...
So if for example I have in A:
generate bankModel "http://www.bank.com/bb/bankModel"
ApplicationType:
{ApplicationType} eClass=[ecore::EClass];
enum ApplicantType:
PRIMARY | SECONDARY | JOINT;
ApplicationData:
applicationType=ApplicationType ':'
applicantTypes+=ApplicantType(',' applicantTypes+=ApplicantType)* ';';
In B I reference the "ApplicationData" type:
//import A as app
ApplicationsByDepartment:
'Department:' depName=STRING '{'
applicationItems+=ApplicationItem*
'}';
ApplicationItem:
applicationData=[app::ApplicationData]';';
Note that in 'A' I provide a method in the ScopeProvider to look up a set of EClasses from another imported grammar. I am just mentioning this since I am not sure whether it has any relevance. The editing/generating/content-assist etc. all work fine in model 'A'.
For example, I can say:
where HomeLoan is the name of one of the EClass objects picked up by 'A's scope provider.
When writing and generating 'B' I see no problems whatsoever. However, as soon as I use the editor - it doesn't work!! I expected that I would be able to add an "ApplicationData" object in the editor for 'B' just like I did for model 'A'. However, content-assist gives me nothing.
If I try to type in the information, like in the example above, there is a validation error saying "Couldn't resolve reference to ApplicationData 'HomeLoan'".
Now while debugging I see that the AbstractDeclarativeScopeProvider is looking for some methods in the ScopeProvider for B, but am not sure what it exactly wants or needs. I tried "cheating" and creating a list of ApplicationData objects in that method, but that didn't help...It feels that it is my misunderstanding of either what is required when importing such an element from another model or the use of the scope provider...
Hope this question makes sense...
Kind regards,
Aleks
|
|
|
Powered by
FUDForum. Page generated in 0.03034 seconds