Search in sources :

Example 1 with PositionConverter

use of org.eclipse.che.ide.api.editor.position.PositionConverter in project che by eclipse.

the class OrionEditorInit method addQuickAssistKeyBinding.

/**
     * Add key binding to quick assist assistant.
     */
private void addQuickAssistKeyBinding() {
    if (this.quickAssist != null) {
        final KeyBindingAction action = new KeyBindingAction() {

            @Override
            public boolean action() {
                final PositionConverter positionConverter = textEditor.getPositionConverter();
                if (positionConverter != null) {
                    textEditor.showQuickAssist();
                }
                return true;
            }
        };
        final HasKeyBindings hasKeyBindings = this.textEditor.getHasKeybindings();
        hasKeyBindings.addKeyBinding(new KeyBinding(false, false, true, false, KeyCode.ENTER, action), QUICK_FIX);
    }
}
Also used : KeyBinding(org.eclipse.che.ide.api.editor.keymap.KeyBinding) HasKeyBindings(org.eclipse.che.ide.api.editor.texteditor.HasKeyBindings) PositionConverter(org.eclipse.che.ide.api.editor.position.PositionConverter) KeyBindingAction(org.eclipse.che.ide.api.editor.keymap.KeyBindingAction)

Example 2 with PositionConverter

use of org.eclipse.che.ide.api.editor.position.PositionConverter in project che by eclipse.

the class OrionEditorPresenter method showQuickAssist.

protected void showQuickAssist() {
    if (quickAssistant == null) {
        return;
    }
    PositionConverter positionConverter = getPositionConverter();
    if (positionConverter != null) {
        TextPosition cursor = getCursorPosition();
        PositionConverter.PixelCoordinates pixelPos = positionConverter.textToPixel(cursor);
        quickAssistant.showPossibleQuickAssists(getCursorModel().getCursorPosition().getOffset(), pixelPos.getX(), pixelPos.getY());
    }
}
Also used : TextPosition(org.eclipse.che.ide.api.editor.text.TextPosition) PositionConverter(org.eclipse.che.ide.api.editor.position.PositionConverter)

Aggregations

PositionConverter (org.eclipse.che.ide.api.editor.position.PositionConverter)2 KeyBinding (org.eclipse.che.ide.api.editor.keymap.KeyBinding)1 KeyBindingAction (org.eclipse.che.ide.api.editor.keymap.KeyBindingAction)1 TextPosition (org.eclipse.che.ide.api.editor.text.TextPosition)1 HasKeyBindings (org.eclipse.che.ide.api.editor.texteditor.HasKeyBindings)1