Hi all,
I got a question regarding scoping and resolving proxies. In my grammer I use java objects. Here is a snippet:
Import:
'import' importedNamespace=QualifiedNameWithWildCard 'as' name=ValidID;
Create:
'create' importAlias=[Import] '.' javaType=[jvmTypes::JvmType|QualifiedName] 'as' name=Variable;
Call:
'call' name=[Create|Variable] '.' method=MethodCall;
MethodCall:
{MethodCall} method=[jvmTypes::JvmOperation|ValidID] '(' (params+=ExtParameterList)* (',' (params+=ExtParameterList))*
')'
('.' => nextCall=MethodCall)?;
With this grammar a syntax like the following is possible:
import org.servic.* as service
create service.Customers as $customers
call $customers.getAllCustomers().get(0).getName()
getAllCustomers returns a List<Customer>. I wrote a custom scope provider and I managed to get all JvmOperations when hitting CTRL+SPACE after $customers. Works fine! But somehow the other proposals after getAllCustomers() or after get() don't work. After debuggung I can see, that the method in MethodCall is always a proxy like.
org.eclipse.xtext.common.types.impl.JvmOperationImpl@21967775 (eProxyURI: platform:/resource/AXA/Tarif/PHV/Service/GetQuote/request.bsf#xtextLink_::0.0.36.1.2::0::/1)
But how can I resolve such a proxy? I even got problems to get the proxy-uri out of the object as I cannot find an appropriate method.
Can anybody help me out?
Regards
Goran
P.S.: Besides the question above. I realized that in the scope provider the objects are slightly different when hitting CTRL+SPACE compared to the objects after changing the script and saving it. Can anybody explain me why?
[Updated on: Mon, 23 July 2012 03:23] by Moderator