Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ScopeProvider in xtext 2.2.1
ScopeProvider in xtext 2.2.1 [message #842620] Thu, 12 April 2012 13:08 Go to next message
Goran M. is currently offline Goran M.Friend
Messages: 12
Registered: April 2012
Junior Member
Hi,

can somebody please tell me how I can configure my own ScopeProvider?
I found thousands of code snippets how a ScopeProvider looks like, but I cannot
find where I have to configure it, to be accessible... :?

I created a Xtext-project (2.2.1) with eclipse. I wrote my DSL and executed "Run as..."
I have no individual ScopeProvider class like the individual ProposalProvider class.
So, if I implement the IScope interface, somehow I have to configure that I got
an individual ScopeProvider...but where?????

I tried the DSL-RuntimeModule class and I have overridden the configure-method:

@Override
public void configure(Binder binder) {
     super.configure(binder);
     binder.bind(IScopeProvider.class).to(BiproScopeProvider.class);
}


But if I start the other eclipse workbench I got an exception:

1    [main] ERROR de.gwvs.bipro.scripting.editor.ui.BiproScriptExecutableExtensionFactory  - com.google.common.util.concurrent.UncheckedExecutionException: com.google.inject.CreationException: Guice creation errors:

1) A binding to org.eclipse.xtext.scoping.IScopeProvider was already configured at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55).
  at de.gwvs.bipro.scripting.editor.BiproScriptRuntimeModule.configure(BiproScriptRuntimeModule.java:22)

1 error



What can I do????

Regards
Goran

[Updated on: Thu, 12 April 2012 13:20]

Report message to a moderator

Re: ScopeProvider in xtext 2.2.1 [message #842627 is a reply to message #842620] Thu, 12 April 2012 13:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Simply override the configure/bind/whatever method from the superclass

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: ScopeProvider in xtext 2.2.1 [message #1106657 is a reply to message #842627] Wed, 11 September 2013 11:22 Go to previous messageGo to next message
Stefan Mijatov is currently offline Stefan MijatovFriend
Messages: 59
Registered: March 2010
Location: Vienna, Austria
Member
Hi Goran. I have the same error. Did you manage to solve this and exactly how?
Reply from Christian is vague and I could not figure out what method is he referring to..
Re: ScopeProvider in xtext 2.2.1 [message #1106660 is a reply to message #1106657] Wed, 11 September 2013 11:31 Go to previous message
kamo cuvao is currently offline kamo cuvaoFriend
Messages: 11
Registered: July 2013
Junior Member
Try one of these overrides in MyDslRuntimeModule

//For the ScopeProvider
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
	// TODO Auto-generated method stub
	return MyScopeProvider.class;
}

//For the GlobalScopeProvider
@Override
public Class<? extends IGlobalScopeProvider> bindIGlobalScopeProvider() {
	// TODO Auto-generated method stub
	return MyGlobalScopeProvider.class;
}

//For the ImportedNamespaceArareLocalScopeProvider
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
	binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
	.annotatedWith(com.google.inject.name.Names.named(
			org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
			.to(MyDslImportedNamespaceAwareLocalScopeProvider.class);
}


I think the error is thrown, because you have created a new binding instead of overwriting an existing one, so you have two bindings on one class.

[Updated on: Wed, 11 September 2013 11:31]

Report message to a moderator

Previous Topic:another resource element's give reference automatically in the current resource
Next Topic:Problem in my custom XbaseJavaValidator
Goto Forum:
  


Current Time: Fri Apr 26 07:54:10 GMT 2024

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

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

Back to the top