Wednesday, July 7, 2010

Velocity Web Edit Plug-in Fix for Eclipse 3.4+


Velocity Web Edit is a Velocity and HTML aware editor with the following features:
  • 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 Resource Level
There are several Velocity plug-ins available however I believe this one is superior because it has content-assist capabilities. Unfortunately, the last official version of this plug-in (1.0.8) as it exists on the SourceForge site has not been updated since Eclipse 3.3 and has a bug that prevents variable-object configuration from working for content-assist. The problem occurs when creating context variables - a NoSuchMethodException is thrown due to the removal of the getFullyQualifiedName method in the JavaModelUtil class. This problem can be corrected by performing the following tasks:
  1. Open an Eclipse 3.4+ workspace (must be on a Windows OS!)
  2. Check out the VelocityWebEdit project from the SourceForge CVS repository:
    Host: velocitywebedit.cvs.sourceforge.net
    Repository Path: /cvsroot/velocitywebedit
    User: anonymous
    Connection type: pserver
  3. Edit /src/com/hudson/velocityweb/dialogs/ContextValueDialog.java
  4. Paste in the following method:




  5. Note that I found this method on the www.java2s.com/OpenSource site.

  6. Find the following line of code:

    and replace it with:

    (Notice the new line of code doesn't reference JavaModeUtil)


  7. Right click on the VelocityWebProgram and click on Export...


  8. Click on Plug-in Development and then Deployable plug-ins and fragments. Then click the Next > button.


  9. Insure the Directory radio button is selected and choose a destination directory for the plug-in. Then click on the Finish button.


  10. In Windows File Explorer, navigate to the directory specified above and then to the plugins directory.


  11. Copy the com.hudson.velocityweb_1.0.8.jar to your Eclipse installation's dropins directory.


  12. Restart Eclipse.

No comments:

Post a Comment