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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addGlobalOptionListener(OptionListener listener)
Adds anOptionListener
to the current set of options.java.lang.Object
deserializePersistentObject(java.lang.String persistentObjectStringRepresentation)
De-serialize a persistent object which has previously been serialized as XML using the "serializePersistentObject" method.java.lang.Object
getGlobalObjectProperty(java.lang.String key)
Provides the value of the option associated with the specified key.void
importGlobalOptions(java.io.File optionsFile)
Sets global properties in the Oxygen common preferences.void
importGlobalOptions(java.io.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
saveGlobalOptions()
Save the global application options to their default persistence location.java.lang.String
serializePersistentObject(java.lang.Object persistentObject)
Serialize a persistent object to an XML string.void
setGlobalObjectProperty(java.lang.String key, java.lang.Object value)
Sets a global property in the Oxygen common preferences.void
showPreferencesPages(java.lang.String[] pagesToShowKeys, java.lang.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 Detail
-
addGlobalOptionListener
void addGlobalOptionListener(OptionListener listener)
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
void removeGlobalOptionListener(OptionListener listener)
Removes an option listener from the current set of option listeners.- Parameters:
listener
- TheOptionListener
to be removed.
-
getGlobalObjectProperty
java.lang.Object getGlobalObjectProperty(java.lang.String key)
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:
java.lang.IllegalArgumentException
- If the given key is not accessible via the API.
-
setGlobalObjectProperty
void setGlobalObjectProperty(java.lang.String key, java.lang.Object value)
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
void importGlobalOptions(java.io.File optionsFile)
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
void importGlobalOptions(java.io.File optionsFile, boolean preserveExistingOptionKeys) throws java.io.IOException
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:
java.io.IOException
- If some type of problem arises during the import or if the file cannot be accessed.- Since:
- 18.1
-
saveGlobalOptions
void saveGlobalOptions() throws java.io.IOException
Save the global application options to their default persistence location.- Throws:
java.io.IOException
- If the save operation fails.- Since:
- 15.2
-
showPreferencesPages
void showPreferencesPages(java.lang.String[] pagesToShowKeys, java.lang.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
java.lang.String serializePersistentObject(java.lang.Object persistentObject) throws java.io.IOException
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:
java.io.IOException
- Thrown if something goes wrong during the serialization.- Since:
- 21
-
deserializePersistentObject
java.lang.Object deserializePersistentObject(java.lang.String persistentObjectStringRepresentation) throws java.io.IOException
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:
java.io.IOException
- Thrown if something goes wrong during the de-serialization.- Since:
- 21
-
-