コード例 #1
0
  public boolean navigateView(KeyEvent event, int direction) {
    EditPoint focusPoint = getEditPoint();
    IGEFEditorKit editorKit = (IGEFEditorKit) focusPoint.focus.getModelEntity().wGetEditorKit();
    IKeyHandler keyHandler = editorKit.getKeyHandler();
    // FIXME workaround for a bug in navigation actions
    if (focusPoint.focus instanceof ITextualEntityPart) {
      ITextualEntityPart part = (ITextualEntityPart) focusPoint.focus;
      int start = part.getSelectionStart();
      int end = part.getSelectionEnd();
      if (start != -1 && end != -1) {
        CaretUpdater.sheduleSyncUpdate(
            part.getViewer(),
            part.getModelTextEntity(),
            direction == PositionConstants.WEST ? start : end,
            true);
        return true;
      } else {
        CaretUpdater.sheduleSyncUpdate(
            part.getViewer(), part.getModelTextEntity(), part.getCaretPosition(), true);
      }
    }
    editPoint = keyHandler.findNeighbour(this, focusPoint, direction);

    if (editPoint == null) return navigateNextSibling(event, direction);

    navigateTo(editPoint.focus, event);
    return true;
  }