Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Henshin/Xtext Adapter

< Henshin
Revision as of 09:24, 5 January 2020 by Unnamed Poltroon (Talk) (Created page with "'''Henshin Xtext adapter''' is a plugin that allows Henshin modules, rules, nodes etc to be referenced directly from any Xtext-based language. To do this, you must: * Add...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Henshin Xtext adapter is a plugin that allows Henshin modules, rules, nodes etc to be referenced directly from any Xtext-based language. To do this, you must:

  • Add org.eclipse.emf.henshin.adapters.xtext and org.eclipse.emf.henshin.model to the dependencies of your Xtext language plugin (and potentially your test plugin).
  • Add org.eclipse.emf.henshin.adapters.xtext to the dependencies of your language's .ui plugin.
  • Add referencedResource = "platform:/resource/org.eclipse.emf.henshin.model/model/henshin.genmodel" to the StandardLanguage block in your .mwe2 file.
  • Add import "http://www.eclipse.org/emf/2011/Henshin" as henshin to your .xtext file.
  • Use [henshin::Module] etc in your grammar to reference Henshin meta-classes.

By default, links have no name in Henshin. To allow them to be referenced nonetheless, the plugins generate names following the grammar rule below:

LinkName :
	"[" ID "->" ID ":" ID "]"
;

The first ID is the name of the source node, the second the name of the target node, while the third is the name of the EReference. This naming scheme can be imported into any class in your own code by statically importing org.eclipse.emf.henshin.adapters.xtext.NamingHelper. In an Xtend class, it is recommended to import the class as an extension.

Credits and links

Back to the top