Interface GlobalOptionsStorage
- All Known Subinterfaces:
EclipsePluginWorkspace
,PluginWorkspace
,StandalonePluginWorkspace
,WebappPluginWorkspace
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface GlobalOptionsStorage
This interface should be used to access global application options.
- Since:
- 18
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGlobalOptionListener
(OptionListener listener) Adds anOptionListener
to the current set of options.deserializePersistentObject
(String persistentObjectStringRepresentation) De-serialize a persistent object which has previously been serialized as XML using the "serializePersistentObject" method.Provides the value of the option associated with the specified key.void
importGlobalOptions
(File optionsFile) Sets global properties in the Oxygen common preferences.void
importGlobalOptions
(File optionsFile, boolean preserveExistingOptionKeys) Sets global properties in the Oxygen common preferences.void
removeGlobalOptionListener
(OptionListener listener) Removes an option listener from the current set of option listeners.void
Save the global application options to their default persistence location.serializePersistentObject
(Object persistentObject) Serialize a persistent object to an XML string.void
setGlobalObjectProperty
(String key, Object value) Sets a global property in the Oxygen common preferences.void
showPreferencesPages
(String[] pagesToShowKeys, String pageToSelectKey, boolean showChildrenOfPages) Show the preferences dialog, with only the desired pages displayed in the table of contents, and select a specific options page.
The pages to be shown or selected in the dialog are provided using their keys.
-
Method Details
-
addGlobalOptionListener
Adds anOptionListener
to the current set of options. The listener is notified when the value of its associated option changes.- Parameters:
listener
- TheOptionListener
to be added.
-
removeGlobalOptionListener
Removes an option listener from the current set of option listeners.- Parameters:
listener
- TheOptionListener
to be removed.
-
getGlobalObjectProperty
Provides the value of the option associated with the specified key. You can only get values for keys defined in theAPIAccessibleOptionTags
interface.- Parameters:
key
- The key that uniquely identifies an option.- Returns:
- The value corresponding to the key or
null
. - Throws:
IllegalArgumentException
- If the given key is not accessible via the API.
-
setGlobalObjectProperty
Sets a global property in the Oxygen common preferences. You can use such methods to overwrite some global preferences in Oxygen with your own values. To find the key and value types which needs to be overwritten you can export the application preferences to XML (Options -> Export Global Options).- Parameters:
key
- The key of the option whose value is to be modified.value
- The new value of the option.- Since:
- 15
-
importGlobalOptions
Sets global properties in the Oxygen common preferences. You can use such methods to overwrite some global preferences in Oxygen with your own values. Existing options with keys which are not present in the imported options file will be preserved.- Parameters:
optionsFile
- The file containing the XML options exported from an Oxygen installation.- Since:
- 16
-
importGlobalOptions
Sets global properties in the Oxygen common preferences. You can use such methods to overwrite some global preferences in Oxygen with your own values.- Parameters:
optionsFile
- The file containing the XML options exported from an Oxygen installation.preserveExistingOptionKeys
- Iftrue
existing options with keys which are not present in the imported options file will be preserved. Otherwise the existing options with keys which are not present in the imported options file are reset to default.- Throws:
IOException
- If some type of problem arises during the import or if the file cannot be accessed.- Since:
- 18.1
-
saveGlobalOptions
Save the global application options to their default persistence location.- Throws:
IOException
- If the save operation fails.- Since:
- 15.2
-
showPreferencesPages
void showPreferencesPages(String[] pagesToShowKeys, String pageToSelectKey, boolean showChildrenOfPages) Show the preferences dialog, with only the desired pages displayed in the table of contents, and select a specific options page.
The pages to be shown or selected in the dialog are provided using their keys. For the stand-alone application each key corresponds to aOptionPagePluginExtension
key (returned via the ro.sync.exml.plugin.option.OptionPagePluginExtension.getKey() method). For Eclipse the keys are actually the IDs of the corresponding<page>
elements fromplugin.xml
.- Parameters:
pagesToShowKeys
- The keys of the option pages to be shown in the table of contents.pageToSelectKey
- The key of the page to be selected in the table of contents.showChildrenOfPages
-True
to also show the children of the option pages in the table of contents,false
not to show them.- Since:
- 17.1
-
serializePersistentObject
Serialize a persistent object to an XML string.- Parameters:
persistentObject
- The persistent object. It must be an instance of ro.sync.options.PersistentObject- Returns:
- A string representation of the object in XML format.
- Throws:
IOException
- Thrown if something goes wrong during the serialization.- Since:
- 21
-
deserializePersistentObject
De-serialize a persistent object which has previously been serialized as XML using the "serializePersistentObject" method.- Parameters:
persistentObjectStringRepresentation
- The XML representation of the object.- Returns:
- The persistent object or
null
. - Throws:
IOException
- Thrown if something goes wrong during the de-serialization.- Since:
- 21
-