Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:56 Go to next message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013
Member
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 12:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 10524
Registered: July 2009
Senior Member
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 12:26 Go to previous message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013
Member
Christian, I didn't know that but it works perfectly. Thank you very much!
Previous Topic:How to fix warning on bidirectional reference
Next Topic:How to disable error message from Composite EValidator
Goto Forum:
  


Current Time: Tue May 23 01:14:36 GMT 2017

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

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