Custom Protocol Plugin Extension

This type of plugin allows the developer to work with a custom designed protocol for retrieving and storing files.

It provides the following API:

  • The interface URLStreamHandlerPluginExtension - There is one method that must be implemented:
    • getURLStreamHandler(String protocol) - It takes as an argument the name of the protocol and returns a URLStreamHandler object, or null if there is no URL handler for the specified protocol.

This type of plugin extension can be usually combined with a Workspace Access plugin extension that can add a custom toolbar with custom actions for opening documents from a certain source.

As an alternative, two older plugin extensions can also be used to add a toolbar action for showing a custom URL chooser:

  • With the help of the URLChooserPluginExtension2 interface, it is possible to create your own dialog box that works with the custom protocol. This interface provides two methods:
    • chooseURLs(StandalonePluginWorkspace workspaceAccess) - Returns a URL[] object that contains the URLs the user decided to open with the custom protocol. You can invoke your own URL chooser dialog box here and then return the chosen URLs having your own custom protocol. You have access to the workspace of Oxygen XML Editor.
    • getMenuName() - Returns a String object that is the name of the entry added in the File menu.
  • With the help of the URLChooserToolbarExtension interface, it is possible to provide a toolbar entry that is used for launching the custom URLs chooser from the URLChooserPluginExtension implementation. This interface provides two methods:
    • getToolbarIcon() - Returns the javax.swing.Icon image used on the toolbar.
    • getToolbarTooltip() - Returns a String that is the tooltip used on the toolbar button.

Was this helpful?