Package org.openstreetmap.josm.gui.io
Class CustomConfigurator
java.lang.Object
org.openstreetmap.josm.gui.io.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
Nested ClassesModifier and TypeClassDescriptionstatic classRead preferences from xml files -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intaskForOption(String text, String opts) Simple function for choose window, may be used from JS API and from other codestatic StringaskForText(String text) Ask the user for textstatic voiddeleteFile(String path, String base) Delete a filestatic voidDelete a file or a directorystatic voiddownloadAndUnpackFile(String address, String path, String base) Downloads file to one of JOSM standard folders and unpack it as ZIP/JAR filestatic voiddownloadFile(String address, String path, String base) Downloads file to one of JOSM standard foldersstatic voidexportPreferencesKeysByPatternToFile(String fileName, boolean append, String pattern) This function exports part of user preferences to specified file.static voidexportPreferencesKeysToFile(String filename, boolean append, String... keys) This function exports part of user preferences to specified file.static voidexportPreferencesKeysToFile(String filename, boolean append, Collection<String> keys) Export specified preferences keys to configuration fileprivate static StringgetDirectoryByAbbr(String base) static voidmessageBox(String type, String text) Simple function to show messageBox, may be used from JS API and from other codestatic voidpluginOperation(String install, String uninstall, String delete) Perform install, uninstall, and deletion operations on pluginsstatic voidprocessDownloadOperation(String address, String path, String parentDir, boolean mkdir, boolean unzip) Downloads file to arbitrary folderstatic voidRead configuration script from XML file, modifying main preferencesstatic voidreadXML(File file, Preferences prefs) Read configuration script from XML file, modifying given preferences objectstatic voidRead configuration script from XML file, modifying main preferences
-
Field Details
-
busy
-
-
Constructor Details
-
CustomConfigurator
private CustomConfigurator()
-
-
Method Details
-
readXML
Read configuration script from XML file, modifying main preferences- Parameters:
dir- - directoryfileName- - XML file name
-
readXML
Read configuration script from XML file, modifying given preferences object- Parameters:
file- - file to open for reading XMLprefs- - arbitrary Preferences object to modify by script
-
readXML
Read configuration script from XML file, modifying main preferences- Parameters:
file- - file to open for reading XML
-
downloadFile
Downloads file to one of JOSM standard folders- Parameters:
address- - URL to downloadpath- - file path relative to base where to put downloaded filebase- - only "prefs", "cache" and "plugins" allowed for standard folders
-
downloadAndUnpackFile
Downloads file to one of JOSM standard folders and unpack it as ZIP/JAR file- Parameters:
address- - URL to downloadpath- - file path relative to base where to put downloaded filebase- - only "prefs", "cache" and "plugins" allowed for standard folders
-
processDownloadOperation
public static void processDownloadOperation(String address, String path, String parentDir, boolean mkdir, boolean unzip) Downloads file to arbitrary folder- Parameters:
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 download
-
messageBox
Simple function to show messageBox, may be used from JS API and from other code- Parameters:
type- - 'i','w','e','q','p' for Information, Warning, Error, Question, Messagetext- - message to display, HTML allowed
-
askForOption
Simple function for choose window, may be used from JS API and from other code- Parameters:
text- - message to show, HTML allowedopts- -- Returns:
- number of pressed button, -1 if cancelled
-
askForText
Ask the user for text- Parameters:
text- The message for the user- Returns:
- The text the user entered
-
exportPreferencesKeysToFile
This function exports part of user preferences to specified file. Default values are not saved.- Parameters:
filename- - where to exportappend- - if true, resulting file cause appending to existing preferenceskeys- - which preferences keys you need to export ("imagery.entries", for example)
-
exportPreferencesKeysByPatternToFile
public static void exportPreferencesKeysByPatternToFile(String fileName, boolean append, String pattern) This function exports part of user preferences to specified file. Default values are not saved. Preference keys matching specified pattern are saved- Parameters:
fileName- - where to exportappend- - if true, resulting file cause appending to existing preferencespattern- - Regexp pattern for preferences keys you need to export (".*imagery.*", for example)
-
exportPreferencesKeysToFile
public static void exportPreferencesKeysToFile(String filename, boolean append, Collection<String> keys) Export specified preferences keys to configuration file- Parameters:
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 save
-
deleteFile
Delete a file- Parameters:
path- The path to delete inside the base directorybase- The base directory for the path
-
deleteFileOrDirectory
Delete a file or a directory- Parameters:
f- The file or directory to delete
-
pluginOperation
Perform install, uninstall, and deletion operations on plugins- Parameters:
install- The;delimited list of plugins to installuninstall- The;delimited list of plugins to uninstalldelete- The;delimited list of plugins to delete
-
getDirectoryByAbbr
-