This plugin type allows the developer to contribute actions to the application main menu and toolbars, to create custom views and to interact with the application workspace
Many complex integrations, like integrations with Content Management Systems (CMS) usually requires access to some workspace resources like the toolbar, menus and to the opened XML editors. This type of plugin is also useful because it allows you to make modifications to an opened editor's XML content.
The plugin must implement the interface ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension. The callback method applicationStarted of this interface allows access to a parameter of type ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace which in its turn allows for API access to the application workspace.
The interface StandalonePluginWorkspace has three methods which can be called in order to customize the 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. You will thus be able to provide Swing components which 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. You will thus be able to provide Swing components which 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 first by getting access to all URLs opened in the workspace using the API method StandalonePluginWorkspace.getAllEditorLocations(int editingArea). There are two available editing areas: the DITA Maps Manager editing area (available only in the Oxygen XML Editor and Oxygen XML Author products) where only DITA Maps are edited 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 allows then access to the current editing page. Special editing API is supported only for the Text (ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage) page.
In order to be notified when editors are opened, selected and closed you can use the API method StandalonePluginWorkspace.addEditorChangeListener to add a listener.