Java 类org.eclipse.draw2d.KeyEvent 实例源码

项目:gef-gwt    文件:ScrollableThumbnail.java   
public void keyPressed(KeyEvent ke) {
    int moveX = viewport.getClientArea().width / 4;
    int moveY = viewport.getClientArea().height / 4;
    if (ke.keycode == SWT.HOME
            || (isMirrored() ? ke.keycode == SWT.ARROW_RIGHT
                    : ke.keycode == SWT.ARROW_LEFT))
        viewport.setViewLocation(viewport.getViewLocation().translate(
                -moveX, 0));
    else if (ke.keycode == SWT.END
            || (isMirrored() ? ke.keycode == SWT.ARROW_LEFT
                    : ke.keycode == SWT.ARROW_RIGHT))
        viewport.setViewLocation(viewport.getViewLocation().translate(
                moveX, 0));
    else if (ke.keycode == SWT.ARROW_UP || ke.keycode == SWT.PAGE_UP)
        viewport.setViewLocation(viewport.getViewLocation().translate(
                0, -moveY));
    else if (ke.keycode == SWT.ARROW_DOWN
            || ke.keycode == SWT.PAGE_DOWN)
        viewport.setViewLocation(viewport.getViewLocation().translate(
                0, moveY));
}
项目:cogtool    文件:ScriptViewerMouseState.java   
/**
 * Detects key presses in order to move widgets
 * @param ke contains details of the key press
 */
@Override
protected boolean dealWithKeyPressed(KeyEvent ke)
{
    if (! super.dealWithKeyPressed(ke)) {
        return false;
    }

    // TODO: Why is this not being executed?
    switch (ke.keycode) {
        case '-': {
            if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                ui.performAction(CogToolLID.ZoomOut);
            }
            break;
        }
        case '=': {
            if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                ui.performAction(CogToolLID.ZoomIn);
            }
            break;
        }
    }

    return true;
}
项目:cogtool    文件:SEFrameChooserMouseState.java   
/**
 * Detects key presses in order to move widgets
 * @param ke contains details of the key press
 */
@Override
protected boolean dealWithKeyPressed(KeyEvent ke)
{
    if (! super.dealWithKeyPressed(ke)) {
        return false;
    }

    // TODO: Why is this not being executed?
    switch (ke.keycode) {
        case '-': {
            if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                ui.performAction(CogToolLID.ZoomOut);
            }
            break;
        }
        case '=': {
            if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                ui.performAction(CogToolLID.ZoomIn);
            }
            break;
        }
    }

    return true;
}
项目:PDFReporter-Studio    文件:JSSScrollableThumbnail.java   
public void keyPressed(KeyEvent ke) {
    int moveX = viewport.getClientArea().width / 4;
    int moveY = viewport.getClientArea().height / 4;
    if (ke.keycode == SWT.HOME || (isMirrored() ? ke.keycode == SWT.ARROW_RIGHT : ke.keycode == SWT.ARROW_LEFT))
        viewport.setViewLocation(viewport.getViewLocation().translate(-moveX, 0));
    else if (ke.keycode == SWT.END || (isMirrored() ? ke.keycode == SWT.ARROW_LEFT : ke.keycode == SWT.ARROW_RIGHT))
        viewport.setViewLocation(viewport.getViewLocation().translate(moveX, 0));
    else if (ke.keycode == SWT.ARROW_UP || ke.keycode == SWT.PAGE_UP)
        viewport.setViewLocation(viewport.getViewLocation().translate(0, -moveY));
    else if (ke.keycode == SWT.ARROW_DOWN || ke.keycode == SWT.PAGE_DOWN)
        viewport.setViewLocation(viewport.getViewLocation().translate(0, moveY));
}
项目:PDFReporter-Studio    文件:ScrollableThumbnail.java   
public void keyPressed(KeyEvent ke) {
    int moveX = viewport.getClientArea().width / 4;
    int moveY = viewport.getClientArea().height / 4;
    if (ke.keycode == SWT.HOME || (isMirrored() ? ke.keycode == SWT.ARROW_RIGHT : ke.keycode == SWT.ARROW_LEFT))
        viewport.setViewLocation(viewport.getViewLocation().translate(-moveX, 0));
    else if (ke.keycode == SWT.END || (isMirrored() ? ke.keycode == SWT.ARROW_LEFT : ke.keycode == SWT.ARROW_RIGHT))
        viewport.setViewLocation(viewport.getViewLocation().translate(moveX, 0));
    else if (ke.keycode == SWT.ARROW_UP || ke.keycode == SWT.PAGE_UP)
        viewport.setViewLocation(viewport.getViewLocation().translate(0, -moveY));
    else if (ke.keycode == SWT.ARROW_DOWN || ke.keycode == SWT.PAGE_DOWN)
        viewport.setViewLocation(viewport.getViewLocation().translate(0, moveY));
}
项目:cogtool    文件:Draw2DMouseState.java   
@Override
public final void keyPressed(KeyEvent ke)
{
    try {
        dealWithKeyPressed(ke);
    }
    catch (RecoverableException ex) {
        RcvrExceptionHandler.recover(ex,
                                     menuUI.getStandardInteraction());
    }
}
项目:cogtool    文件:Draw2DMouseState.java   
@Override
public final void keyReleased(KeyEvent ke)
{
    try {
        dealWithKeyReleased(ke);
    }
    catch (RecoverableException ex) {
        RcvrExceptionHandler.recover(ex,
                                     menuUI.getStandardInteraction());
    }
}
项目:cogtool    文件:SEDemoMouseState.java   
/**
 * Detects key presses in order to move widgets
 * @param ke contains details of the key press
 */
