1

I am developing a plugin which gives me access to the editor templates inside eclipse.

The ones I'd like access to are those access by going to Window -> Preferences -> Java -> Editor -> Templates

I have already tried the solutions given on these links:

Eclipse: Accessing a editor template from plugin code

Contributing a template to Eclipse via a Plugin to the Java Editor, but should vary based on the context

The solutions given in the links above give access to the templates which one accesses by going to Window -> Preferences -> Java -> Code Style -> Code Templates, which I don't want.

Add Java code template programmatically

Also, I looked at the source of JavaTemplatePreferencePage.java in order to find some code that I could use or probably get a hint from, but I didn't find anything useful.

Community
  • 1
  • 1
Saqib Shamsi
  • 522
  • 6
  • 15
  • This [answer](http://stackoverflow.com/a/29461347/2670892) to your first link looks correct to me. It is using code from the internal class `org.eclipse.jdt.internal.ui.JavaPlugin` – greg-449 Aug 27 '15 at 13:40
  • @greg-449 I tried that. It doesn't work. Just to confirm whether I'm accessing the right templates, when I tried printing their names, this is what I got: `gettercomment settercomment constructorcomment filecomment typecomment fieldcomment methodcomment overridecomment delegatecomment newtype classbody interfacebody enumbody annotationbody catchblock methodbody constructorbody getterbody setterbody` – Saqib Shamsi Aug 28 '15 at 05:02

0 Answers0