Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Modify template proposal description
Modify template proposal description [message #1802618] Tue, 12 February 2019 21:53 Go to next message
Martin Rud is currently offline Martin RudFriend
Messages: 7
Registered: February 2019
Junior Member
Is there a way to modify template proposal description?

I made a templates.xml file and I can use templates which were defined in that file, but I also need to change proposal's description (a text in a little yellow window which appears beside a window with proposals).
Re: Modify template proposal description [message #1802638 is a reply to message #1802618] Wed, 13 February 2019 05:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Xtext ususally binds
org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider

org.eclipse.xtext.ui.editor.templates.AbstractTemplateProposalProvider.doCreateProposal(Template, TemplateContext, ContentAssistContext, Image, int)
create a XtextTemplateProposal

which is a org.eclipse.jface.text.templates.TemplateProposal which offers org.eclipse.jface.text.templates.TemplateProposal.getAdditionalProposalInfo() and thus implements org.eclipse.jface.text.contentassist.ICompletionProposal.getAdditionalProposalInfo()
and is implemented by XtextTemplateProposal

=> speciizing DefaultTemplateProposalProvider,
creating a sublclass of XtextTemplateProposal with getAdditionalProposalInfo
+ override to bind org.eclipse.xtext.ui.DefaultUiModule.bindITemplateProposalProvider()
should do the trick


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 13 February 2019 05:46]

Report message to a moderator

Re: Modify template proposal description [message #1802679 is a reply to message #1802638] Wed, 13 February 2019 20:02 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 72
Registered: February 2016
Member
For an example see https://github.com/eclipse/gef/blob/master/org.eclipse.gef.dot.ui/src/org/eclipse/gef/dot/internal/ui/language/contentassist/DotTemplateProposalProvider.java
Re: Modify template proposal description [message #1802801 is a reply to message #1802679] Sat, 16 February 2019 13:23 Go to previous messageGo to next message
Martin Rud is currently offline Martin RudFriend
Messages: 7
Registered: February 2019
Junior Member
Thank you both!

I created a new class inside mydsl.ui.contentassist package which extends DefaultTemplateProposalProvider and which was binded inside UiModule class.

I also created a new class which extends XtextTemplateProposal but I don't know where to instantiate that class.
Re: Modify template proposal description [message #1802804 is a reply to message #1802801] Sat, 16 February 2019 16:52 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
i dont understand your problem. from my answer

Quote:

org.eclipse.xtext.ui.editor.templates.AbstractTemplateProposalProvider.doCreateProposal(Template, TemplateContext, ContentAssistContext, Image, int)
create a XtextTemplateProposal


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:PowerMockito with xtext
Next Topic:General Problem with Grammar and Generator
Goto Forum:
  


Current Time: Mon Dec 09 10:52:29 GMT 2019

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

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

Back to the top