use of org.eclipse.che.ide.api.editor.text.TextPosition in project che by eclipse.
the class OpenLocationPresenter method onLocationSelected.
@Override
public void onLocationSelected(LocationDTO location) {
RangeDTO range = location.getRange();
helper.openFile(location.getUri(), new TextRange(new TextPosition(range.getStart().getLine(), range.getStart().getCharacter()), new TextPosition(range.getEnd().getLine(), range.getEnd().getCharacter())));
}
use of org.eclipse.che.ide.api.editor.text.TextPosition in project che by eclipse.
the class SymbolEntry method runOpen.
private boolean runOpen() {
editor.getDocument().setCursorPosition(new TextPosition(range.getFrom().getLine(), range.getFrom().getCharacter()));
editor.setFocus();
return true;
}
use of org.eclipse.che.ide.api.editor.text.TextPosition in project che by eclipse.
the class FindSymbolAction method toSymbolEntries.
private List<SymbolEntry> toSymbolEntries(List<SymbolInformationDTO> types, String value) {
List<SymbolEntry> result = new ArrayList<>();
for (SymbolInformationDTO element : types) {
if (!SUPPORTED_OPEN_TYPES.contains(symbolKindHelper.from(element.getKind()))) {
continue;
}
List<Match> matches = fuzzyMatches.fuzzyMatch(value, element.getName());
if (matches != null) {
LocationDTO location = element.getLocation();
if (location != null && location.getUri() != null) {
String filePath = location.getUri();
RangeDTO locationRange = location.getRange();
TextRange range = null;
if (locationRange != null) {
range = new TextRange(new TextPosition(locationRange.getStart().getLine(), locationRange.getStart().getCharacter()), new TextPosition(locationRange.getEnd().getLine(), locationRange.getEnd().getCharacter()));
}
result.add(new SymbolEntry(element.getName(), "", filePath, filePath, symbolKindHelper.from(element.getKind()), range, symbolKindHelper.getIcon(element.getKind()), editorHelper, matches));
}
}
}
//TODO add sorting
return result;
}
use of org.eclipse.che.ide.api.editor.text.TextPosition in project che by eclipse.
the class OrionCursorModel method dispatchCursorChange.
private void dispatchCursorChange(final boolean isExplicitChange) {
final TextPosition position = this.document.getCursorPosition();
cursorHandlerManager.dispatch(new Dispatcher<CursorHandler>() {
@Override
public void dispatch(CursorHandler listener) {
listener.onCursorChange(position.getLine(), position.getCharacter(), isExplicitChange);
}
});
}
use of org.eclipse.che.ide.api.editor.text.TextPosition in project che by eclipse.
the class OrionCursorModel method getCursorPosition.
@Override
public Position getCursorPosition() {
TextPosition position = document.getCursorPosition();
int offset = document.getIndexFromPosition(position);
return new Position(offset);
}
Aggregations