Changeset 6536 in josm for trunk/src


Ignore:
Timestamp:
2013-12-26T12:05:10+01:00 (11 years ago)
Author:
simon04
Message:

fix #8228 - remote control: add command description to usage page

Location:
trunk/src/org/openstreetmap/josm/io/remotecontrol
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r6362 r6536  
    394394
    395395        r.printf("{ \"request\" : \"%s\"", cmd);
     396        if (handler.getUsage() != null) {
     397            r.printf(", \"usage\" : \"%s\"", handler.getUsage());
     398        }
    396399        r.append(", \"parameters\" : [");
    397400
     
    458461            usage.append("<li>");
    459462            usage.append(handler.getKey());
     463            if (sample.getUsage() != null && !sample.getUsage().isEmpty()) {
     464                usage.append(" &mdash; <i>").append(sample.getUsage()).append("</i>");
     465            }
    460466            if (mandatory != null) {
    461467                usage.append("<br/>mandatory parameters: ").append(Utils.join(", ", Arrays.asList(mandatory)));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r6333 r6536  
    4949    {
    5050        return new String[] { "addtags" };
     51    }
     52
     53    @Override
     54    public String getUsage() {
     55        return "adds a node (given by its latitude and longitude) to the current dataset";
    5156    }
    5257
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r6333 r6536  
    5050    public String[] getOptionalParams() {
    5151        return new String[] { "addtags" };
     52    }
     53
     54    @Override
     55    public String getUsage() {
     56        return "adds a way (given by a semicolon separated sequence of lat,lon pairs) to the current dataset";
    5257    }
    5358
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/FeaturesHandler.java

    r6332 r6536  
    99
    1010/**
    11  * Reports avalable commands, their parameters and examples
     11 * Reports available commands, their parameters and examples
    1212 * @since 6091
    1313 */
     
    7878
    7979    @Override
     80    public String getUsage() {
     81        return "reports available commands, their parameters and examples";
     82    }
     83
     84    @Override
    8085    public String[] getUsageExamples() {
    8186        return new String[] {"/features", "/features?q=import,add_node"};
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

    r6248 r6536  
    114114
    115115    @Override
     116    public String getUsage() {
     117        return "adds an imagery layer (e.g. WMS, TMS))";
     118    }
     119
     120    @Override
    116121    public String[] getUsageExamples() {
    117122        final String types = Utils.join("|", Utils.transform(Arrays.asList(ImageryInfo.ImageryType.values()), new Utils.Function<ImageryInfo.ImageryType, String>() {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java

    r6248 r6536  
    4949    public String[] getOptionalParams() {
    5050        return new String[] {"new_layer"};
     51    }
     52
     53    @Override
     54    public String getUsage() {
     55        return "downloads the specified OSM file and adds it to the current data set";
    5156    }
    5257
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r6517 r6536  
    7777
    7878    @Override
     79    public String getUsage() {
     80        return "download a bounding box from the API, zoom to the downloaded area and optionally select one or more objects";
     81    }
     82
     83    @Override
    7984    public String[] getUsageExamples() {
    8085        return getUsageExamples(myCommand);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r6248 r6536  
    3838    {
    3939        return new String[] {"new_layer", "addtags"};
     40    }
     41
     42    @Override
     43    public String getUsage() {
     44        return "downloads the specified objects from the server";
    4045    }
    4146
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/OpenFileHandler.java

    r6091 r6536  
    3232
    3333    @Override
     34    public String getUsage() {
     35        return "opens a local file in JOSM";
     36    }
     37
     38    @Override
    3439    public String[] getUsageExamples() {
    3540        return new String[] {"/open_file?filename=/tmp/test.osm"};
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r6332 r6536  
    113113        return null;
    114114    }
    115      
     115
     116    public String getUsage() {
     117        return null;
     118    }
     119
    116120    public String[] getUsageExamples() {
    117121        return null;
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java

    r6091 r6536  
    5353
    5454    @Override
     55    public String getUsage() {
     56        return "returns the current protocol version of the installed JOSM RemoteControl";
     57    }
     58
     59    @Override
    5560    public String[] getUsageExamples() {
    5661        return new String[] { "/version", "/version?jsonp=test"};
Note: See TracChangeset for help on using the changeset viewer.