Changes between Version 6 and Version 7 of Help/Preferences/ImportExport


Ignore:
Timestamp:
2012-07-25T18:22:03+02:00 (13 years ago)
Author:
akks
Comment:

more examples

Legend:

Unmodified
Added
Removed
Modified
  • Help/Preferences/ImportExport

    v6 v7  
    1111* Imagery layer, plugin and options tuning (only Russian localization for now): [attachment:forestMapping.xml:ticket:4421 forestMapping.xml]
    1212
    13 == Preferences addition or replacement commands ==
     13=== Preferences addition or replacement commands ===
    1414
    1515Following code adds one more imagery to the list:
     
    6868</config>
    6969}}}
     70
     71=== Plugin operations: install, disable, delete ===
     72{{{#!xml
     73<config>
     74<!-- install plugins and remove them without deleting plastic_laf.jar -->
     75   <plugin install="buildings_tools;wayselector" remove="plastic_laf"/>
     76   <plugin delete="proj4j"/> <!-- disable plugin and delete jar -->
     77</config>
     78}}}
     79
     80=== Variables, messageboxes and asking user ===
     81{{{#!xml
     82<config>
     83  <ask var="r" text="Choose something, please!" options="0;1;2"/>
     84  <messagebox text="You choose ${r}" type="i"/>
     85  <if test="${r==0}">
     86     <messagebox text="r=0!"/>
     87  </if>
     88  <else>
     89     <messagebox text="no, r!=0 - r=${r} actually!"/>
     90  </else>
     91  <if test="${r==1 || r==2}">
     92     <messagebox text="r=1 or 2!"/>
     93  </if>
     94  <if test="${r!=2 && r!=0}">
     95    <messagebox text="It is not 0, it is not 2 , so it is = 1!"/>
     96  </if>
     97  <if test="${r!=2}">
     98    <break/>
     99  </if>
     100  <ask var="r" text="Choose something, please!" options="A;B"/>
     101  <messagebox text="You choose button number ${r}" type="i"/>
     102</config>
     103}}}
     104
     105=== JavaScript API ===
     106{{{#!xml
     107<config>
     108<script><![CDATA[
     109  API.messageBox('i','Hello!');
     110  txt = API.askText("Enter something...");
     111  i = API.askOption("Select background color","red;green;black");
     112  if (i==0) API.pref['color.background']="#770000";
     113  if (i==1) API.pref['color.background']="#007700";
     114  if (i==2) API.pref['color.background']="#000000";
     115  color = API.pref['color.background'];
     116  API.messageBox('i',"<html><span color='"+color+"'> You entered "+txt+"</span></html>");
     117  if ( API.askOption("Do you want to test downloading and plugins?","") == 0 ) {
     118     // "" in askOption means Yes/No dialog
     119     API.downloadFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar",
     120          "1/2/a.jar","cache");
     121     API.downloadAndUnpackFile("http://svn.openstreetmap.org/applications/editors/josm/dist/buildings_tools.jar",
     122          "1/2a/a.jar","cache");
     123     if( API.askOption("Do you want to delete downloaded files?","") == 0) {
     124        API.deleteFile("1","cache");
     125     }
     126     API.pluginInstall("AlignWays");
     127     if( API.askOption("Do you want to uninstall utilsplugin2","") == 0) {
     128        API.pluginUninstall("utilsplugin2");
     129        }
     130   }
     131   importPackage(org.openstreetmap.josm.data);
     132   CustomConfigurator.exportPreferencesKeysByPatternToFile ("e:/config.xml", true, ".*");
     133   //println(JSON.stringify(API.prefs)); // JSON works only on JDK1.7 //println(JSON.stringify(API.fragments)); // JSON works only on JDK1.7 ]]>
     134</script>
     135</config>
     136}}}