src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/DropTargetContextWrapper.java
author mdoerr
Tue, 12 Nov 2019 16:13:16 +0100
changeset 59032 ad05ed6f2a77
parent 50656 362e45aeb983
permissions -rw-r--r--
8233820: Test crashed with assert(phi->operand_count() != 1 || phi->subst() != phi) failed: missed trivial simplification Summary: Verification code needs to skip illegal phi functions. Reviewed-by: thartmann, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50656
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     1
/*
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     4
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    10
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    15
 * accompanied this code).
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    16
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    20
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    23
 * questions.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    24
 */
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    25
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    26
package jdk.swing.interop;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    27
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    28
import java.awt.dnd.peer.DropTargetContextPeer;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    29
import java.awt.dnd.DropTarget;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    30
import java.awt.dnd.InvalidDnDOperationException;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    31
import java.awt.dnd.DropTargetContext;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    32
import java.awt.datatransfer.DataFlavor;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    33
import java.awt.datatransfer.Transferable;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    34
import sun.awt.AWTAccessor;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    35
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    36
/**
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    37
 * This class provides a wrapper over inner class DropTargetContextPeerProxy
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    38
 * which implements jdk internal java.awt.dnd.peer.DropTargetContextPeer interface
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    39
 * and provides APIs to be used by FX swing interop to access and use
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    40
 * DropTargetContextPeer APIs.
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    41
 *
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    42
 * @since 11
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    43
 */
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    44
public abstract class DropTargetContextWrapper {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    45
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    46
    private DropTargetContextPeerProxy dcp;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    47
    public DropTargetContextWrapper() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    48
        dcp = new DropTargetContextPeerProxy();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    49
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    50
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    51
    public void setDropTargetContext(DropTargetContext dtc,
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    52
                                         DropTargetContextWrapper dtcpw) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    53
        AWTAccessor.getDropTargetContextAccessor().
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    54
                    setDropTargetContextPeer(dtc, dtcpw.dcp);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    55
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    56
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    57
    public void reset(DropTargetContext dtc) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    58
        AWTAccessor.getDropTargetContextAccessor().reset(dtc);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    59
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    60
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    61
    public abstract void setTargetActions(int actions);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    62
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    63
    public abstract int getTargetActions();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    64
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    65
    public abstract DropTarget getDropTarget();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    66
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    67
    public abstract DataFlavor[] getTransferDataFlavors();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    68
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    69
    public abstract Transferable getTransferable() throws InvalidDnDOperationException;
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    70
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    71
    public abstract boolean isTransferableJVMLocal();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    72
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    73
    public abstract void acceptDrag(int dragAction);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    74
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    75
    public abstract void rejectDrag();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    76
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    77
    public abstract void acceptDrop(int dropAction);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    78
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    79
    public abstract void rejectDrop();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    80
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    81
    public abstract void dropComplete(boolean success);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    82
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    83
    private class DropTargetContextPeerProxy implements DropTargetContextPeer {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    84
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    85
        public void setTargetActions(int actions) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    86
            DropTargetContextWrapper.this.setTargetActions(actions);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    87
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    88
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    89
        public int getTargetActions() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    90
            return DropTargetContextWrapper.this.getTargetActions();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    91
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    92
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    93
        public DropTarget getDropTarget() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    94
            return DropTargetContextWrapper.this.getDropTarget();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    95
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    96
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    97
        public DataFlavor[] getTransferDataFlavors() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    98
            return DropTargetContextWrapper.this.getTransferDataFlavors();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
    99
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   100
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   101
        public Transferable getTransferable()
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   102
                throws InvalidDnDOperationException {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   103
            return DropTargetContextWrapper.this.getTransferable();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   104
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   105
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   106
        public boolean isTransferableJVMLocal() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   107
            return DropTargetContextWrapper.this.isTransferableJVMLocal();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   108
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   109
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   110
        public void acceptDrag(int dragAction) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   111
            DropTargetContextWrapper.this.acceptDrag(dragAction);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   112
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   113
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   114
        public void rejectDrag() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   115
            DropTargetContextWrapper.this.rejectDrag();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   116
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   117
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   118
        public void acceptDrop(int dropAction) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   119
            DropTargetContextWrapper.this.acceptDrop(dropAction);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   120
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   121
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   122
        public void rejectDrop() {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   123
            DropTargetContextWrapper.this.rejectDrop();
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   124
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   125
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   126
        public void dropComplete(boolean success) {
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   127
            DropTargetContextWrapper.this.dropComplete(success);
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   128
        }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   129
    }
362e45aeb983 8202199: Provide public, unsupported JDK API for JavaFX/Swing interop
psadhukhan
parents:
diff changeset
   130
}