Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (17 sloc) 1.54 KB

Reflective Editor for Xtext resources

It is useful to open Xtext resources in EMF tree editors, e.g. in the Sample Reflective Ecore Model Editor. However, in several cases, e.g. when using Xbase expressions, it is required to initialize a specific resource-set that initializes the Xtext environment.

This Xtext extension provides a generator fragment for Xtext workflows that adds this feature to existing languages.

For more details, look at the announcement blog post or download it from the update site: http://eclipse.cubussapiens.hu

Usage

  1. Add hu.cubussapiens.xtext.reflectiveeditor as a dependency to your language project.
  2. Add import hu.cubussapiens.xtext.reflectiveeditor.generator.* to the editor generation workflow.
  3. Add the reflective editor generation fragment after the last fragment in your workflow file, as seen below.
  4. Regenerate your editor
  5. Make sure, that the new editor extension generated in plugin.xml_gen is copied to plugin.xml. If not, copy it manually.
  6. Then your model files can be opened with a specific, reflective editor. Use Open with / «Languagename» Reflective Editor.

Reflective Editor Generator fragment

The reflective editor generation fragment was created similar to existing fragments. The file.extensions parameter is defined
the same way in the default Xtext 2.0 workflow file.

fragment = ReflectiveXtextEditorFragment {
	fileExtensions = file.extensions
}