Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » knowing the java package of the model generated classes
knowing the java package of the model generated classes [message #643631] Tue, 07 December 2010 16:47 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

in my DSL I have a statement like the following

'grammar' ePackage=[ecore::EPackage|STRING]

with which I load an EPackage.

now, I'd like to know the java package of the corresponding EMF
generated classes (in particular the package of the generated interfaces).

Thus, for instance, if I write in my program

grammar "mypatch/to/my.ecore"

I'd like to know where the EMF classes corresponding to my.ecore are
generated.

Is there a direct way to achieve this? Or should I go through the
corresponding genmodel? if so, could someone point me to some example on
how to do this please?

many thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: knowing the java package of the model generated classes [message #643666 is a reply to message #643631] Tue, 07 December 2010 18:46 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

you have to find the respective genmodel and inspects its values. The
EPackage itself does not know about the (to be) generated artifacts.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 07.12.10 17:47, schrieb Lorenzo Bettini:
> Hi
>
> in my DSL I have a statement like the following
>
> 'grammar' ePackage=[ecore::EPackage|STRING]
>
> with which I load an EPackage.
>
> now, I'd like to know the java package of the corresponding EMF
> generated classes (in particular the package of the generated interfaces).
>
> Thus, for instance, if I write in my program
>
> grammar "mypatch/to/my.ecore"
>
> I'd like to know where the EMF classes corresponding to my.ecore are
> generated.
>
> Is there a direct way to achieve this? Or should I go through the
> corresponding genmodel? if so, could someone point me to some example on
> how to do this please?
>
> many thanks in advance
> Lorenzo
>
Re: knowing the java package of the model generated classes [message #643686 is a reply to message #643666] Tue, 07 December 2010 20:14 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 12/07/2010 07:46 PM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> you have to find the respective genmodel and inspects its values. The
> EPackage itself does not know about the (to be) generated artifacts.
>
> Regards,
> Sebastian

thanks

for this purpose it might be enough to look into the same directory
where the EPackage, however, given an EPackage I can't seem to find a
way to get the path of the corresponding ecore... I guess I have to
store that information somewhere else when I load the EPackage, can it be?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: knowing the java package of the model generated classes [message #643701 is a reply to message #643686] Tue, 07 December 2010 22:15 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
Alternatively, you could reference (through a URI) the GenModel instance (from the GenModel Ecore meta model) which holds a reference (URI) to the EPackage.

Re: knowing the java package of the model generated classes [message #643790 is a reply to message #643701] Wed, 08 December 2010 09:32 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 12/07/2010 11:15 PM, Meinte Boersma wrote:
> Alternatively, you could reference (through a URI) the GenModel instance
> (from the GenModel Ecore meta model) which holds a reference (URI) to
> the EPackage.

Hi

you mean: instead of loading the .ecore file, load the .genmodel file,
then from there, through GenModel, get a reference to EPackage?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: knowing the java package of the model generated classes [message #643806 is a reply to message #643701] Wed, 08 December 2010 10:47 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 12/07/2010 11:15 PM, Meinte Boersma wrote:
> Alternatively, you could reference (through a URI) the GenModel instance
> (from the GenModel Ecore meta model) which holds a reference (URI) to
> the EPackage.

By the way, I managed to get a GenModel instance, but I can't seem to
find the information you talk about from GenModel instance...

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: knowing the java package of the model generated classes [message #643901 is a reply to message #643806] Wed, 08 December 2010 16:19 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
If you open the .genmodel file in an(y) appropriate editor, then you should a 'foreignModel' element as the first child of the root.

Re: knowing the java package of the model generated classes [message #643912 is a reply to message #643806] Wed, 08 December 2010 16:48 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

have a look at the attributes of the corresponding GenPackage. It should
expose something like base package.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 08.12.10 11:47, schrieb Lorenzo Bettini:
> On 12/07/2010 11:15 PM, Meinte Boersma wrote:
>> Alternatively, you could reference (through a URI) the GenModel instance
>> (from the GenModel Ecore meta model) which holds a reference (URI) to
>> the EPackage.
>
> By the way, I managed to get a GenModel instance, but I can't seem to
> find the information you talk about from GenModel instance...
>
Previous Topic:ContentAssist - CodeCompletion with Templates for Function-Parameters
Next Topic:createNode is not called for MySyntaxTransformer.java
Goto Forum:
  


Current Time: Thu Apr 18 17:50:30 GMT 2024

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

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

Back to the top