@Override
protected boolean dealWithKeyPressed(KeyEvent ke)
{
    if (! super.dealWithKeyPressed(ke)) {
        return false;
    }

    // TODO: Why is this not being executed?
    switch (ke.keycode) {
        case '-': {
            if (getMouseState() == MouseUp) {
                if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                    ui.performAction(CogToolLID.ZoomOut);
                }
            }
            break;
        }
        case '=': {
            if (getMouseState() == MouseUp) {
                if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                    ui.performAction(CogToolLID.ZoomIn);
                }
            }
            break;
        }
    }

    return true;
}
项目:cogtool    文件:Draw2DMouseState.java   
/**
 * Returns true if subclass processing should continue, false
 * if subclass processing should be terminated.
 */
protected boolean dealWithKeyPressed(KeyEvent ke)
{
    setUpMouseState(KEY_PRESSED);
    return true;
}
项目:cogtool    文件:Draw2DMouseState.java   
/**
 * Returns true if subclass processing should continue, false
 * if subclass processing should be terminated.
 */
protected boolean dealWithKeyReleased(KeyEvent ke)
{
    setUpMouseState(KEY_RELEASED);
    return true;
}
项目:cogtool    文件:DesignEditorMouseState.java   
/**
 * Detects key presses in order to move widgets
 * @param ke contains details of the key press
 */
@Override
protected boolean dealWithKeyPressed(KeyEvent ke)
{
    if (! super.dealWithKeyPressed(ke)) {
        return false;
    }

    switch (ke.keycode) {
        case '-': {
            if (getMouseState() == MouseUp) {
                if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                    ui.performAction(CogToolLID.ZoomOut);
                }
            }
            break;
        }
        case '=': {
            if (getMouseState() == MouseUp) {
                if ((ke.getState() & CTRL_SHIFT_MASK) == CTRL_SHIFT_MASK) {
                    ui.performAction(CogToolLID.ZoomIn);
                }
            }
            break;
        }
        case SWT.ESC: {
            cancelDynamicOperation();
            break;
        }
        case SWT.ARROW_UP: {
            if (getMouseState() == MouseUp) {
                ui.performAction(CogToolLID.NudgeUp);
            }
            break;
        }
        case SWT.ARROW_DOWN: {
            if (getMouseState() == MouseUp) {
                ui.performAction(CogToolLID.NudgeDown);
            }
            break;
        }
        case SWT.ARROW_LEFT: {
            if (getMouseState() == MouseUp) {
                ui.performAction(CogToolLID.NudgeLeft);
            }
            break;
        }
        case SWT.ARROW_RIGHT: {
            if (getMouseState() == MouseUp) {
                ui.performAction(CogToolLID.NudgeRight);
            }
            break;
        }
        case SWT.CR: {
            if (getMouseState() == MouseUp) {
                ui.performAction(DesignEditorLID.InitiateFrameRename);
            }
            break;
        }
        // Handle delete key & backspace keys when the item is selected,
        // and the text area is not. TODO: Not a full solution.
        case SWT.DEL:
        case SWT.BS: { // Backspace
            if (getMouseState() == MouseUp) {
                ui.performAction(CogToolLID.Delete);
            }
            break;
        }
    }

    return true;
}
项目:cogtool    文件:Draw2DContextMenuUtil.java   
public void keyPressed(KeyEvent ke) { }
项目:cogtool    文件:Draw2DContextMenuUtil.java   
public void keyReleased(KeyEvent ke) { }