最近在研究XWiki,它是支持Velocity的,所以就顺便调查了一把支持Velocity的编辑器。不过由于用惯了eclipse,自然是以eclipse的插件为主要调查方向了。
调查下来一共找到四个插件,其中一个叫veloedit,一个叫velocitywebedit,另外两个都叫veloeclipse,不过确实是两个不同的插件,一个在google code上,一个在sourceforge上。详细信息可以看参考资料。
功能简介
1. veloedit 1.0.2
- Syntax-highlight for Velocity Template Language (VTL)
- Outline view with hierarchy of VTL directives and Velocimacro references
- Content assist for VTL directives and references -> auto-activation after the character '#' or '$' or manually via keyboard shortcut Ctrl+Space
- Automatic template validation while typing (the first syntax error is show in task list and the according line is marked in annotation column)
- Annotation hover with definition of references and template syntax errors
- Go to definition of variable or Velocimacro reference under current cursor position (via context menu or keyboard shortcut F3)
- Comment and uncomment blocks (via Ctrl+/ and Ctrl+\)
- Preference pages for definition of Velocity counter name and user-defined Velocity directives
- Preference pages for color settings of the editor's syntax highlighting
- Preference pages for Velocimacro library
2. veloeclipse(google code) 2.0.8
- Smart indentation of velocity directives ( on pressing return or when using tabs)
- XML support
- Jtidy integration
- code folding
- code Formatting
- Smart indentation of html tags( on pressing return or when using tabs)
- Syntax highlighting for both html and velocity
- Autocompletion and Content assist for tags,directives and references (Ctrl + space in html attribute values or when opening or closing tags)
- jumping to statring tag/directive when hovering on the closing tag/directive and then pressing Ctrl+Alt+ mouseclick
- opening html definitions on tags when pressing Ctrl+Alt+ mouseclick
- Tested on Eclipse 3.3 and 3.4
- Supports Velocity 1.6
3. veloeclipse(sourceforge) 2.0.6
- new XML support
- new JSP(X) und JSTL support
- new Jtidy integration
- new convert your code to XHTML
- new code folding
- new compare dialog before commiting formatting or Jtidy changes
- new code Formatting
- User defined macros
- Smart indentation of velocity directives ( on pressing return or when using tabs)
- Smart indentation of html tags( on pressing return or when using tabs)
- Syntax highlighting for both html and velocity
- Autocompletion and Content assist for tags,directives and references (Ctrl + space in html attribute values or when opening or closing tags)
- Preview html code
- jumping to statring tag/directive when hovering on the closing tag/directive and then pressing Ctrl+Alt+ mouseclick
- opening html definitions on tags when pressing Ctrl+Alt+ mouseclick
4. velocitywebedit
- Customizable Syntax Hilighting
- Content Assist
- Velocity Variables Names
- Velocity Variable Methods and Properties (using Reflection)
- Javascript Function Methods
- Velocity Macro Directives
- Style Sheet Class Names
- Velocity Outline
- HTML/XML Outline With XML Node Filtering and Intuitive Images
- Smart Indenting
- Customizable DTD for XML Content Assist
- Velocity Context Object Definitions at any Resorce Level
总结
其实veloeclipse(sourceforge) 是基于veloedit进行二次开发而成的,多了很多功能。 从以上的功能列表对比来看,veloeclipse(sourceforge)无疑是很有优势的。不过我最近对google code挺有好感的,而且 veloeclipse(google code)也直接宣称自己支持Velocity 1.6,所以就直接选用这一个了。等以后有更大需求的话,再判断是否需要使用 veloeclipse(sourceforge)。
一点安装经验
这几个插件除velocitywebedit外,都是通过在线的update方式安装的,对于一些网速不怎么样或者无法访问网络的人来说,确实是很痛苦的。我这里以veloeclipse(google code)为例给个先下载再安装的手顺。从 http://veloeclipse.googlecode.com/svn/trunk/update/features/ 页面上,下载feature的最新版本(如com.googlecode.veloeclipse.ui_2.0.8.jar),从 http://veloeclipse.googlecode.com/svn/trunk/update/plugins/ 页面上,下载plugin的最新版本(如com.googlecode.veloeclipse.ui_2.0.8.jar)。然后把两个jar分别 解压缩到同名文件夹com.googlecode.veloeclipse.ui_2.0.8下,再把这两个jar分别拷贝到eclipse的features和plugins目录下,重新启动eclipse就可以了。
我使用的是eclipse的galileo版本(3.5),并且成功安装了veloeclipse(google code)。
如果对eclipse插件的安装方法感兴趣,可以参考我的另外一篇博客:eclipse中安装插件的几种方法
参考资料
1. veloedit: http://veloedit.sourceforge.net
2. veloeclipse(google code):http://code.google.com/p/veloeclipse
3. veloeclipse(sourceforge):http://propsorter.sourceforge.net/veloeclipse
4. velocitywebedit: http://velocitywebedit.sourceforge.net/
5. Velocity官网:http://velocity.apache.org
6. Velocity官网上的Editors:http://wiki.apache.org/velocity/VelocityEditors
转http://blog.csdn.net/superbeck/archive/2010/07/08/5721382.aspx