Class TextPageExternalObjectInsertionHandler

java.lang.Object
ro.sync.ecss.extensions.api.text.TextPageExternalObjectInsertionHandler
All Implemented Interfaces:
Extension, ExternalObjectInsertionSources
Direct Known Subclasses:
DITATextPageExternalObjectInsertionHandler

@API(type=EXTENDABLE, src=PUBLIC) public abstract class TextPageExternalObjectInsertionHandler extends Object implements ExternalObjectInsertionSources, Extension
This class is notified when URLs are dropped or pasted from a file explorer or from an Oxygen internal view to a Text Editor page. For the Eclipse Plugin the dropped files are handled by the platform and this API may not be called.
Since:
19
  • Constructor Details

    • TextPageExternalObjectInsertionHandler

      public TextPageExternalObjectInsertionHandler()
  • Method Details

    • insertURLs

      public void insertURLs(WSXMLTextEditorPage textAccess, List<URL> urls, int source) throws TextPageOperationException
      A list of URLs needs to be inserted at the caret position, probably as links.
      The source of the insertion can be a paste event or a drag and drop event.
      This call back is received if acceptsURLs(WSXMLTextEditorPage, List, int) returned true for the same source and urls list.
      You can use it to link to those specific files/URLs.
      Parameters:
      textAccess - The text page access
      urls - The list of URLs.
      source - The source of the URLs, one of the ExternalObjectInsertionSources constants.
      Throws:
      TextPageOperationException
    • acceptsURLs

      public boolean acceptsURLs(WSXMLTextEditorPage textAccess, List<URL> urls, int source)
      Confirm that the list of URLs is interesting to this handler.
      The source of the insertion can be a paste event or a drag and drop event. If the source is of drag and drop type and it is accepted, the caret will be moved to the drop position.
      By default all pasted URLs are accepted. Also all dropped images are accepted. For all other cases we accept by default URLs dropped from inside Oxygen (from views like Project and DITA Maps Manager).
      Parameters:
      textAccess - The text page access.
      urls - The list of URLs.
      source - The source of the URLs, one of the ExternalObjectInsertionSources constants.
      Returns:
      true if the provided URLs are interesting. If false, the default behaviors for the text page will be done (usually this means inserting the URL at the caret position).
    • acceptsSource

      public boolean acceptsSource(WSXMLTextEditorPage textAccess, int source)
      Confirm that the source of URLs is interesting to this handler.
      The source of the insertion can be a paste event or a drag and drop event. If the source is of drag and drop type and it is accepted, the caret will be moved to the drag position.
      By default accepts paste sources and drags from the Oxygen Project and DITA Maps Manager.
      Parameters:
      textAccess - The text page access.
      source - The source of the URLs, one of the ExternalObjectInsertionSources constants (that represents a paste or a drag and drop event)
      Returns:
      true if the insert URLs are interesting.
    • containsOnlyImages

      protected static boolean containsOnlyImages(WSXMLTextEditorPage textPage, List<URL> urlList)
      Verify if the provided URLs locate only images.
      Parameters:
      textPage - The text page access.
      urlList - The list of URLs.
      Returns:
      true if the URLs locate only images.
    • containsOnlyBinaryResources

      protected static boolean containsOnlyBinaryResources(WSXMLTextEditorPage textPage, List<URL> urlList)
      Verify if the provided URLs locate only binary resources.
      Parameters:
      textPage - The text page access.
      urlList - The list of URLs.
      Returns:
      true if the URLs locate only binary resources.
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface Extension
      Returns:
      The description of the extension.
      See Also: