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);
}
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);
}
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);
}
Aggregations