Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » IProposalConflictHelper not respecting Module binding(IProposalConflictHelper not being bound to AntlrProposalConflictHelper)
IProposalConflictHelper not respecting Module binding [message #1858610] Tue, 11 April 2023 20:38 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 234
Registered: October 2009
Location: Mexico
Senior Member

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 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14496
Registered: July 2009
Senior Member
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());
}

}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IProposalConflictHelper not respecting Module binding [message #1858629 is a reply to message #1858613] Wed, 12 April 2023 15:02 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 234
Registered: October 2009
Location: Mexico
Senior Member

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 #1858632 is a reply to message #1858629] Wed, 12 April 2023 15:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14496
Registered: July 2009
Senior Member
if you use eclipse ui and UiToIdeContentProposalProvider then you needs to to do the ide binding to the ui module.
the ide module is not used in ui


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IProposalConflictHelper not respecting Module binding [message #1858650 is a reply to message #1858632] Thu, 13 April 2023 14:02 Go to previous message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 234
Registered: October 2009
Location: Mexico
Senior Member

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
Previous Topic:Xtext 2.31.0.M0 is out
Next Topic:Auto format Xtext textual model
Goto Forum:
  


Current Time: Sat Jun 03 22:56:15 GMT 2023

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

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

Back to the top