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: 14661
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


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: 157
Registered: February 2016
Senior 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: 14661
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


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: Thu Mar 28 12:04:12 GMT 2024

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

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

Back to the top