use of org.eclipse.che.api.languageserver.shared.lsapi.TextDocumentIdentifierDTO in project che by eclipse.
the class DtoBuildHelper method createTDPP.
public TextDocumentPositionParamsDTO createTDPP(Document document, int cursorOffset) {
TextDocumentPositionParamsDTO paramsDTO = dtoFactory.createDto(TextDocumentPositionParamsDTO.class);
TextDocumentIdentifierDTO identifierDTO = dtoFactory.createDto(TextDocumentIdentifierDTO.class);
identifierDTO.setUri(document.getFile().getLocation().toString());
PositionDTO positionDTO = dtoFactory.createDto(PositionDTO.class);
TextPosition position = document.getPositionFromIndex(cursorOffset);
positionDTO.setCharacter(position.getCharacter());
positionDTO.setLine(position.getLine());
paramsDTO.setUri(document.getFile().getLocation().toString());
paramsDTO.setTextDocument(identifierDTO);
paramsDTO.setPosition(positionDTO);
return paramsDTO;
}
use of org.eclipse.che.api.languageserver.shared.lsapi.TextDocumentIdentifierDTO in project che by eclipse.
the class FindReferencesAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
//TODO replace this
if (!(activeEditor instanceof TextEditor)) {
return;
}
TextEditor textEditor = ((TextEditor) activeEditor);
String path = activeEditor.getEditorInput().getFile().getLocation().toString();
ReferenceParamsDTO paramsDTO = dtoFactory.createDto(ReferenceParamsDTO.class);
PositionDTO positionDTO = dtoFactory.createDto(PositionDTO.class);
positionDTO.setLine(textEditor.getCursorPosition().getLine());
positionDTO.setCharacter(textEditor.getCursorPosition().getCharacter());
TextDocumentIdentifierDTO identifierDTO = dtoFactory.createDto(TextDocumentIdentifierDTO.class);
identifierDTO.setUri(path);
ReferenceContextDTO contextDTO = dtoFactory.createDto(ReferenceContextDTO.class);
contextDTO.setIncludeDeclaration(true);
paramsDTO.setUri(path);
paramsDTO.setPosition(positionDTO);
paramsDTO.setTextDocument(identifierDTO);
paramsDTO.setContext(contextDTO);
Promise<List<LocationDTO>> promise = client.references(paramsDTO);
presenter.openLocation(promise);
}
Aggregations