Skip to main content



      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 09:06 Go to next message
Eclipse UserFriend
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 09:11 Go to previous messageGo to next message
Eclipse UserFriend
which Xtext version do you use?
and how does your scope provider look like

[Updated on: Thu, 15 September 2016 09:28] by 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 10:11 Go to previous messageGo to next message
Eclipse UserFriend
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 10:25 Go to previous messageGo to next message
Eclipse UserFriend
that looks legit. unfortunately i cannot reproduce your problem

override Class<? extends IBatchScopeProvider> bindIBatchScopeProvider() {
GeneratorModelScopeProvider
}
Re: Resolving references to elements in mixed DSL (Xbase and other models) [message #1743496 is a reply to message #1743453] Thu, 15 September 2016 21:20 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 15:14:44 EDT 2025

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

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

Back to the top