From bc6a0b96888a031cb7f0d154b5e62150e7bab72b Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Mon, 16 Jan 2017 14:32:22 +0200 Subject: [PATCH] Testing small changes to SCL console view drop target handling. For some users file drops on SCL console view do not work. This is an attempt to allow as much as possible to be dropped. refs #6979 [PRIVATE-12561] Change-Id: I91fcdca9e71bdaaa10c32915ef3900d055658f0d --- .../simantics/scl/ui/console/SCLConsoleView.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java index 5a0d75fbb..cb2181912 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java @@ -211,6 +211,20 @@ public class SCLConsoleView extends ViewPart { } private class ScriptRunningDropTarget extends DropTargetAdapter { + @Override + public void dragEnter(DropTargetEvent event) { + if (event.detail == DND.DROP_DEFAULT) { + event.detail = DND.DROP_LINK; + } + } + + @Override + public void dragOperationChanged(DropTargetEvent event) { + if (event.detail == DND.DROP_DEFAULT) { + event.detail = DND.DROP_LINK; + } + } + public void drop(DropTargetEvent event) { if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) { String[] files = ((String[]) event.data).clone(); @@ -233,7 +247,7 @@ public class SCLConsoleView extends ViewPart { } private void addScriptDropSupport(SCLConsole console) { - DropTarget target = new DropTarget(console.getOutputWidget(), DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT); + DropTarget target = new DropTarget(console.getOutputWidget(), DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT); target.setTransfer(new Transfer[] { FileTransfer.getInstance() }); target.addDropListener(new ScriptRunningDropTarget()); } -- 2.47.1