Please follow the following rules when working on MapTool. Failure to follow these will typically result in your patch being rejected.
For now patches should be posted to the Testers forum. Access to that forum is by request only; send a PM to jfrazierjr here on the forums and he'll add you to the group. You may then visit that hidden forum and review information on how to post patches for submission.
- Thou shalt always highlight the content of any Java source code thee hath modified and select Source -> Format. Note: this requires that the user reset the line length in the Eclipse properties: Trevor wants the line length set to 200 characters. (But see the attached preferences import file as the formatting settings are implemented there.)
- Thou shalt always select Source -> Reorganize Imports.
- Thou shalt always submit code that includes Javadoc comments for public classes and methods. (T'would be nice to require full Javadoc for everything, but alas, that is unlikely.)
- Thou shalt always use the
/* */
style of comments in front of classes and methods and may use single-line comments in front of member variables and small snippets of code, but See Rule #3! - Thou shalt always use parameter names different from member field names so that disambiguation using this is not necessary. (Exception: code generated by Eclipse's Source menu items is exempt from this requirement as a productivity enhancement.)
- Thou shalt always clearly delineate private constructors with comments so that those who come after thee may retain thy sanity.
- Thou shalt never use hard-coded strings in code when a property from an external file can be used. (In MapTool's case, this means calling
I18N.getText(propertyKey)
and adding a definition for thepropertyKey
toi18n.properties
. Also, all of theshow*()
methods in MapTool, such asshowError()
andshowWarning()
, takepropertyKeys
as well as strings -- only usepropertyKeys
!) - Thou shalt always use
static final String
when hard-coded strings are appropriate. Examples include resources that are embedded inside the MapTool JAR, such as unknown.png -- the question mark image. Other image names that may be considered part of the "theme", such as toolbar images, button images, and so forth, should be retrieved from an images property file; I proposeimages.properties
since we already havesounds.properties
. A string in the code should reference a pathname in the property file. - Thou shalt report all exceptions that are true errors.
InterruptedException
while waiting for a timer can be ignored, for example. But all other errors should be handled by callingMapTool.showError(propertyKey)
or similar and passing both apropertyKey
and theThrowable
object representing the exception. Note that the various "show" methods already provide logging to the.maptool/log.txt
file, but separate logging should be performed in the class if possible, since the XML configuration is an all-or-nothing fornet.rptools.maptool.client.MapTool
. - Thou shalt always use defined properties instead of hard-coded strings when possible. Such as
File.separator
instead of "/" and nowAppActions.menuShortcut
instead of "ctrl".
There are surely others that you (the contributors) may want added and that we (the dev team) determine to be acceptable. Please speak up. :)
An exported set of Eclipse Preferences as a ZIP file is available here. Unpack the ZIP and use File > Import... to read them. These preferences only include Java appearance and style-related settings, plus Task tag definitions. (Keyboard shortcuts and other settings are left untouched.)