Fixed compilation problems and SWTAWTComponent focus problem with Java9+
[simantics/platform.git] / bundles / org.simantics.ui / src / org / simantics / ui / dnd / LocalObjectTransfer.java
index 5353ec1bb5c9b1641a7efd7c31a7c25d28e3278c..a920c82c1c13b6886216ac65553a15db451f89f2 100644 (file)
  *******************************************************************************/
 package org.simantics.ui.dnd;
 
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.FlavorTable;
 import java.awt.datatransfer.SystemFlavorMap;
-import java.util.Map;
 
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -23,8 +20,6 @@ import org.eclipse.jface.util.Policy;
 import org.eclipse.swt.dnd.ByteArrayTransfer;
 import org.eclipse.swt.dnd.TransferData;
 
-import sun.awt.datatransfer.DataTransferer;
-
 public class LocalObjectTransfer extends ByteArrayTransfer {
 
     // First attempt to create a UUID for the type name to make sure that
@@ -32,17 +27,21 @@ public class LocalObjectTransfer extends ByteArrayTransfer {
     // <code>LocalSelectionTransfer</code>
        public static final String TYPE_NAME = SystemFlavorMap.encodeJavaMIMEType(LocalObjectTransferable.TYPE_NAME);
        
-       private static int getMapping() {
-
-               for(Map.Entry<DataFlavor, String> entry : SystemFlavorMap.getDefaultFlavorMap().getNativesForFlavors(new DataFlavor[] { LocalObjectTransferable.FLAVOR }).entrySet()) {
-                       for(long l : DataTransferer.getInstance().getFormatsForFlavorAsArray(entry.getKey(), (FlavorTable)SystemFlavorMap.getDefaultFlavorMap())) {
-                               return (int)l;
-                       }
-               }
-               
-               throw new Error("No mapping.");
-               
-       }
+//     private static int getMapping() {
+//
+//             for(Map.Entry<DataFlavor, String> entry : SystemFlavorMap.getDefaultFlavorMap().getNativesForFlavors(new DataFlavor[] { LocalObjectTransferable.FLAVOR }).entrySet()) {
+//                     for(long l : DataTransferer.getInstance().getFormatsForFlavorAsArray(entry.getKey(), (FlavorTable)SystemFlavorMap.getDefaultFlavorMap())) {
+//                             return (int)l;
+//                     }
+//             }
+//             DataFlavor[] flavors = SystemFlavorMap.getDefaultFlavorMap().getNativesForFlavors(new DataFlavor[] { LocalObjectTransferable.FLAVOR }).keySet().toArray(new DataFlavor[0]);
+//             for(long l : DataTransferer.getInstance().getFormatsForFlavors(flavors, (FlavorTable)SystemFlavorMap.getDefaultFlavorMap()).keySet()) {
+//                     return (int)l;
+//             }
+//             
+//             throw new Error("No mapping.");
+//             
+//     }
        // In Linux (Ubuntu 14.04) using SystemFlavorMap to get the type id gives different result than what is received with drop data (TransferData.type) 
     private static final int TYPEID = registerType(TYPE_NAME);//getMapping();