we are using the Eclipse embedded Oxygen Author version 15.
It seems that the org.eclipse.swt.dnd.TextTransfer cannot be used in an com.oxygenxml.editor.editors.author.AuthorDnDListener
I just tried to extend our existing AuthorDnDListener and added the TextTransfer to it.
But when I try to drop text onto the editor it is not allowed, even though I do set the droptargetevent.detail to DND.DROP_COPY.
So I´d implemented another very simple AuthorDnDListener, but it does not work either.
Code: Select all
public class TextDnDListener implements AuthorDnDListener {
private AuthorAccess access;
@Override
public String getDescription() {
return null;
}
@Override
public boolean isAuthorEventOfInterest(DropTargetEvent droptargetevent) {
return true;
}
@Override
public Transfer[] getAuthorTransfers() {
return new Transfer[] { TextTransfer.getInstance() };
}
@Override
public void authorDragEnter(DropTargetEvent droptargetevent) {
droptargetevent.detail = DND.DROP_COPY;
}
@Override
public void authorDragLeave(DropTargetEvent droptargetevent) {
}
@Override
public void authorDragOperationChanged(DropTargetEvent droptargetevent) {
droptargetevent.detail = DND.DROP_COPY;
}
@Override
public void authorDragOver(DropTargetEvent droptargetevent) {
droptargetevent.detail = DND.DROP_COPY;
}
@Override
public void authorDrop(DropTargetEvent droptargetevent) {
if (TextTransfer.getInstance().isSupportedType(
droptargetevent.currentDataType)) {
String data = (String) droptargetevent.data;
access.getDocumentController().insertText(0, data);
}
}
@Override
public void authorDropAccept(DropTargetEvent droptargetevent) {
}
@Override
public void init(AuthorAccess authoraccess) {
this.access = authoraccess;
}
}
Can you tell me what I have to do in order to use the org.eclipse.swt.dnd.TextTransfer?
Best regards,
Simon