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)); }
/** * 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; }
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)); }
@Override public final void keyPressed(KeyEvent ke) { try { dealWithKeyPressed(ke); } catch (RecoverableException ex) { RcvrExceptionHandler.recover(ex, menuUI.getStandardInteraction()); } }
@Override public final void keyReleased(KeyEvent ke) { try { dealWithKeyReleased(ke); } catch (RecoverableException ex) { RcvrExceptionHandler.recover(ex, menuUI.getStandardInteraction()); } }
/** * 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; }
/** * Returns true if subclass processing should continue, false * if subclass processing should be terminated. */ protected boolean dealWithKeyPressed(KeyEvent ke) { setUpMouseState(KEY_PRESSED); return true; }
/** * Returns true if subclass processing should continue, false * if subclass processing should be terminated. */ protected boolean dealWithKeyReleased(KeyEvent ke) { setUpMouseState(KEY_RELEASED); return true; }
/** * 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; }
public void keyPressed(KeyEvent ke) { }
public void keyReleased(KeyEvent ke) { }