]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Testing small changes to SCL console view drop target handling. 71/271/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 16 Jan 2017 12:32:22 +0000 (14:32 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 16 Jan 2017 12:34:22 +0000 (14:34 +0200)
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

bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/console/SCLConsoleView.java

index 5a0d75fbbd25234b9f2e5c2a993abe89e4d34abb..cb2181912e1464b5978298c6b7314e81bdff6e48 100644 (file)
@@ -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());
     }