Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Resolve JvmOperation
Resolve JvmOperation [message #897199] Mon, 23 July 2012 02:51
Eclipse UserFriend
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

Previous Topic:XText Developer Documentation
Next Topic:manage the String type and what is generated from my dsl Grammar
Goto Forum:
  


Current Time: Mon Jun 30 20:11:11 EDT 2025

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

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

Back to the top