use of org.eclipse.che.api.languageserver.shared.lsapi.ReferenceContextDTO 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