|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.data.CustomConfigurator
public class CustomConfigurator
Class to process configuration changes stored in XML can be used to modify preferences, store/delete files in .josm folders etc
Nested Class Summary | |
---|---|
static class |
CustomConfigurator.PreferencesUtils
Helper class to do specific Prefrences operation - appending, replacing, deletion by key and by value Also contains functions that convert preferences object to JavaScript object and back |
static class |
CustomConfigurator.XMLCommandProcessor
|
Field Summary | |
---|---|
private static boolean |
busy
|
private static java.lang.StringBuilder |
summary
|
Constructor Summary | |
---|---|
CustomConfigurator()
|
Method Summary | |
---|---|
static int |
askForOption(java.lang.String text,
java.lang.String opts)
Simple function for choose window, may be used from JS API and from other code |
static java.lang.String |
askForText(java.lang.String text)
|
static Preferences |
clonePreferences(Preferences pref)
|
static void |
deleteFile(java.lang.String path,
java.lang.String base)
|
static void |
deleteFileOrDirectory(java.io.File f)
|
static void |
deleteFileOrDirectory(java.lang.String path)
|
static void |
downloadAndUnpackFile(java.lang.String address,
java.lang.String path,
java.lang.String base)
Downloads file to one of JOSM standard folders nad unpack it as ZIP/JAR file |
static void |
downloadFile(java.lang.String address,
java.lang.String path,
java.lang.String base)
Downloads file to one of JOSM standard folders |
static void |
exportPreferencesKeysByPatternToFile(java.lang.String fileName,
boolean append,
java.lang.String pattern)
This function exports part of user preferences to specified file. |
static void |
exportPreferencesKeysToFile(java.lang.String filename,
boolean append,
java.util.Collection<java.lang.String> keys)
Export specified preferences keys to configuration file |
static void |
exportPreferencesKeysToFile(java.lang.String filename,
boolean append,
java.lang.String... keys)
This function exports part of user preferences to specified file. |
private static java.lang.String |
getDirectoryByAbbr(java.lang.String base)
|
static java.lang.String |
getLog()
|
static void |
log(java.lang.String s)
|
static void |
log(java.lang.String fmt,
java.lang.Object... vars)
|
static void |
messageBox(java.lang.String type,
java.lang.String text)
Simple function to show messageBox, may be used from JS API and from other code |
static void |
pluginOperation(java.lang.String install,
java.lang.String uninstall,
java.lang.String delete)
|
static void |
processDownloadOperation(java.lang.String address,
java.lang.String path,
java.lang.String parentDir,
boolean mkdir,
boolean unzip)
Downloads file to arbitrary folder |
static void |
readXML(java.io.File file)
Read configuration script from XML file, modifying main preferences |
static void |
readXML(java.io.File file,
Preferences prefs)
Read configuration script from XML file, modifying given preferences object |
static void |
readXML(java.lang.String dir,
java.lang.String fileName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.lang.StringBuilder summary
private static boolean busy
Constructor Detail |
---|
public CustomConfigurator()
Method Detail |
---|
public static void log(java.lang.String fmt, java.lang.Object... vars)
public static void log(java.lang.String s)
public static java.lang.String getLog()
public static void readXML(java.lang.String dir, java.lang.String fileName)
public static void readXML(java.io.File file, Preferences prefs)
file
- - file to open for reading XMLprefs
- - arbitrary Preferences object to modify by scriptpublic static void readXML(java.io.File file)
file
- - file to open for reading XMLpublic static void downloadFile(java.lang.String address, java.lang.String path, java.lang.String base)
address
- - URL to downloadpath
- - file path relative to base where to put downloaded filebase
- - only "prefs", "cache" and "plugins" allowed for standard folderspublic static void downloadAndUnpackFile(java.lang.String address, java.lang.String path, java.lang.String base)
address
- - URL to downloadpath
- - file path relative to base where to put downloaded filebase
- - only "prefs", "cache" and "plugins" allowed for standard folderspublic static void processDownloadOperation(java.lang.String address, java.lang.String path, java.lang.String parentDir, boolean mkdir, boolean unzip)
address
- - URL to downloadpath
- - file path relative to parentDir where to put downloaded fileparentDir
- - folder where to put filemkdir
- - if true, non-existing directories will be createdunzip
- - if true file wil be unzipped and deleted after downloadpublic static void messageBox(java.lang.String type, java.lang.String text)
type
- - 'i','w','e','q','p' for Information, Warning, Error, Question, Messagetext
- - message to display, HTML allowedpublic static int askForOption(java.lang.String text, java.lang.String opts)
text
- - message to show, HTML allowedopts
- -
public static java.lang.String askForText(java.lang.String text)
public static void exportPreferencesKeysToFile(java.lang.String filename, boolean append, java.lang.String... keys)
filename
- - where to exportappend
- - if true, resulting file cause appending to exuisting preferenceskeys
- - which preferences keys you need to export ("imagery.entries", for example)public static void exportPreferencesKeysByPatternToFile(java.lang.String fileName, boolean append, java.lang.String pattern)
filename
- - where to exportappend
- - if true, resulting file cause appending to exuisting preferencespattern
- - Regexp pattern forh preferences keys you need to export (".*imagery.*", for example)public static void exportPreferencesKeysToFile(java.lang.String filename, boolean append, java.util.Collection<java.lang.String> keys)
filename
- - name of fileappend
- - will the preferences be appended to existing ones when file is imported later. Elsewhere preferences from file will replace existing keys.keys
- - collection of preferences key names to savepublic static void deleteFile(java.lang.String path, java.lang.String base)
public static void deleteFileOrDirectory(java.lang.String path)
public static void deleteFileOrDirectory(java.io.File f)
public static void pluginOperation(java.lang.String install, java.lang.String uninstall, java.lang.String delete)
private static java.lang.String getDirectoryByAbbr(java.lang.String base)
public static Preferences clonePreferences(Preferences pref)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |