Skip to main content



      Home
Home » Modeling » EMF » [Xcore] Create an instance using XYZFacttoy
[Xcore] Create an instance using XYZFacttoy [message #800796] Fri, 17 February 2012 09:04 Go to next message
Eclipse UserFriend
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 10:57 Go to previous messageGo to next message
Eclipse UserFriend
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 11:19 Go to previous messageGo to next message
Eclipse UserFriend
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 05:24 Go to previous messageGo to next message
Eclipse UserFriend
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 05:31 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 13:58:36 EDT 2025

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

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

Back to the top