Selection Plugin Extension

A selection plugin can be applied to both an XML document and a non-XML document. It works as follows: the user makes a selection in the editor, displays the contextual menu, and selects the item corresponding to the plugin from the Plugins submenu.

This plugin type provides the following API:

  • The interface SelectionPluginExtension - The context containing the selected text is passed to the extension and the processed result is going to replace the initial selection. The process(GeneralPluginContext) method must return a SelectionPluginResult object that contains the result of the processing. The String value returned by the SelectionPluginResult object can include editor variables such as ${caret} and ${selection}.
  • The SelectionPluginContext object represents the context. It provides four methods:
    • getSelection() - Returns a String that is the current selection of text.
    • getFrame() - Returns a Frame that is the editing frame.
    • getPluginWorkspace() - Returns access to the workspace of Oxygen XML Editor.
    • getDocumentURL() - Returns the URL of the current edited document.