Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Resolving references to elements in mixed DSL (Xbase and other models)(I try to resolve references to other DSL models within an Xbase based DSL)
Resolving references to elements in mixed DSL (Xbase and other models) [message #1743437] Thu, 15 September 2016 13:06 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I have a DSL which is based on Xbase but uses other models too.
I can not get resolved my references to other model elements.
I tinkered with the scope provider but it does not work.
It seems the scope provider is not used for reference resolution in Xbase based DSLs.
Where I have to provide the resolutions for references in an Xbase based DSL ?
Re: Resolving references to elements in mixed DSL (Xbase and other models) [message #1743439 is a reply to message #1743437] Thu, 15 September 2016 13:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
which Xtext version do you use?
and how does your scope provider look like


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 15 September 2016 13:28]

Report message to a moderator

Re: Resolving references to elements in mixed DSL (Xbase and other models) [message #1743451 is a reply to message #1743439] Thu, 15 September 2016 14:11 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
The project was created with Xtext 2.8 but I am running eclipse neon with Xtext 2.10.
class GeneratorModelScopeProvider extends XbaseBatchScopeProvider {
	
	@Inject GeneratorModelDelegateScopeProvider delegate
	
	override IScope getScope(EObject context, EReference reference) {
		var scope = delegate.getScope(context, reference)
		if (scope == null) {
			scope = super.getScope(context, reference)
		}
		scope
	}
	
}

class GeneratorModelDelegateScopeProvider extends AbstractDeclarativeScopeProvider {
	
	def IScope scope_PrefixDefinition_counter(EObject model, EReference reference) {
		....
	}
	def IScope scope_GeneratorContentGroup_model(EObject model, EReference reference) {
		
		...
	}
	def IScope scope_ContentManager_generatorState(EObject model, EReference reference) {
		
		...
	}
	def IScope scope_ContentDeclaration_targetClass(EObject model, EReference reference) {
		
		...
	}
	def IScope scope_ContentDispatcher_targetClass(EObject model, EReference reference) {
		
		...
	}
	...
}


I have debugged the scope provider but it seems to be called only in the context of quickfix resolution. The produced scope does contain the requested reference.
Re: Resolving references to elements in mixed DSL (Xbase and other models) [message #1743453 is a reply to message #1743451] Thu, 15 September 2016 14:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
that looks legit. unfortunately i cannot reproduce your problem

override Class<? extends IBatchScopeProvider> bindIBatchScopeProvider() {
GeneratorModelScopeProvider
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolving references to elements in mixed DSL (Xbase and other models) [message #1743496 is a reply to message #1743453] Fri, 16 September 2016 01:20 Go to previous message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Thank you, that does the trick.
Previous Topic:Integrating Xbase in my DSL. How to activate scoping and validation?
Next Topic:XText Web Editor problem with OCL Constraints using Pivot Evaluator
Goto Forum:
  


Current Time: Mon Apr 19 13:44:59 GMT 2021

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

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

Back to the top