Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating new EObjects from XtextResource
Creating new EObjects from XtextResource [message #718393] Wed, 24 August 2011 08:10 Go to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Hey guys,

with all the help from the forum, I managed to edit my model via EMF and get the results shown in the textual representation.
But what if I don't want to edit existing objects, but to add new objects?

Apparently I can't create any ...Impl because the constructor isn't visible. I guess I can create new objects via a factory, but I couldn't find anything about that :-/

Does anyone have an idea?
Thanks a lot... as always Smile

Best,
Daniel
Re: Creating new EObjects from XtextResource [message #718397 is a reply to message #718393] Wed, 24 August 2011 08:18 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

A factory for your metamodel is generated (or already exists). Use that.
Usually if your Language is called X, the factory is XFactory.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Creating new EObjects from XtextResource [message #718403 is a reply to message #718397] Wed, 24 August 2011 08:33 Go to previous message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Thanks for the fast reply Smile

XFactory.eINSTANCE.createY() should work I guess.
Previous Topic:[xtend2] cast of lists
Next Topic:[xtend] Question on "Create Functions"
Goto Forum:
  


Current Time: Thu Apr 22 18:26:17 GMT 2021

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

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

Back to the top