This page contains some coding conventions for the Groovy-Eclipse project.
Copying code from Eclipse and JDT
In general, we want to avoid copying code from JDT and Eclipse. Instead, the preferred way to extend or borrow Eclipse functionality is to use sub-classing and reflection. Where this approach is not possible or it is unwieldy, it may be reasonable to copy an entire file. Here are the guidelines for doing this:
- Add the copied file to the jdt_patch source folder in the plugin. (If this doesn't exist yet, then create it.)
- Change the package name by prefixing 'greclipse." to the package.
- First line of the file should describe where it comes from (fully qualified name, plugin, etc).
- Start all changes with // GROOVY start and all changes with // GROOVY end
- No need to do this for imports and package declarations
Code formatting, templates, and code cleanups
Please import the following files into your Eclipse preferences and use these when making changes to the GRECLIPSE project.
Task tags in code
Do not use TODO tags. Instead use something like FIXADE (where instead of ADE, use your initials). And after the FIXADE tag, you can optionally include a version number that this change should be applied to (eg- // FIXADE (2.1.0) )
In general, unless there is a good reason not to, errors should be logged to the error log. To do this, in the catch clause, add the following code:
And when in the org.eclipse.jdt.groovy.core project, use this instead (or one of the variants of the method):