Changeset 14435 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2018-11-20T01:51:27+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
r14415 r14435 29 29 public class ProjectionCLI implements CLIModule { 30 30 31 /** The unique instance **/ 31 32 public static final ProjectionCLI INSTANCE = new ProjectionCLI(); 32 33 … … 43 44 public void processArguments(String[] argArray) { 44 45 List<String> positionalArguments = new OptionParser("JOSM projection") 45 .addFlagParameter("help", this::showHelp)46 .addFlagParameter("help", ProjectionCLI::showHelp) 46 47 .addShortAlias("help", "h") 47 48 .addFlagParameter("inverse", () -> argInverse = true) … … 84 85 * Displays help on the console 85 86 */ 86 private void showHelp() {87 private static void showHelp() { 87 88 System.out.println(getHelp()); 88 89 System.exit(0); -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r14418 r14435 676 676 }); 677 677 678 addPropertyChangeListener(DIVIDER_LOCATION_PROPERTY, e -> { 679 heightAdjustedExplicitly = true; 680 }); 678 addPropertyChangeListener(DIVIDER_LOCATION_PROPERTY, e -> heightAdjustedExplicitly = true); 681 679 } 682 680 -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r14428 r14435 1776 1776 1777 1777 /** 1778 * Constructs a new {@code PrecacheTask}. 1778 1779 * @param progressMonitor that will be notified about progess of the task 1779 1780 * @param bufferY buffer Y in degrees around which to download tiles -
trunk/src/org/openstreetmap/josm/tools/OptionParser.java
r14419 r14435 168 168 parameter = split[1]; 169 169 } else { 170 if (toHandle.isEmpty() || toHandle.getFirst().equals("--")) {170 if (toHandle.isEmpty() || "--".equals(toHandle.getFirst())) { 171 171 throw new OptionParseException(tr("{0}: option ''{1}'' requires an argument", program)); 172 172 } … … 198 198 option.option.runFor(option.parameter); 199 199 } catch (OptionParseException e) { 200 String message;200 StringBuilder message = new StringBuilder(); 201 201 // Just add a nicer error message 202 202 if (option.parameter == null) { 203 message = tr("{0}: Error while handling option ''{1}''", program, option.optionName);203 message.append(tr("{0}: Error while handling option ''{1}''", program, option.optionName)); 204 204 } else { 205 message =tr("{0}: Invalid value {2} for option ''{1}''", program, option.optionName,206 option.parameter) ;205 message.append(tr("{0}: Invalid value {2} for option ''{1}''", program, option.optionName, 206 option.parameter)); 207 207 } 208 208 if (!e.getLocalizedMessage().isEmpty()) { 209 message += ": " + e.getLocalizedMessage().isEmpty();209 message.append(": ").append(e.getLocalizedMessage().isEmpty()); 210 210 } 211 throw new OptionParseException(message , e);211 throw new OptionParseException(message.toString(), e); 212 212 } 213 213 } … … 261 261 } 262 262 263 protected abstract static class AvailableOption { 264 265 public boolean requiresParameter() { 263 protected interface AvailableOption { 264 265 /** 266 * Determines if this option requires a parameter. 267 * @return {@code true} if this option requires a parameter ({@code false} by default) 268 */ 269 default boolean requiresParameter() { 266 270 return false; 267 271 } 268 272 269 public OptionCount getRequiredCount() { 273 /** 274 * Determines how often this option may / must be specified on the command line. 275 * @return how often this option may / must be specified on the command line 276 */ 277 default OptionCount getRequiredCount() { 270 278 return OptionCount.OPTIONAL; 271 279 } … … 275 283 * @param parameter The parameter if {@link #requiresParameter()} is true, <code>null</code> otherwise. 276 284 */ 277 public abstract void runFor(String parameter); 278 285 void runFor(String parameter); 279 286 } 280 287 … … 292 299 293 300 /** 301 * Exception thrown when an option cannot be parsed. 294 302 * @author Michael Zangl 295 303 */ … … 307 315 308 316 /** 317 * Create an error with a localized description 309 318 * @param localizedMessage The message to display to the user. 310 319 */ … … 315 324 316 325 /** 326 * Create an error with a localized description and a root cause 317 327 * @param localizedMessage The message to display to the user. 318 328 * @param t The error that caused this message to be displayed.
Note:
See TracChangeset
for help on using the changeset viewer.