Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Xcore] Create an instance using XYZFacttoy
[Xcore] Create an instance using XYZFacttoy [message #800796] Fri, 17 February 2012 14:04 Go to next message
Markus Klink is currently offline Markus KlinkFriend
Messages: 14
Registered: July 2009
Junior Member
when I define a model using XCore and provide implementations of operations there is a case where I would like to create a new EObject instance of one of my classes I defined in my model. however I cannot access the XYZPackage.eInstance to obtain the XYZFactory. What am I do wrong when using that approach?

Thanks
Markus
Re: [Xcore] Create an instance using XYZFacttoy [message #800861 is a reply to message #800796] Fri, 17 February 2012 15:57 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30642
Registered: July 2009
Senior Member
Markus,

You should be able to use XyzFactory::eINSTANCE.createAbc. Note that
the XcoreJvmInferrer is relatively incomplete so much of the knowledge
about the Java model that's generated won't be known until it's been
generated once so you'll need to save once in a while to refer to the
new things in the bodies.


On 17/02/2012 3:04 PM, Markus Klink wrote:
> when I define a model using XCore and provide implementations of
> operations there is a case where I would like to create a new EObject
> instance of one of my classes I defined in my model. however I cannot
> access the XYZPackage.eInstance to obtain the XYZFactory. What am I do
> wrong when using that approach?
>
> Thanks
> Markus
>
Re: [Xcore] Create an instance using XYZFacttoy [message #800877 is a reply to message #800861] Fri, 17 February 2012 16:19 Go to previous messageGo to next message
Markus Klink is currently offline Markus KlinkFriend
Messages: 14
Registered: July 2009
Junior Member
Thank you Ed. That worked. I was unware that the syntax to access static members is "::". With some tweaking in the save cycle I managed afterwards. Markus
Re: [Xcore] Create an instance using XYZFacttoy [message #898704 is a reply to message #800877] Fri, 27 July 2012 09:24 Go to previous messageGo to next message
x545 x545 is currently offline x545 x545Friend
Messages: 6
Registered: July 2009
Junior Member
Hm, this doesn't work anymore with the xcore juno build.
The xcore editor only knows XYZFactory.INSTANCE so the generated code fails to compile.
(when changing to eINSTANCE no code is generated)
Re: [Xcore] Create an instance using XYZFacttoy [message #898706 is a reply to message #898704] Fri, 27 July 2012 09:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30642
Registered: July 2009
Senior Member
Sandro,

Did you change some of the GenModel options such as those to suppress
interfaces or those to suppress EMF metadata? I don't think the
XcoreJvmInferrer takes all possible options into account. When you say
the generated code fails to compile, you mean the part you've specified
with an Xbase access to the factory instance in the block expression of
some operation or derived feature?


On 27/07/2012 11:24 AM, Sandro Weiser wrote:
> Hm, this doesn't work anymore with the xcore juno build.
> The xcore editor only knows XYZFactory.INSTANCE so the generated code
> fails to compile.
> (when changing to eINSTANCE no code is generated)
Previous Topic:diagram editor for dynamic objects
Next Topic:[Diff/Merge] Creation Review successful
Goto Forum:
  


Current Time: Sun Nov 17 22:25:12 GMT 2019

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

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

Back to the top