Search in sources :

Example 1 with ReferenceContextDTO

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);
}
Also used : TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) ReferenceContextDTO(org.eclipse.che.api.languageserver.shared.lsapi.ReferenceContextDTO) TextDocumentIdentifierDTO(org.eclipse.che.api.languageserver.shared.lsapi.TextDocumentIdentifierDTO) ReferenceParamsDTO(org.eclipse.che.api.languageserver.shared.lsapi.ReferenceParamsDTO) Collections.singletonList(java.util.Collections.singletonList) List(java.util.List) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) PositionDTO(org.eclipse.che.api.languageserver.shared.lsapi.PositionDTO)

Aggregations

Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 PositionDTO (org.eclipse.che.api.languageserver.shared.lsapi.PositionDTO)1 ReferenceContextDTO (org.eclipse.che.api.languageserver.shared.lsapi.ReferenceContextDTO)1 ReferenceParamsDTO (org.eclipse.che.api.languageserver.shared.lsapi.ReferenceParamsDTO)1 TextDocumentIdentifierDTO (org.eclipse.che.api.languageserver.shared.lsapi.TextDocumentIdentifierDTO)1 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)1 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)1