以编程方式添加代码模板? [英] Programmatically add code templates?
问题描述
< ab:mytag
并按ctrl + space时,可以选择使用默认/虚拟参数插入一段文本。 但是这应该仅在XML编辑器中可用。我将如何解决这个问题?
澄清:我正在谈论的模板是可写的例子,如syso在你的java编辑器中,然后按ctrl + space。在首选项中,您可以添加自己的模板。
我想做的是定义我自己的模板,对于我自己的XML标签,但是我想在代码中执行此操作,只会影响我的编辑器。
经过多次搜索,我发现这个ppt,几乎回答了我所有的问题:
我以后的模板可以使用扩展点org.eclipse.ui.editors.templates
进行编程添加
I'm writing a custom XML editor for our project and want to add support for templates. I.e when the user writes "<ab:mytag
" and presses ctrl + space they get the option of inserting a chunk of text with a default/dummy parameters.
But this should be available only in the XML editor. How would I go about this?
Clarification: The templates I'm talking about are the ones available when you write for example "syso" in your java editor and press ctrl + space. In preferences you can add your own templates. What I want to do is do define my own templates, for my own XML tags, but I want to do this in the code and have it only effect my editor
After alot of searching I fount this ppt that answered almost all questions I had:
The templates I was after can programatically be added with the use of the extension point org.eclipse.ui.editors.templates
这篇关于以编程方式添加代码模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!