IProposalConflictHelper not respecting Module binding [message #1858610] |
Tue, 11 April 2023 20:38 |
|
Hello,
I am creating an IdeContentProposalProvider for the ide project of my Xtext language. I have been debugging the provider to understand how it all works together. For some reason, the IProposalConflictHelper is being bound to the Null implementation (via its @ImplementedBy(IProposalConflictHelper.NullHelper.class) annotation) and not to the AntlrProposalConflictHelper as specified in the AbstractLanguageIdeModule.
I have debugged and it seems that the MethodBasedModule class correctly applies the module binding . Howver, in my IdeContentProposalCreator, the
@Inject
private IProposalConflictHelper conflictHelper;
is injected with the NullHelper. Any ideas? Do we need the @ImplementedBy annotation if the generated modules make the binding anyway?
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: IProposalConflictHelper not respecting Module binding [message #1858613 is a reply to message #1858610] |
Wed, 12 April 2023 04:14 |
|
hi, please note: there are two IProposalConflictHelper in two different packages
can you provide a small reproducing unit test / java main
in domain model example i cannot reproduce.
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
import com.google.inject.Inject;
public class Thing {
@Inject
IProposalConflictHelper h;
public static void main(String[] args) {
Thing t = new DomainmodelIdeSetup()
.createInjectorAndDoEMFRegistration().getInstance(Thing.class);
System.out.println(t.h.getClass());
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
Re: IProposalConflictHelper not respecting Module binding [message #1858629 is a reply to message #1858613] |
Wed, 12 April 2023 15:02 |
|
Hi ,
I ran the Java main you provided and got:
class org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper
so I guess the binding does work in this minimal example. However, I am still getting the Null binding when running a nested Eclipse. I enabled TRACE logging and found only one binding, the UI:
TRACE BindModule - Adding binding from interface org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper to org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper. Declaring Method was 'public java.lang.Class<? extends org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper> org.eclipse.emf.emfatic.xtext.ui.AbstractEmfaticUiModule.bindIProposalConflictHelper()' in Module org.eclipse.xtext.service.BindModule
seems the binding is not happening for the IDE plugin.
I am reusing the IDE implementations in the UiModule:
...
public Class<? extends IContentProposalProvider> bindIContentProposalProvider() {
return UiToIdeContentProposalProvider.class;
}
@SingletonBinding(eager = true)
public Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
return EmfaticIdeCPP.class;
}
So it seems that in the binding process, the IDE IProposalConflictHelper is not being bound correctly.
Perhaps my UiModule also needs to bind the org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper, additionally to the org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper?
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
|
Re: IProposalConflictHelper not respecting Module binding [message #1858650 is a reply to message #1858632] |
Thu, 13 April 2023 14:02 |
|
that seems to do the trick. So my UiModule ended up having:
public Class<? extends IProposalConflictHelper> bindIdeIProposalConflictHelper() {
return AntlrProposalConflictHelper.class;
}
public Class<? extends IPrefixMatcher> bindIdeIPrefixMatcher() {
return FQNPrefixMatcher.class;
}
I added the prefix matcher becuase it also uses the ImplementedBy annotation and we want to make sure it uses the FQN matcher.
Thanks for your help!
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Powered by
FUDForum. Page generated in 0.03241 seconds