最近在研究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中安裝插件的幾種方法