Skip to main content



      Home
Home » Modeling » TMF (Xtext) » content assist problem
content assist problem [message #868603] Wed, 02 May 2012 05:29 Go to next message
Eclipse UserFriend
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 07:44 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: content assist problem [message #868731 is a reply to message #868677] Wed, 02 May 2012 09:11 Go to previous messageGo to next message
Eclipse UserFriend
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 04:05 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: content assist problem [message #869387 is a reply to message #869312] Thu, 03 May 2012 06:25 Go to previous message
Eclipse UserFriend
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: Fri Jul 25 01:45:17 EDT 2025

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

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

Back to the top