Why do you need Eclipse Snippets View when editor templates already exist?

What are the tradeoffs between the Eclipse screen comment templates and the editor templates? Why were the fragments presented first?

+7
eclipse
source share
2 answers

In addition, the Snippets presentation was first conceived during the development time period between Eclipse 1.0 and 2.0, before the content support templates were somewhere close to being as capable as they are now. That's why it was created and just got into WTP as part of IBM's initial contribution to the project.

+2
source share

Fragments are a customizable version of templates with a representation in perspectives and dialog boxes of the graphical interface for querying the values ​​of variables in the template.

The only β€œnew” functionality they have is to offer their functions through toolbar elements in editors.

Snippet Viewer is an extension offered by the WTP (Web Tool Platform) for the template, more focused on (web) formatting of the code, while templates helps the user to enter repeating patterns into a text editor.


So, at the beginning, Eclipse Templates was a standard eclipse function that could only be applied to java and javadocs.

The fragments are basically the same, but for other file types and WTP were added to fill the same need, but for their own file type (xml, jps, html, ...)
(and this, right there, "why the fragments were first introduced")


The template does not have its own presentation, but rather an obscure preference page ( Preferences -> Java -> Editor -> Templates )

At that time, you could write a small eclipse extension to create a template view.

This was allowed with eclipse3.4M6 (templates have their own look)


You can also create custom rich snippet descriptions.

Snippets View Example

+7
source share

All Articles