Skip to main content



      Home
Home » Modeling » TMF (Xtext) » See all feature accesses in Xtend files using Eclipse?
See all feature accesses in Xtend files using Eclipse? [message #1754074] Tue, 14 February 2017 06:56 Go to next message
Eclipse UserFriend
Hello everyone,

I am using Xtext to define my grammar and Xtend to generate some files. The generators access features.

To give an example, I try to keep it as easy as possible:

grammar my.language.Lang with org.eclipse.xtext.common.Terminals

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate lang "http://www.language.my/Lang"

Model:
	components+=Component*
;

Component:
	Main | Component
;

Main:  
	'Main' name=ID
	('element' element=Element)?
	'end' 'Main'
;



Element:
	'Element' name=ID
	('param1' param1=DOUBLE)?
	('param2' param2=DOUBLE)?
	'end' 'Element'
;



Now my first generator would look like this:

class MyGenerator1 {

	def generate(Main main) {
		'''
			This is the first appearance: «main.element.param1»
		'''
	}

}



And my second generator like this:

class MyGenerator2 {

	def generate(Main main) {
		'''
			This is the second appearance: «main.element.param1»
		'''
	}

}


So param1 is accessed in two generator classes. But in real life it is more complex and I would like to determine, in which classes a specific parameter is accessed.

The package my.language.lang was generated my Xtext and contains all defined rules as interfaces. Right-click on the getter of each parameter within the interface, with a leading "Open Call Hierarchy" in Eclipse only leads to the generated eGet() methods but not to the generators, which use the features.

Does anyone know, how to see, in which Xtend generators which features/parameters were accessed?
Re: See all feature accesses in Xtend files using Eclipse? [message #1754075 is a reply to message #1754074] Tue, 14 February 2017 07:02 Go to previous messageGo to next message
Eclipse UserFriend
do you know the find references feature?
simply open the Element Interface.
search the getParam1() method
do a find references search from the context menu
Re: See all feature accesses in Xtend files using Eclipse? [message #1754081 is a reply to message #1754075] Tue, 14 February 2017 07:26 Go to previous message
Eclipse UserFriend
Christian, I didn't know that but it works perfectly. Thank you very much!
Previous Topic:Modify error message from IResourceValidator
Next Topic:createProposals gets called twice within same context
Goto Forum:
  


Current Time: Wed Jul 16 11:09:36 EDT 2025

Powered by FUDForum. Page generated in 0.03337 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top