Sunday, February 21, 2010

Xtext Valueconverters

I just stumpled across a link which explains very nicely how to use value converters in Xtext and thought I just cross post it:
Petter's Random Thoughts on Software: Xtext Valueconverter

The blog post had been written by Petter Graf, probably you would like to check out his other postings.

Tuesday, February 16, 2010

Xtext, guice and IExecutableExtensionFactory

Consider that you have written an eclipse plugin using Xtext and added some custom made commands, handlers, menu items ... to your code.

Quite possibly you will want to use google guice sooner or later in your custom code, either to use the advantages of this dependency injection framework yourself, or to access some of the objects which are provided by your xtext plugin, and which you want to inject in your code.

In this case the IExecutableExtensionFactory mechanism provided by eclipse and in a more concrete manner either the subclass of org.eclipse.xtext.ui.core.guice.AbstractGuiceAwareExecutableExtensionFactory which is automatically generated for your ui plugin of the Xtext language. You can also subclass the AbstractGuiceAwareExecutableExtensionFactory yourself, if you do not want to or cannot modify your module definition for guice generated by Xtext. Looking at the generated example should be enough documentation to get you started.

Once you are done, all you need to do is to add the factory in front of your class descriptions in any of the extensions you are using and the class becomes part of the injection container and can "receive" injections:


<extension>
    <handler class="my.package.MyFactory:my.package.handler.SomeHandler" commandId="commandid">
   </handler>
</extension>


That's all and you are ready to go.

Wednesday, February 3, 2010

TMF Xtext 0.8M5 is out...

I could not find any release notes yet, but you may point your update manager to

http://download.eclipse.org/modeling/tmf/updates/milestones/

in order to get the new release.