Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » content assist problem
content assist problem [message #868603] Wed, 02 May 2012 09:29 Go to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Hi

I wonder if I can do a thing! Suppose I have my interface and want to instantiate in IMyinterfaces MyDslProposalProvider I did this thing ... I'll post my code

public class MyDslProposalProvider extends AbstractMyDslProposalProvider {

Injector injector=Guice.createInjector();
IMyinterfaces nameistance=injector.getInstance(IMyinterfaces.class)

//after

@Override
public void completeAttributo_Name(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
for (String proposal :nameistance.getProposalFor(ProposalType.ATTRIBBUTE)) {
acceptor.accept(createCompletionProposal(proposal, context));
}
}


First of all I could do this thing .... is right?? or how should I do?
The infrastructure is built correctly, but when I start the application
appropriately tells me that there are these errors

1 [main] ERROR org.xtext.example.mydsl.ui.MyDslExecutableExtensionFactory - com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.xtext.example.mydsl.ui.contentassist.IMyinterfaces was bound.

I think because the implementation is lacking .... how am I to do? where can I implement in order to test if it works!
Excuse me but what the documentation does not understand much!!
thanks Embarrassed
Re: content assist problem [message #868677 is a reply to message #868603] Wed, 02 May 2012 11:44 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

a short answer is: in your snippet, you create a new injector (without any bindings) and then try to get an instance of IMyinterfaces from it. Of course, no implementation is bound.
Usually, you define a binding in the existing module (here the UIModule, you cannot only override existing bindings, but define additional ones... for your own interfaces) and then use the inject annotation in order to obtain an instance.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: content assist problem [message #868731 is a reply to message #868677] Wed, 02 May 2012 13:11 Go to previous messageGo to next message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
I'm sorry I almost understand ...... but do you mind if I do as a courtesy?
Re: content assist problem [message #869312 is a reply to message #868731] Thu, 03 May 2012 08:05 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
What does your IMyinterfaces.class look like. Do you actually have an implementation of that interface, if so how many?
Before using injection, have you tried out your content assist method with an actual instance (nameinstance not instantiated via injection but via constructor)?

As to the injection part:

-in your MyDdlUIModule you write
public Class<? extends IMyinterfaces> bindIMyInterfaces() {
		return MyInterfacesImplementation.class;
	}

-in MyDslProposalProvider you write
@Inject
IMyinterfaces nameistance;


Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: content assist problem [message #869387 is a reply to message #869312] Thu, 03 May 2012 10:25 Go to previous message
Gianluca Viscomi is currently offline Gianluca ViscomiFriend
Messages: 33
Registered: April 2012
Location: Italy
Member
Ho risolto grazie tante tante Alexander!!!!
Previous Topic:trying to understand jvmInferer and JvmModelAssociator.getLogicalContainer
Next Topic:Validation with the Check Language across multiple files
Goto Forum:
  


Current Time: Sat Dec 05 00:53:50 GMT 2020

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

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

Back to the top