diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2014-02-27 16:03:22 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2014-02-27 16:03:22 +0000 |
commit | 16cb74e9e4f048dc79e2d33a45e30181ac3222d0 (patch) | |
tree | eb98a2e51dbaa0fa914e0bd1012b421216e3ae5f /pdf-over-gui/src/main | |
parent | 214147c3906cb0efad43e2a32c070c6c5a82e94a (diff) | |
download | mocca-16cb74e9e4f048dc79e2d33a45e30181ac3222d0.tar.gz mocca-16cb74e9e4f048dc79e2d33a45e30181ac3222d0.tar.bz2 mocca-16cb74e9e4f048dc79e2d33a45e30181ac3222d0.zip |
Fix drag'n'drop on Mac
Allow Move/Link operations; always use Copy
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@515 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 9f07312b..eede00a8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -190,11 +190,7 @@ public class DataSourceSelectComposite extends StateComposite { } }); - //this.drop_area. - // this.drop_area.setBackground(back); - - DropTarget dnd_target = new DropTarget(this.drop_area, DND.DROP_DEFAULT - | DND.DROP_COPY); + DropTarget dnd_target = new DropTarget(this.drop_area, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK); final FileTransfer fileTransfer = FileTransfer.getInstance(); Transfer[] types = new Transfer[] { fileTransfer }; dnd_target.setTransfer(types); @@ -202,7 +198,6 @@ public class DataSourceSelectComposite extends StateComposite { dnd_target.addDropListener(new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { - log.debug("Drop received: " + event); //$NON-NLS-1$ if (fileTransfer.isSupportedType(event.currentDataType)) { if (event.data == null) { log.error("Dropped file name was null"); //$NON-NLS-1$ @@ -223,43 +218,23 @@ public class DataSourceSelectComposite extends StateComposite { @Override public void dragOperationChanged(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - } else { - event.detail = DND.DROP_NONE; - } - } + event.detail = DND.DROP_COPY; } @Override public void dragEnter(DropTargetEvent event) { - if (event.detail == DND.DROP_DEFAULT) { - if ((event.operations & DND.DROP_COPY) != 0) { - event.detail = DND.DROP_COPY; - MarkDragEnter(); - } else { - event.detail = DND.DROP_NONE; - } - } - // Only drop one item! - if (event.dataTypes.length > 1) { - event.detail = DND.DROP_NONE; - return; - } - // will accept text but prefer to have files dropped + // only accept transferable files for (int i = 0; i < event.dataTypes.length; i++) { if (fileTransfer.isSupportedType(event.dataTypes[i])) { event.currentDataType = event.dataTypes[i]; - // files should only be copied - if (event.detail != DND.DROP_COPY) { - event.detail = DND.DROP_NONE; - } - break; + event.detail = DND.DROP_COPY; + MarkDragEnter(); + return; } } + event.detail = DND.DROP_NONE; } - + /* (non-Javadoc) * @see org.eclipse.swt.dnd.DropTargetAdapter#dragLeave(org.eclipse.swt.dnd.DropTargetEvent) */ |