Friday, August 14, 2009

Making xtext, eclipse and guice work together

There is a new entry in the xtext documentation dealing with enabling guice for your Xtext Editor.

This is pretty useful, though the same concept used to work before it only found its way into the documentation now. Hence I just wanted to share that information with you. Works really well.

<extension
point="org.eclipse.ui.editors">
<editor
class="<MyLanguageName>ExecutableExtensionFactory:
org.eclipse.xtext.ui.core.editor.XtextEditor"
contributorClass=
"org.eclipse.ui.editors.text.TextEditorActionContributor"
default="true"
extensions="ecoredsl"
id="org.eclipse.xtext.example.EcoreDsl"
name="EcoreDsl Editor">
</editor>
</extension>

Please not that MyLanguageName is actually the name of the factory you can find in your src folder of the UI-Project under your main package.

And now, if you'd like to write some ActionHandler for your xtext outline view, you can do just the same. Simply prefix the Handler class with the factory, and there you go!

No comments:

Post a Comment