This plugin type allows you to contribute actions to the main menu and toolbars of Oxygen XML Editor, to create custom views and interact with the application workspace, make modifications to opened documents and add listeners for various events.
Many complex integrations (such as integrations with Content Management Systems) usually requires access to some workspace resources such as toolbars, menus, views, and editors. This type of plugin is also useful because it allows you to make modifications to the XML content of an opened editor.
The plugin must implement the ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension interface. The callback method applicationStarted of this interface allows access to a parameter of the ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace type (allows for API access to the application workspace).
The StandalonePluginWorkspace interface has three methods that can be called to customize toolbars, menus, and views:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plugin SYSTEM "../plugin.dtd"> <plugin name="CustomWorkspaceAccess" ..............> <runtime> ........ </runtime> <extension type="WorkspaceAccess" .............../> ............... <toolbar id="SampleWorkspaceAccessToolbarID" initialSide="NORTH" initialRow="1"/> </plugin>
The ro.sync.exml.workspace.api.standalone.ToolbarInfo toolbar component information with the specified id will be provided to you by the customizer interface. Therefore, you will be able to provide Swing components that will appear on the toolbar when the application starts.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plugin SYSTEM "../plugin.dtd"> <plugin name="CustomWorkspaceAccess" ..............> <runtime> ........ </runtime> <extension type="WorkspaceAccess" .............../> ............... <view id="SampleWorkspaceAccessID" initialSide="WEST" initialRow="0"/> </plugin>
The ro.sync.exml.workspace.api.standalone.ViewInfo view component information with the specified id will be provided to you by the customizer interface. Therefore, you will be able to provide Swing components that will appear on the view when the application starts.
addMenuBarCustomizer - Contributes to or modifies existing menu components.
Access to the opened editors can be done by first getting access to all URLs opened in the workspace using the StandalonePluginWorkspace.getAllEditorLocations(int editingArea) API method. There are two available editing areas: the DITA Maps Manager editing area and the main editing area. Using the URL of an opened resource, you can gain access to it using the StandalonePluginWorkspace.getEditorAccess(URL location, int editingArea) API method. A ro.sync.exml.workspace.api.editor.WSEditor then allows access to the current editing page.
A special editing API is supported for the Text mode (ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage) and the Author mode (ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPage).
To be notified when editors are opened, selected, and closed, you can use the StandalonePluginWorkspace.addEditorChangeListener API method to add a listener.