Search in sources :

Example 1 with IKeyHandler

use of org.whole.lang.ui.keys.IKeyHandler in project whole by wholeplatform.

the class TextualDragTracker method handleTripleClick.

protected boolean handleTripleClick(int button) {
    ITextualEntityPart textualEntityPart = getTextualEntityPart();
    if (button == 1 && textualEntityPart != null) {
        IGEFEditorKit editorkit = (IGEFEditorKit) textualEntityPart.getModelEntity().wGetEditorKit();
        EditPoint editPoint = new EditPoint(textualEntityPart, textualEntityPart.getCaretPosition());
        IKeyHandler keyHandler = editorkit.getKeyHandler();
        IWholeSelection selection = keyHandler.calculateTripleClickSelection(editPoint);
        performSelectionUpdate(selection, true);
        return true;
    }
    return false;
}
Also used : ITextualEntityPart(org.whole.lang.ui.editparts.ITextualEntityPart) IGEFEditorKit(org.whole.lang.ui.editor.IGEFEditorKit) IKeyHandler(org.whole.lang.ui.keys.IKeyHandler)

Example 2 with IKeyHandler

use of org.whole.lang.ui.keys.IKeyHandler in project whole by wholeplatform.

the class E4NavigationKeyHandler method navigateView.

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;
}
Also used : ITextualEntityPart(org.whole.lang.ui.editparts.ITextualEntityPart) EditPoint(org.whole.lang.ui.tools.EditPoint) IGEFEditorKit(org.whole.lang.ui.editor.IGEFEditorKit) IKeyHandler(org.whole.lang.ui.keys.IKeyHandler) Point(org.eclipse.draw2d.geometry.Point) EditPoint(org.whole.lang.ui.tools.EditPoint)

Example 3 with IKeyHandler

use of org.whole.lang.ui.keys.IKeyHandler in project whole by wholeplatform.

the class TextualDragTracker method handleDoubleClick.

@Override
protected boolean handleDoubleClick(int button) {
    ITextualEntityPart textualEntityPart = getTextualEntityPart();
    if (button == 1 && textualEntityPart != null) {
        IGEFEditorKit editorkit = (IGEFEditorKit) textualEntityPart.getModelEntity().wGetEditorKit();
        EditPoint editPoint = new EditPoint(textualEntityPart, textualEntityPart.getCaretPosition());
        IKeyHandler keyHandler = editorkit.getKeyHandler();
        IWholeSelection selection = keyHandler.calculateDoubleClickSelection(editPoint);
        performSelectionUpdate(selection, true);
        return true;
    }
    return super.handleDoubleClick(button);
}
Also used : ITextualEntityPart(org.whole.lang.ui.editparts.ITextualEntityPart) IGEFEditorKit(org.whole.lang.ui.editor.IGEFEditorKit) IKeyHandler(org.whole.lang.ui.keys.IKeyHandler)

Aggregations

IGEFEditorKit (org.whole.lang.ui.editor.IGEFEditorKit)3 ITextualEntityPart (org.whole.lang.ui.editparts.ITextualEntityPart)3 IKeyHandler (org.whole.lang.ui.keys.IKeyHandler)3 Point (org.eclipse.draw2d.geometry.Point)1 EditPoint (org.whole.lang.ui.tools.EditPoint)1