java.awt.dnd.DnDConstants#ACTION_LINK源码实例Demo

下面列出了java.awt.dnd.DnDConstants#ACTION_LINK 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: SunDropTargetContextPeer.java
/**
 * mapOperation
 */

private int mapOperation(int operation) {
    int[] operations = {
            DnDConstants.ACTION_MOVE,
            DnDConstants.ACTION_COPY,
            DnDConstants.ACTION_LINK,
    };
    int   ret = DnDConstants.ACTION_NONE;

    for (int i = 0; i < operations.length; i++) {
        if ((operation & operations[i]) == operations[i]) {
                ret = operations[i];
                break;
        }
    }

    return ret;
}
 
源代码2 项目: jdk8u-jdk   文件: SunDropTargetContextPeer.java
/**
 * mapOperation
 */

private int mapOperation(int operation) {
    int[] operations = {
            DnDConstants.ACTION_MOVE,
            DnDConstants.ACTION_COPY,
            DnDConstants.ACTION_LINK,
    };
    int   ret = DnDConstants.ACTION_NONE;

    for (int i = 0; i < operations.length; i++) {
        if ((operation & operations[i]) == operations[i]) {
                ret = operations[i];
                break;
        }
    }

    return ret;
}
 
源代码3 项目: netbeans   文件: DragDropUtilities.java
/** Utility method.
* @return true if given node supports given action,
* false otherwise.
*/
static boolean checkNodeForAction(Node node, int dragAction) {
    if (
        node.canCut() &&
            ((dragAction == DnDConstants.ACTION_MOVE) || (dragAction == DnDConstants.ACTION_COPY_OR_MOVE))
    ) {
        return true;
    }

    if (
        node.canCopy() &&
            ((dragAction == DnDConstants.ACTION_COPY) || (dragAction == DnDConstants.ACTION_COPY_OR_MOVE) ||
            (dragAction == DnDConstants.ACTION_LINK) || (dragAction == DnDConstants.ACTION_REFERENCE))
    ) {
        return true;
    }

    // hmmm, conditions not satisfied..
    return false;
}
 
源代码4 项目: openjdk-jdk8u   文件: SunDragSourceContextPeer.java
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码5 项目: jdk8u60   文件: MotifDnDConstants.java
public static int getJavaActionsForMotifActions(int motifActions) {
    int javaActions = DnDConstants.ACTION_NONE;

    if ((motifActions & MOTIF_DND_MOVE) != 0) {
        javaActions |= DnDConstants.ACTION_MOVE;
    }
    if ((motifActions & MOTIF_DND_COPY) != 0) {
        javaActions |= DnDConstants.ACTION_COPY;
    }
    if ((motifActions & MOTIF_DND_LINK) != 0) {
        javaActions |= DnDConstants.ACTION_LINK;
    }

    return javaActions;
}
 
源代码6 项目: openjdk-jdk9   文件: SunDragSourceContextPeer.java
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码7 项目: jdk8u60   文件: MotifDnDConstants.java
public static int getMotifActionsForJavaActions(int javaActions) {
    int motifActions = MOTIF_DND_NOOP;

    if ((javaActions & DnDConstants.ACTION_MOVE) != 0) {
        motifActions |= MOTIF_DND_MOVE;
    }
    if ((javaActions & DnDConstants.ACTION_COPY) != 0) {
        motifActions |= MOTIF_DND_COPY;
    }
    if ((javaActions & DnDConstants.ACTION_LINK) != 0) {
        motifActions |= MOTIF_DND_LINK;
    }

    return motifActions;
}
 
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: MotifDnDConstants.java
public static int getMotifActionsForJavaActions(int javaActions) {
    int motifActions = MOTIF_DND_NOOP;

    if ((javaActions & DnDConstants.ACTION_MOVE) != 0) {
        motifActions |= MOTIF_DND_MOVE;
    }
    if ((javaActions & DnDConstants.ACTION_COPY) != 0) {
        motifActions |= MOTIF_DND_COPY;
    }
    if ((javaActions & DnDConstants.ACTION_LINK) != 0) {
        motifActions |= MOTIF_DND_LINK;
    }

    return motifActions;
}
 
源代码10 项目: TencentKona-8   文件: SunDragSourceContextPeer.java
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码11 项目: jdk8u-jdk   文件: XDnDConstants.java
static int getJavaActionForXDnDAction(long xdndAction) {
    if (xdndAction == XA_XdndActionCopy.getAtom()) {
        return DnDConstants.ACTION_COPY;
    } else if (xdndAction == XA_XdndActionMove.getAtom()) {
        return DnDConstants.ACTION_MOVE;
    } else if (xdndAction == XA_XdndActionLink.getAtom()) {
        return DnDConstants.ACTION_LINK;
    } else {
        return DnDConstants.ACTION_NONE;
    }
}
 
源代码12 项目: jdk8u-jdk   文件: MotifDnDConstants.java
public static int getJavaActionsForMotifActions(int motifActions) {
    int javaActions = DnDConstants.ACTION_NONE;

    if ((motifActions & MOTIF_DND_MOVE) != 0) {
        javaActions |= DnDConstants.ACTION_MOVE;
    }
    if ((motifActions & MOTIF_DND_COPY) != 0) {
        javaActions |= DnDConstants.ACTION_COPY;
    }
    if ((motifActions & MOTIF_DND_LINK) != 0) {
        javaActions |= DnDConstants.ACTION_LINK;
    }

    return javaActions;
}
 
源代码13 项目: jdk8u60   文件: SunDragSourceContextPeer.java
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码14 项目: jdk8u60   文件: XDnDConstants.java
static long getXDnDActionForJavaAction(int javaAction) {
    switch (javaAction) {
    case DnDConstants.ACTION_COPY : return XA_XdndActionCopy.getAtom();
    case DnDConstants.ACTION_MOVE : return XA_XdndActionMove.getAtom();
    case DnDConstants.ACTION_LINK : return XA_XdndActionLink.getAtom();
    default                       : return 0;
    }
}
 
源代码15 项目: Bytecoder   文件: SunDragSourceContextPeer.java
public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
源代码16 项目: dragonwell8_jdk   文件: SunDropTargetContextPeer.java
/**
 * @param actions set the current actions
 */

public synchronized void setTargetActions(int actions) {
    currentA = actions &
        (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
}
 
源代码17 项目: TencentKona-8   文件: SunDropTargetContextPeer.java
/**
 * @param actions set the current actions
 */

public synchronized void setTargetActions(int actions) {
    currentA = actions &
        (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
}
 
源代码18 项目: Bytecoder   文件: SunDropTargetContextPeer.java
/**
 * @param actions set the current actions
 */

public synchronized void setTargetActions(int actions) {
    currentA = actions &
        (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
}
 
源代码19 项目: openjdk-jdk9   文件: SunDropTargetContextPeer.java
/**
 * @param actions set the current actions
 */

public synchronized void setTargetActions(int actions) {
    currentA = actions &
        (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
}
 
源代码20 项目: jdk8u60   文件: SunDropTargetContextPeer.java
/**
 * @param actions set the current actions
 */

public synchronized void setTargetActions(int actions) {
    currentA = actions &
        (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
}