From: Tuukka Lehtonen Date: Mon, 16 Jan 2017 12:32:22 +0000 (+0200) Subject: Testing small changes to SCL console view drop target handling. X-Git-Tag: v1.27.0~22 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F71%2F271%2F2;p=simantics%2Fplatform.git 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 --- 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()); }