Search in sources :

Example 1 with OrionSelectionOverlay

use of org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay in project che by eclipse.

the class OrionDocument method getSelectedLinearRange.

@Override
public LinearRange getSelectedLinearRange() {
    final OrionSelectionOverlay selection = this.textViewOverlay.getSelection();
    final int start = selection.getStart();
    final int end = selection.getEnd();
    return LinearRange.createWithStart(start).andEnd(end);
}
Also used : OrionSelectionOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay)

Example 2 with OrionSelectionOverlay

use of org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay in project che by eclipse.

the class OrionEditorWidget method getSelectedRange.

@Override
public Region getSelectedRange() {
    final OrionSelectionOverlay selection = this.editorOverlay.getSelection();
    final int start = selection.getStart();
    final int end = selection.getEnd();
    if (start < 0 || end > this.editorOverlay.getModel().getCharCount() || start > end) {
        throw new RuntimeException("Invalid selection");
    }
    return new RegionImpl(start, end - start);
}
Also used : OrionSelectionOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay) RegionImpl(org.eclipse.che.ide.api.editor.text.RegionImpl)

Example 3 with OrionSelectionOverlay

use of org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay in project che by eclipse.

the class OrionDocument method getSelectedTextRange.

@Override
public TextRange getSelectedTextRange() {
    final OrionSelectionOverlay selection = this.textViewOverlay.getSelection();
    final int start = selection.getStart();
    final TextPosition startPosition = getPositionFromIndex(start);
    final int end = selection.getEnd();
    final TextPosition endPosition = getPositionFromIndex(end);
    return new TextRange(startPosition, endPosition);
}
Also used : TextPosition(org.eclipse.che.ide.api.editor.text.TextPosition) OrionSelectionOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay) TextRange(org.eclipse.che.ide.api.editor.text.TextRange)

Aggregations

OrionSelectionOverlay (org.eclipse.che.ide.editor.orion.client.jso.OrionSelectionOverlay)3 RegionImpl (org.eclipse.che.ide.api.editor.text.RegionImpl)1 TextPosition (org.eclipse.che.ide.api.editor.text.TextPosition)1 TextRange (org.eclipse.che.ide.api.editor.text.TextRange)1