Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Customize save action
Customize save action [message #668585] Fri, 06 May 2011 10:55 Go to next message
Luigi  is currently offline Luigi Friend
Messages: 5
Registered: April 2011
Junior Member
Hi All,

I created a new editor using xText, when the file is saved, I need to generate(or overwrite) automatically a new file containing the result of the myFile manipulation.

It is possible to customize 'SAVE ACTION' of my editor created by Xtext?

If is possible, how I can start??


Thanks,

Luigi
Re: Customize save action [message #668628 is a reply to message #668585] Fri, 06 May 2011 13:44 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

have a look at the domain model example shipped with Xtext. What you want is a builder participant, that starts generation when a resource is changed. It is not necessary to modify the save action (although that is possible of course).

Alex
Re: Customize save action [message #669419 is a reply to message #668628] Tue, 10 May 2011 09:44 Go to previous messageGo to next message
Luigi  is currently offline Luigi Friend
Messages: 5
Registered: April 2011
Junior Member
Very Happy Very Happy Very Happy

Thanks for your help, your suggestion is just what I need.
So I must add a new extension point like this:

<extension point="org.eclipse.xtext.builder.participant">
    <participant          class="org.eclipse.xtext.example.ui.DomainmodelExecutableExtensionFactory:org.eclipse.xtext.example.ui.generator.Generator">
    </participant>
 </extension>


where org.eclipse.xtext.example.ui.generator.Generator is a class that implements IXtextBuilderParticipant or the project needs something else?
Re: Customize save action [message #669430 is a reply to message #669419] Tue, 10 May 2011 10:26 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

I guess that's enough (have a go and see if your class is used in a build). Make sure you use the ExecutableExtensionFactory of your own language (there should be plenty of references to it in the plugin.xml), so that your builder participant class is instantiated correctly.

Alex
Previous Topic:[MWE2] Error executing workflow file
Next Topic:Element with the same name but different type
Goto Forum:
  


Current Time: Thu Apr 25 23:32:43 GMT 2024

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

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

Back to the top