Having the templates handy as a view will help in heavier use of templates. If you are interested in this update please vote for this enhancement at Eclipse Bugzilla.
Now for the quick fix.
Fortunately, both the viewpart and preferencepage are similar. A small plugin can convert the preference page to a view. What I have done is to take eclipse example view plugin (called SampleView). Remove all the code leaving the definition for the createPartControl() and setFocus(). Add this code in the createPartControl():
public void createPartControl(Composite parent) {
PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
parent.getShell(),
"org.eclipse.jdt.ui.preferences.JavaTemplatePreferencePage",
new String[] {}, null);
PreferencePage selectedPage =
(PreferencePage) dialog.getSelectedPage();
selectedPage.createControl(parent);
}
Create the plugin and deploy it. You have the view that shows the template preference page (see the image below).
From this view, you can add/edit the templates.
From this view, you can add/edit the templates.
Incidentally, this trick should work for any preference page that is derived from PreferencePage class.
3 comments:
Very good!!! I liked a lot this tip. :)
Thanks.
Grateful forr sharing this
Post a Comment