Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does one need the Eclipse Snippets View when editor templates already exist?

Tags:

eclipse

What are the tradeoffs of the Eclipse Snippets View vs. editor templates? Why were Snippets introduced in the first place?

like image 606
Debajit Avatar asked Feb 03 '09 20:02

Debajit


1 Answers

Snippets appear to be a custom version of templates, with a view in the perspective and GUI dialogs to prompt for variable values in the template.

The only "new" functionality they have is to offer up their functionality through toolbar items in the editors.

Snippets view is sort of an extension proposed by WTP (Web Tool Platform) for template, more oriented to (web) code formatting, whereas templates help the user enter reoccurring patterns into a text editor.


So at the beginning, Eclipse Templates was a standard eclipse feature which could only be applied for java and javadocs.

Snippets are basically the same, but for other kind of files and were introduced by WTP to fill the same need, but for their own type of files (xml, jps, html, ...)
(and this is, right there, "why snippets were introduced in the first place")


Template does not have their own view, but rather an obscure Preference page (Preferences -> Java -> Editor -> Templates)

You could at the time however write a small eclipse extension in order to make a Template View.

This has been resolved since eclipse3.4M6 (Templates have their own view)


You can also build some custom advanced snippets view

Snippets View Example

like image 70
VonC Avatar answered Oct 21 '22 10:10

VonC