src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:


 228             if (!dropInProcess && sm != null) {
 229                 sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
 230             }
 231         } catch (Exception e) {
 232             Thread currentThread = Thread.currentThread();
 233             currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
 234             return null;
 235         }
 236 
 237         Long lFormat = null;
 238         Transferable localTransferable = local;
 239 
 240         if (localTransferable != null) {
 241             return localTransferable.getTransferData(df);
 242         }
 243 
 244         if (dropStatus != STATUS_ACCEPT || dropComplete) {
 245             throw new InvalidDnDOperationException("No drop current");
 246         }
 247 
 248         Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats
 249             (currentT, DataTransferer.adaptFlavorMap
 250                 (currentDT.getFlavorMap()));
 251 
 252         lFormat = (Long)flavorMap.get(df);
 253         if (lFormat == null) {
 254             throw new UnsupportedFlavorException(df);
 255         }
 256 
 257         if (df.isRepresentationClassRemote() &&
 258             currentDA != DnDConstants.ACTION_LINK) {
 259             throw new InvalidDnDOperationException("only ACTION_LINK is permissable for transfer of java.rmi.Remote objects");
 260         }
 261 
 262         final long format = lFormat.longValue();
 263 
 264         Object ret = getNativeData(format);
 265 
 266         if (ret instanceof byte[]) {
 267             try {
 268                 return DataTransferer.getInstance().
 269                     translateBytes((byte[])ret, df, format, this);
 270             } catch (IOException e) {
 271                 throw new InvalidDnDOperationException(e.getMessage());
 272             }


 721     protected void eventPosted(SunDropTargetEvent e) {}
 722 
 723     protected void eventProcessed(SunDropTargetEvent e, int returnValue,
 724                                   boolean dispatcherDone) {}
 725 
 726     protected static class EventDispatcher {
 727 
 728         private final SunDropTargetContextPeer peer;
 729 
 730         // context fields
 731         private final int dropAction;
 732         private final int actions;
 733         private final long[] formats;
 734         private long nativeCtxt;
 735         private final boolean dispatchType;
 736         private boolean dispatcherDone = false;
 737 
 738         // dispatcher state fields
 739         private int returnValue = 0;
 740         // set of events to be dispatched by this dispatcher
 741         private final HashSet eventSet = new HashSet(3);
 742 
 743         static final ToolkitThreadBlockedHandler handler =
 744             DataTransferer.getInstance().getToolkitThreadBlockedHandler();
 745 
 746         EventDispatcher(SunDropTargetContextPeer peer,
 747                         int dropAction,
 748                         int actions,
 749                         long[] formats,
 750                         long nativeCtxt,
 751                         boolean dispatchType) {
 752 
 753             this.peer         = peer;
 754             this.nativeCtxt   = nativeCtxt;
 755             this.dropAction   = dropAction;
 756             this.actions      = actions;
 757             this.formats =
 758                      (null == formats) ? null : Arrays.copyOf(formats, formats.length);
 759             this.dispatchType = dispatchType;
 760         }
 761 




 228             if (!dropInProcess && sm != null) {
 229                 sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
 230             }
 231         } catch (Exception e) {
 232             Thread currentThread = Thread.currentThread();
 233             currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
 234             return null;
 235         }
 236 
 237         Long lFormat = null;
 238         Transferable localTransferable = local;
 239 
 240         if (localTransferable != null) {
 241             return localTransferable.getTransferData(df);
 242         }
 243 
 244         if (dropStatus != STATUS_ACCEPT || dropComplete) {
 245             throw new InvalidDnDOperationException("No drop current");
 246         }
 247 
 248         Map<DataFlavor, Long> flavorMap = DataTransferer.getInstance()
 249             .getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap
 250                 (currentDT.getFlavorMap()));
 251 
 252         lFormat = flavorMap.get(df);
 253         if (lFormat == null) {
 254             throw new UnsupportedFlavorException(df);
 255         }
 256 
 257         if (df.isRepresentationClassRemote() &&
 258             currentDA != DnDConstants.ACTION_LINK) {
 259             throw new InvalidDnDOperationException("only ACTION_LINK is permissable for transfer of java.rmi.Remote objects");
 260         }
 261 
 262         final long format = lFormat.longValue();
 263 
 264         Object ret = getNativeData(format);
 265 
 266         if (ret instanceof byte[]) {
 267             try {
 268                 return DataTransferer.getInstance().
 269                     translateBytes((byte[])ret, df, format, this);
 270             } catch (IOException e) {
 271                 throw new InvalidDnDOperationException(e.getMessage());
 272             }


 721     protected void eventPosted(SunDropTargetEvent e) {}
 722 
 723     protected void eventProcessed(SunDropTargetEvent e, int returnValue,
 724                                   boolean dispatcherDone) {}
 725 
 726     protected static class EventDispatcher {
 727 
 728         private final SunDropTargetContextPeer peer;
 729 
 730         // context fields
 731         private final int dropAction;
 732         private final int actions;
 733         private final long[] formats;
 734         private long nativeCtxt;
 735         private final boolean dispatchType;
 736         private boolean dispatcherDone = false;
 737 
 738         // dispatcher state fields
 739         private int returnValue = 0;
 740         // set of events to be dispatched by this dispatcher
 741         private final HashSet<SunDropTargetEvent> eventSet = new HashSet<>(3);
 742 
 743         static final ToolkitThreadBlockedHandler handler =
 744             DataTransferer.getInstance().getToolkitThreadBlockedHandler();
 745 
 746         EventDispatcher(SunDropTargetContextPeer peer,
 747                         int dropAction,
 748                         int actions,
 749                         long[] formats,
 750                         long nativeCtxt,
 751                         boolean dispatchType) {
 752 
 753             this.peer         = peer;
 754             this.nativeCtxt   = nativeCtxt;
 755             this.dropAction   = dropAction;
 756             this.actions      = actions;
 757             this.formats =
 758                      (null == formats) ? null : Arrays.copyOf(formats, formats.length);
 759             this.dispatchType = dispatchType;
 760         }
 761