Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How could XVariableDeclaration extend JvmIdentifiableElement ?(Need to understand how that statement could be generated ...)
How could XVariableDeclaration extend JvmIdentifiableElement ? [message #953390] Mon, 22 October 2012 07:50 Go to next message
Pascal Degenne is currently offline Pascal DegenneFriend
Messages: 5
Registered: September 2012
Junior Member
Hi all,

The XVariableDeclaration is defined in the Xbase grammar by :
Quote:

XVariableDeclaration returns XExpression:
{XVariableDeclaration}
(writeable?='var'|'val') (=>(type=JvmTypeReference name=ValidID) | name=ValidID) ('=' right=XExpression)?;


Thanks to the 'returns XExpression' the generated XVariableDeclaration interface extends XEpression.

But when looking at XVariableDeclaration.java one can see that the generated code is :
Quote:

public interface XVariableDeclaration extends XExpression, JvmIdentifiableElement
{ ...}


See : it also extends JvmIdentifiableElement !

I understood that this is extension of JvmIdentifiableElement is useful for the Xbase scope provider.

As I need to create my own customized VariableDeclaration, I have to reproduce something similar. So I have been looking around the places to understand how that JvmIdentifiableElement extension could have been generated and I failed to find it.

Does anyone know how this 'extends JvmIdentifiableElement' is generated even though there is nothing in the grammar that seem to tell to do so ? Or could it be some code that was added by hand after the code generation ?

Any help would be welcome ...

Pascal
Re: How could XVariableDeclaration extend JvmIdentifiableElement ? [message #953624 is a reply to message #953390] Mon, 22 October 2012 11:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

xbase uses a manually maintained metamodel Wink so it was no problem to add it there i think.
the EcoreGenerator Worflow component is used to provide the implementations of getIdentifier() (Generation Gap)

Btw why dont you subclass the existing variable decl?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How could XVariableDeclaration extend JvmIdentifiableElement ? [message #954748 is a reply to message #953624] Tue, 23 October 2012 08:07 Go to previous message
Pascal Degenne is currently offline Pascal DegenneFriend
Messages: 5
Registered: September 2012
Junior Member
Soooo that was it ! Things are clear now Smile

You are probably right about subclassing XVariableDeclaration. I will experiment that way too.

Big thank you for your help !
Pascal
Previous Topic:cross reference in import
Next Topic:Eclipse is getting slow with time
Goto Forum:
  


Current Time: Fri Mar 29 15:15:33 GMT 2024

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

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

Back to the top