Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JvmType content proposal
JvmType content proposal [message #1758929] Tue, 04 April 2017 16:54 Go to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
Hello there,

I need a part of my dsl to refer to a subclass of a certain type. So I followed the content proposal method described on Karsten's blog
override public void completeJvmParameterizedTypeReference_Type(EObject model, Assignment assignment,
	ContentAssistContext context, ICompletionProposalAcceptor acceptor)
{
	if (EcoreUtil2.getContainerOfType(model, Input) !== null || EcoreUtil2.getContainerOfType(model, Rule) !== null)
	{
		val jvmTypeProvider = jvmTypeProviderFactory.createTypeProvider(model.eResource().getResourceSet());
		val interfaceToImplement = jvmTypeProvider.findTypeByName("com.pc360.configurator.interfaces.Configurable")

		typeProposalProvider.createSubTypeProposals(interfaceToImplement, this, context,
			RuleDslPackage.Literals.INPUT__CONFIGURABLE, TypeMatchFilters.canInstantiate(), acceptor);
	}
	else
	{
		super.completeJvmParameterizedTypeReference_Type(model, assignment, context, acceptor);
	}
}


This works exactly as assumed. The list of subclasses appears in the proposal popup. But, I have two problems:

1- If I select any value, it's not output in the editor. I don't see any errors. Just nothing happens.

2- If I input anything (as a prefix), I would expect it to be applied as an added filter. But it doesn't return anything anymore.


Thanks for your suggestions,

[Updated on: Tue, 04 April 2017 16:56]

Report message to a moderator

Re: JvmType content proposal [message #1758931 is a reply to message #1758929] Tue, 04 April 2017 16:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
Can you please share a complete reproducible example so that I can have a look without having to spend many minutes reproducing it

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: JvmType content proposal [message #1758933 is a reply to message #1758931] Tue, 04 April 2017 17:18 Go to previous messageGo to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
Hi Christian,

I'll have to run more tests, because I have created a sample dsl and it works as expected.
Re: JvmType content proposal [message #1758942 is a reply to message #1758933] Tue, 04 April 2017 17:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
Well this is why I am asking Wink


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

[Updated on: Tue, 04 April 2017 17:32]

Report message to a moderator

Re: JvmType content proposal [message #1758951 is a reply to message #1758933] Tue, 04 April 2017 18:33 Go to previous messageGo to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
I have prepared something for you.
Would you kindly contact me by email, please?
I am not at liberty to publish a public link for that.

Thanks!
Re: JvmType content proposal [message #1758952 is a reply to message #1758951] Tue, 04 April 2017 18:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
Yes you can send me a email

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: JvmType content proposal [message #1758953 is a reply to message #1758952] Tue, 04 April 2017 18:37 Go to previous messageGo to next message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
at which address please ?
Re: JvmType content proposal [message #1758955 is a reply to message #1758953] Tue, 04 April 2017 19:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
in the log you can find this error message

8939 [main] ERROR org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider$FQNImporter - Could not find unique type named 'a.b.c.Test' in scope

there is actually no entry inside scope.

this is caused by your faulty impl of the proposal provider (you use the wrong reference, well it actually is not a cross ref at all but a containment ref.

typeProposalProvider.createSubTypeProposals(interfaceToImplement, this, context,
TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, TypeMatchFilters.canInstantiate(), acceptor);





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: JvmType content proposal [message #1758958 is a reply to message #1758955] Tue, 04 April 2017 19:30 Go to previous message
Daniel Cardin is currently offline Daniel CardinFriend
Messages: 109
Registered: July 2009
Senior Member
wow, thanks!
It's the first time I do that and I completely missed it.

You are invaluable.

Have a great evening
Previous Topic:Optimizing build performance - observing redundant calls to isAffected and validation
Next Topic:How to customize log4j logging?
Goto Forum:
  


Current Time: Sun Oct 24 20:07:44 GMT 2021

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

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

Back to the top