Package ro.sync.exml.plugin.option
Class OptionPagePluginExtension
- java.lang.Object
-
- ro.sync.exml.plugin.option.OptionPagePluginExtension
-
- All Implemented Interfaces:
PluginExtension
@API(type=EXTENDABLE, src=PUBLIC) public abstract class OptionPagePluginExtension extends java.lang.Object implements PluginExtension
Class used to create plugin option page extension. It receives callbacks for saving options, restoring default options and loading options. The GUI for this option page must be built in order to associated the options with their corresponding GUI components.- Since:
- 15
-
-
Constructor Summary
Constructors Constructor Description OptionPagePluginExtension()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
apply(PluginWorkspace pluginWorkspace)
This method is called when "Apply" or "OK" button are pressed in from the GUI option page.java.lang.String
getKey()
Retrieves the option page key.java.lang.String[]
getProjectLevelOptionKeys()
The options that will be saved inside the project file when this page is switched to project level inside the preferences dialog.abstract java.lang.String
getTitle()
Retrieves the option page title.abstract javax.swing.JComponent
init(PluginWorkspace pluginWorkspace)
Initializes the GUI for the option page and loads the stored option values.
This method may be called multiple times on the same "OptionPagePluginExtension" implementation.
For example it's called when the end user cancels the "Preferences" dialog and you need to reload your custom UI settings from the options storage.
So you could for example create the custom Swing component only when the first "init" is called and on subsequent calls return the already created component.
But on each "init" callback you always need to reload your page's GUI settings (e.g.abstract void
restoreDefaults()
This method is called when "Restore defaults" button is pressed from the GUI option page.
-
-
-
Method Detail
-
apply
public abstract void apply(PluginWorkspace pluginWorkspace)
This method is called when "Apply" or "OK" button are pressed in from the GUI option page. All options associated with the option page must be saved on this method.- Parameters:
pluginWorkspace
- Access the entire workspace of Oxygen. It can be used to retrieve theOptionsStorage
and perform options save operations on it.
-
restoreDefaults
public abstract void restoreDefaults()
This method is called when "Restore defaults" button is pressed from the GUI option page. All options associated with the option page must be restored to their default values.
-
getTitle
public abstract java.lang.String getTitle()
Retrieves the option page title.- Returns:
- The option page title used in GUI.
-
getKey
public java.lang.String getKey()
Retrieves the option page key. Can be overridden in order to pass the returned value toGlobalOptionsStorage.showPreferencesPages(String[], String, boolean)
, which is used for displaying the preferences dialog with certain pages in the table of contents.- Returns:
- The option page key.
- Since:
- 17.1
-
init
public abstract javax.swing.JComponent init(PluginWorkspace pluginWorkspace)
Initializes the GUI for the option page and loads the stored option values.
This method may be called multiple times on the same "OptionPagePluginExtension" implementation.
For example it's called when the end user cancels the "Preferences" dialog and you need to reload your custom UI settings from the options storage.
So you could for example create the custom Swing component only when the first "init" is called and on subsequent calls return the already created component.
But on each "init" callback you always need to reload your page's GUI settings (e.g. checkboxes) from the option stored in the options storage. (ro.sync.exml.workspace.api.PluginWorkspace.getOptionsStorage()).
If certain settings can also be changed in other parts of the code, on the first "init" callback you can add an options storage listener (ro.sync.exml.workspace.api.options.WSOptionsStorage.addOptionListener(WSOptionListener)) and update your UI's settings
when the stored keys are changed in other parts of the code.- Parameters:
pluginWorkspace
- Access the entire workspace of Oxygen. It can be used to retrieve theOptionsStorage
and perform options save/load operations it.- Returns:
- The GUI component of the option page.
-
getProjectLevelOptionKeys
public java.lang.String[] getProjectLevelOptionKeys()
The options that will be saved inside the project file when this page is switched to project level inside the preferences dialog.- Returns:
- The options presented in this page.
- Since:
- 24.0
-
-