Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Henshin/Xtext Adapter"

(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...")
 
Line 4: Line 4:
 
*  Add ''org.eclipse.emf.henshin.adapters.xtext'' to the dependencies of your language's .ui 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 ''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.
+
*  Add ''import "<nowiki>http://www.eclipse.org/emf/2011/Henshin</nowiki>" as henshin'' to your .xtext file.
 
*  Use ''[henshin::Module]'' etc in your grammar to reference Henshin meta-classes.
 
*  Use ''[henshin::Module]'' etc in your grammar to reference Henshin meta-classes.
  

Revision as of 10:51, 5 January 2020

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