Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Modify template proposal description
Modify template proposal description [message #1802618] Tue, 12 February 2019 16:53 Go to next message
Eclipse UserFriend
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 00:42 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Wed, 13 February 2019 00:46] by Moderator

Re: Modify template proposal description [message #1802679 is a reply to message #1802638] Wed, 13 February 2019 15:02 Go to previous messageGo to next message
Eclipse UserFriend
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 08:23 Go to previous messageGo to next message
Eclipse UserFriend
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 11:52 Go to previous message
Eclipse UserFriend
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
Previous Topic:PowerMockito with xtext
Next Topic:General Problem with Grammar and Generator
Goto Forum:
  


Current Time: Mon Jun 23 03:33:37 EDT 2025

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

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

Back to the top