Package ro.sync.ecss.extensions.api.text
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 java.lang.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
-
-
Field Summary
-
Fields inherited from interface ro.sync.ecss.extensions.api.ExternalObjectInsertionSources
DND_DB_TREE, DND_DITA_COMPONENTS_TAB, DND_DITA_KEYS_VIEW, DND_DITA_MAPS_MANAGER, DND_DITA_MEDIA_TAB, DND_EXTERNAL, DND_IMAGE_PREVIEW, DND_PROJECT_TREE, PASTE
-
-
Constructor Summary
Constructors Constructor Description TextPageExternalObjectInsertionHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsSource(WSXMLTextEditorPage textAccess, int source)
Confirm that the source of URLs is interesting to this handler.boolean
acceptsURLs(WSXMLTextEditorPage textAccess, java.util.List<java.net.URL> urls, int source)
Confirm that the list of URLs is interesting to this handler.protected static boolean
containsOnlyBinaryResources(WSXMLTextEditorPage textPage, java.util.List<java.net.URL> urlList)
Verify if the provided URLs locate only binary resources.protected static boolean
containsOnlyImages(WSXMLTextEditorPage textPage, java.util.List<java.net.URL> urlList)
Verify if the provided URLs locate only images.java.lang.String
getDescription()
void
insertURLs(WSXMLTextEditorPage textAccess, java.util.List<java.net.URL> urls, int source)
A list of URLs needs to be inserted at the caret position, probably as links.
-
-
-
Method Detail
-
insertURLs
public void insertURLs(WSXMLTextEditorPage textAccess, java.util.List<java.net.URL> urls, int source) throws TextPageOperationException
A list of URLs needs to be inserted at the caret position, probably as links.
Thesource
of the insertion can be a paste event or a drag and drop event.
This call back is received ifacceptsURLs(WSXMLTextEditorPage, List, int)
returnedtrue
for the samesource
andurls
list.
You can use it to link to those specific files/URLs.- Parameters:
textAccess
- The text page accessurls
- The list of URLs.source
- The source of the URLs, one of theExternalObjectInsertionSources
constants.- Throws:
TextPageOperationException
-
acceptsURLs
public boolean acceptsURLs(WSXMLTextEditorPage textAccess, java.util.List<java.net.URL> urls, int source)
Confirm that the list of URLs is interesting to this handler.
Thesource
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 theExternalObjectInsertionSources
constants.- Returns:
true
if the provided URLs are interesting. Iffalse
, 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.
Thesource
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 theExternalObjectInsertionSources
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, java.util.List<java.net.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, java.util.List<java.net.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 java.lang.String getDescription()
- Specified by:
getDescription
in interfaceExtension
- Returns:
- The description of the extension.
- See Also:
Extension.getDescription()
-
-