For those unfamiliar with Eclipse Rich Client Platform (RCP) development and Git source control, it is recommended that you go through the following tutorials:
Eclipse Workspace Settings
These are some additional configuration settings for Eclipse and Java source requirements when developing Ergo.
Developers should override default compiler error/warning and use project specific errors/warnings. These errors should be enabled:
- Method with a constructor name - Error
- Non-externalized strings (missing/unused $NON-NLS$ tag) - Warning
- Assignment has no effect - Error
- Possible accidental boolean assignment - Error
- finally does not complete normally - Error
- Using a char array in string concatenation - Error
- Null pointer access - Error
- Potential null pointer access - Warning
- Unused Import - Error
Patches with errors listed above including API errors will not be accepted without corrections.
Additional requirements for Java source
- Use interfaces as much as possible
- All interfaces and methods must include a Javadoc comment
- Interface implementations must include a non-Javadoc comment (using Generate Element Comment)
- All classes, methods and fields should have an access modifier (public, protected, private)
- Use the following class, method and field modifier order:
- Access modifier
- All source should be formatted using the "Ergo" code formatter profile (see below)
- All members should be cleaned up using the "Ergo" profile (Source->Clean Up)
- Statement blocks should always be used, even for single line 'if', 'for', etc.
- Column width should be set to 132
All source files must also start with an approved license and copyright declaration (TODO - update this if Ergo has specific license and link to it)
Ergo formatting and cleanup profiles for Java
The Ergo formatter and clean-up profiles are available here To use the profiles,
- Unzip on your machine to find two files: ergo_format.xml and ergo_cleanup.xml
- Formatter: in Window > Preferences > Java > Code Style > Clean Up and select "Import" and import the ergo-cleanup.xml file. The active profile should say "ERGO".
- To use: Select a source file in Package Explorer (or container/folder/etc.) and select Source menu > Format
- Cleanup in Window > Preferences > Java > Code Style > Formatter and select "Import" and import the ergo-formatter.xml file. The active profile should say "ERGO".
- To use: Select a source file in Package Explorer (or container/folder/etc.) and select Source menu > Cleanup ...
- Optionally Set the editor to apply the formatting changes automatically on save for convenience and consistency in use in Window > Preferences > Java > Editor > Save Actions. Check "Perform the selected actions on save", check "Format source code", and check "Additional actions"
Adding a New Plug-in
If you are contributing new plug-ins to Ergo, it is recommended that you include unit tests that verify everything is working properly. In addition the the above code guidelines, please do the following:
- Add an about.html file to the plug-in (TODO - add example about.html file)
- Add the plug-in to a feature so it gets built.
- Announce the new plug-in on ergo-dev so developers know to import the new plug-in
Contributions from ergo-dev members
Contributions from members of ergo-dev should be handled following these guidelines: Handling Git Contributions