Page 1 of 1

Customizing Drag and Drop Support to the Editors?

Posted: Sat Aug 30, 2014 3:42 am
by Kit Strong
Is it possible to customize the DitaMap, Author, and Text Editors to add custom DROP target support?

Re: Customizing Drag and Drop Support to the Editors?

Posted: Mon Sep 01, 2014 9:42 am
by Radu
Hi Kit,

Could you tell us more about what you want to drop?

1) For Author:

1.1) If you drop resources (files, URLs, images) into it, you could customize the external objects insertion handler ro.sync.ecss.extensions.dita.DITAExtensionsBundle.createExternalObjectInsertionHandler() which gets called in such cases.

1.2) If you drop anything else you could extend the API ro.sync.ecss.extensions.api.ExtensionsBundle.createAuthorAWTDndListener()

2) For the Text editing mode if you have a workspace access plugin implementation you could gain access to the Swing JTextArea ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage.getTextComponent() used in the text editing mode and add the DnD listener using Swing-specific means.

3) For the DITA Maps Manager, we do not have API. But if it detects dropped external resources it automatically adds topicrefs to them. Basically among other things it checks if the transferable can provide content for this flavor:

Code: Select all

 DataFlavor FLAVOR_LINUX_LIST_OF_URIs = new DataFlavor("text/uri-list;class=java.lang.String", null);
and if so, it obtains the content as a string, splits it by line breaks and tries to insert topic references to each resource.

Regards,
Radu