Xcore - magic content assist for XBlockExpression [message #893997] |
Fri, 06 July 2012 07:22  |
Eclipse User |
|
|
|
Hi,
i am impressed about the content assist of Xcores XBlockExpression.
Inside an operation (XBlockExpression) xReferences can be accessed by contentassist. For normal JVMTypeReference are addressed by content assist of a XBlockExpression.
class Library {
contains Book[*] books opposite library
op Int getBooksCount(){
return books.size
}
But i wonder how it works. I spent hours to find out and have been setting a lot of breakpoints in the code to find the proper piece of code that is responsible to provide an XReference instead of a JVMTypeReference.
First i thought that the generated java code is used... But i suppressed the code generation by a "compile error" in the xcore file and the content assist still works.
I think there will be done some kind of mapping or something.
Can anybody give me a hint which parts of the code are responsible doing this? Then i can continue browsing the underlying source.
Thanks in advance for your help.
And thanks to Xcore team providing such an interesting and really reusable issue!
Best,
Florian Pirchner
|
|
|
Re: Xcore - magic content assist for XBlockExpression [message #894009 is a reply to message #893997] |
Fri, 06 July 2012 07:42   |
Eclipse User |
|
|
|
Florian,
A *.xcore resources infers the Jvm* things that will be generated
(XcoreJvmInferrer) and those things are in scope within the bodies of
operations. You can see all the inferred things in the hover
information for any construct in the Xcore source. So, for example, the
resource knows there is a generated interface and implementations for an
XClass with accessor methods like getX which in Xbase can be accessed as
if it were a field. If you open the *.xcore resource with EMF's
reflective editor, (Open With->Other...->Sample Reflective Ecore Model
Editor) you can see all the inferred content, e.g., the Ecore model, the
GenModel, and all the Jvm types model instances; it's quite a useful and
interesting feature.
On 06/07/2012 1:22 PM, Florian Pirchner wrote:
> Hi,
>
> i am impressed about the content assist of Xcores XBlockExpression.
> Inside an operation (XBlockExpression) xReferences can be accessed by
> contentassist. For normal JVMTypeReference are addressed by content
> assist of a XBlockExpression.
>
>
> class Library {
> contains Book[*] books opposite library
>
> op Int getBooksCount(){
> return books.size
> }
>
>
> But i wonder how it works. I spent hours to find out and have been
> setting a lot of breakpoints in the code to find the proper piece of
> code that is responsible to provide an XReference instead of a
> JVMTypeReference.
>
> First i thought that the generated java code is used... But i
> suppressed the code generation by a "compile error" in the xcore file
> and the content assist still works.
>
> I think there will be done some kind of mapping or something.
>
> Can anybody give me a hint which parts of the code are responsible
> doing this? Then i can continue browsing the underlying source.
>
> Thanks in advance for your help.
> And thanks to Xcore team providing such an interesting and really
> reusable issue!
>
> Best,
> Florian Pirchner
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28546 seconds