Changes between Version 28 and Version 29 of DevelopersGuide/StyleGuide
- Timestamp:
- 2016-01-30T07:14:41+01:00 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DevelopersGuide/StyleGuide
v28 v29 1 [[TranslatedPages]] 1 [[TranslatedPages]] 2 2 = Development Guidelines = 3 3 … … 10 10 * Document your code '''thoroughly'''. Many people will thank you :) 11 11 * add curly brackets for each {{{if}}}, unless it is followed by {{{return}}} (or maybe {{{throw}}}) 12 * check your changes before patch/commit: `ant checkstyle` and check `checkstyle-josm.xml`; if you find running checkstyle slow for all files, run for changed files only: 13 14 {{{ 15 svn diff --summarize | awk '{ print $2 }' | xargs java -jar tools/checkstyle/checkstyle-6.14.1-all.jar -c tools/checkstyle/josm_checks.xml 16 # or 17 git diff --name-only | xargs java -jar tools/checkstyle/checkstyle-6.14.1-all.jar -c tools/checkstyle/josm_checks.xml 18 }}} 12 19 13 20 == How your javadoc should look like == … … 17 24 * {{{@since}}} can be omitted for public methods and fields introduced at the same time as the class, provided they do not have changed and the class is correctly documented. 18 25 * {{{@throws}}} is preferred to {{{@exception}}} 26 * check your changes before patch/commit by generating javadoc: `ant javadoc`, browse output messages; if you find running javadoc slow for all files, run for changed files only: 27 28 {{{ 29 svn diff --summarize | awk '{ print $2 }' | xargs javadoc -d javadoc 30 # or 31 git diff --name-only | xargs javadoc -d javadoc 32 }}} 19 33 20 34 === Configuring Eclipse === … … 30 44 == Internationalization == 31 45 32 * make sure you use {{{tr(...)}}} for all localized strings 33 {{{ 46 * make sure you use {{{tr(...)}}} for all localized strings 47 {{{ 34 48 import import static org.openstreetmap.josm.tools.I18n.tr; 35 49 … … 38 52 throw new Exception(tr("error message always in tr()")); 39 53 40 // use tr(...) for labels, title, tooltip texts and the like 54 // use tr(...) for labels, title, tooltip texts and the like 41 55 // 42 56 new JLabel(tr("Label always in tr()")); … … 55 69 '''DO''' 56 70 {{{new JLabel(tr("My Label {0}",labelId));}}} 57 71 58 72 Only exception: {{{+}}} can be used to break long lines of non-variable texts. 59 73 60 74 * When using apostrophe, the following rules apply: 61 75 62 76 For all {{{tr}}} the apostrophe is special. (Like backslash in C)[[BR]] 63 77 It needs to be escaped by another apostrophe:
