- Timestamp:
- 2013-10-27T03:04:38+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io/remotecontrol
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r6265 r6332 373 373 r.append(", "); 374 374 } 375 r.append(getHan ldlerInfoAsJSON(p.getKey()));375 r.append(getHandlerInfoAsJSON(p.getKey())); 376 376 } 377 377 r.append("]"); … … 380 380 } 381 381 382 public static String getHan ldlerInfoAsJSON(String cmd) {382 public static String getHandlerInfoAsJSON(String cmd) { 383 383 StringWriter w = new StringWriter(); 384 384 PrintWriter r = new PrintWriter(w); … … 421 421 422 422 r.append("], \"examples\" : ["); 423 String examples[] = handler.getUsageExamples( );423 String examples[] = handler.getUsageExamples(cmd.substring(1)); 424 424 if (examples != null) { 425 425 for (int i = 0; i < examples.length; i++) { … … 443 443 } 444 444 445 446 445 /** 447 446 * Reports HTML message with the description of all available commands … … 451 450 */ 452 451 public static String getUsageAsHtml() throws IllegalAccessException, InstantiationException { 453 // no handler found454 452 StringBuilder usage = new StringBuilder(1024); 455 453 for (Entry<String, Class<? extends RequestHandler>> handler : handlers.entrySet()) { … … 457 455 String[] mandatory = sample.getMandatoryParams(); 458 456 String[] optional = sample.getOptionalParams(); 459 String[] examples = sample.getUsageExamples( );457 String[] examples = sample.getUsageExamples(handler.getKey().substring(1)); 460 458 usage.append("<li>"); 461 459 usage.append(handler.getKey()); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/FeaturesHandler.java
r6091 r6332 33 33 buf.append(", "); 34 34 } 35 String info = RequestProcessor.getHan ldlerInfoAsJSON("/"+s);35 String info = RequestProcessor.getHandlerInfoAsJSON("/"+s); 36 36 if (info!=null) { 37 37 buf.append(info); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r6248 r6332 80 80 @Override 81 81 public String[] getUsageExamples() { 82 if (command.equals(myCommand)) { 82 return getUsageExamples(myCommand); 83 } 84 85 @Override 86 public String[] getUsageExamples(String cmd) { 87 if (command.equals(cmd)) { 83 88 return new String[] { 84 "/load_and_zoom?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5&select=way23071688,way23076176,way23076177,&left=13.740&right=13.741&top=51.05&bottom=51.049",85 "/load_and_zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999&new_layer=true"};89 "/load_and_zoom?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5&select=way23071688,way23076176,way23076177,&left=13.740&right=13.741&top=51.05&bottom=51.049", 90 "/load_and_zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999&new_layer=true"}; 86 91 } else { 87 92 return new String[] { 88 89 } 90 } 91 93 "/zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999"}; 94 } 95 } 96 92 97 @Override 93 98 protected void handleRequest() throws RequestHandlerErrorException -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r6316 r6332 116 116 public String[] getUsageExamples() { 117 117 return null; 118 } 119 120 /** 121 * Returns usage examples for the given command. To be overriden only my handlers that define several commands. 122 * @param cmd The command asked 123 * @return Usage examples for the given command 124 * @since 6332 125 */ 126 public String[] getUsageExamples(String cmd) { 127 return getUsageExamples(); 118 128 } 119 129
Note:
See TracChangeset
for help on using the changeset viewer.