Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Extending the Xtext Generator
Extending the Xtext Generator [message #1692552] Thu, 16 April 2015 12:51 Go to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo HerreraFriend
Messages: 260
Registered: July 2009
Senior Member
Hi folks,

I'm trying to extend the Xtext generator so that, for instance, the generated MyDSLOutlineTreeProvider extends a CustomOutlineTreeProvider rather than the default one.

I started with trying a custom OutlineTreeProviderFragment extension, but the documentation says that fragment extensions are "rarely" needed, and indeed those fragments seem to involve some xpt files which I don't know what they are.

Any hint about how to approach with this kind of extension for the Xtext Generator.

Cheers,
Adolfo.
Re: Extending the Xtext Generator [message #1692554 is a reply to message #1692552] Thu, 16 April 2015 12:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi,

this question cannot be answered generally. the answer is "it depends" (on the fragment, on the kind of adoption, ...)

The generated outline tree provider is a generate once class so you would no adapt a fragment but simply change the class.
Or simply remove the fragment and add your own.

Some Fragments use Xtend, some use xpand. it should be possible to adopt it.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Extending the Xtext Generator [message #1692571 is a reply to message #1692552] Thu, 16 April 2015 14:37 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7099
Registered: July 2009
Senior Member
Hi

IMHO the Outline is an area where Xtext does not do itself justice.

There could very easily be an Outline language with an Xtext editor to
define outlines.

The old org.eclipse.ocl.examples.editor.model was just such a model, but
with only a tree editor.

The new OCL autogeneration should be useable for a CS2Outline mapping
defined in OCL so that we get the benefit of accurate incremental rather
than total refresh.

Regards

Ed Willink

On 16/04/2015 13:52, Adolfo Sanchez-Barbudo Herrera wrote:
> Hi folks,
>
> I'm trying to extend the Xtext generator so that, for instance, the
> generated MyDSLOutlineTreeProvider extends a CustomOutlineTreeProvider
> rather than the default one.
>
> I started with trying a custom OutlineTreeProviderFragment extension,
> but the documentation says that fragment extensions are "rarely"
> needed, and indeed those fragments seem to involve some xpt files
> which I don't know what they are.
>
> Any hint about how to approach with this kind of extension for the
> Xtext Generator.
>
> Cheers,
> Adolfo.
Re: Extending the Xtext Generator [message #1692594 is a reply to message #1692554] Thu, 16 April 2015 16:39 Go to previous message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo HerreraFriend
Messages: 260
Registered: July 2009
Senior Member
Hi Christian,

Thanks for the quick response and hints. So, those .xpt files are Xpand files which, AFAI have looked into, to be recognised they just need to have the name of the fragment class. Good.

I've not used Xpand before, but by taking the OutlineTreeProviderFragment.xpt as a guide (and after dealing with a minor file encoding issue), I've managed to successfully make the fragment extension work as I had planned.

Cheers,
Adolfo.
Previous Topic:difference terminals and datatypes
Next Topic:templates as a menu
Goto Forum:
  


Current Time: Tue Apr 20 07:12:52 GMT 2021

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

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

Back to the top