Search in sources :

Example 1 with ServerCapabilities

use of io.typefox.lsapi.ServerCapabilities in project che by eclipse.

the class FindDefinitionAction method updateInPerspective.

@Override
public void updateInPerspective(@NotNull ActionEvent event) {
    EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    if (activeEditor instanceof TextEditor) {
        TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
        if (configuration instanceof LanguageServerEditorConfiguration) {
            ServerCapabilities capabilities = ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
            event.getPresentation().setEnabledAndVisible(capabilities.isDefinitionProvider() != null && capabilities.isDefinitionProvider());
            return;
        }
    }
    event.getPresentation().setEnabledAndVisible(false);
}
Also used : TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) LanguageServerEditorConfiguration(org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) TextEditorConfiguration(org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration) ServerCapabilities(io.typefox.lsapi.ServerCapabilities)

Example 2 with ServerCapabilities

use of io.typefox.lsapi.ServerCapabilities in project che by eclipse.

the class FindReferencesAction method updateInPerspective.

@Override
public void updateInPerspective(@NotNull ActionEvent event) {
    EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    if (activeEditor instanceof TextEditor) {
        TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
        if (configuration instanceof LanguageServerEditorConfiguration) {
            ServerCapabilities capabilities = ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
            event.getPresentation().setEnabledAndVisible(capabilities.isReferencesProvider() != null && capabilities.isReferencesProvider());
            return;
        }
    }
    event.getPresentation().setEnabledAndVisible(false);
}
Also used : TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) LanguageServerEditorConfiguration(org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) TextEditorConfiguration(org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration) ServerCapabilities(io.typefox.lsapi.ServerCapabilities)

Example 3 with ServerCapabilities

use of io.typefox.lsapi.ServerCapabilities in project che by eclipse.

the class GoToSymbolAction method updateInPerspective.

@Override
public void updateInPerspective(@NotNull ActionEvent event) {
    EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
    if (activeEditor instanceof TextEditor) {
        TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
        if (configuration instanceof LanguageServerEditorConfiguration) {
            ServerCapabilities capabilities = ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
            event.getPresentation().setEnabledAndVisible(capabilities.isDocumentSymbolProvider() != null && capabilities.isDocumentSymbolProvider());
            return;
        }
    }
    event.getPresentation().setEnabledAndVisible(false);
}
Also used : TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) LanguageServerEditorConfiguration(org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) TextEditorConfiguration(org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration) ServerCapabilities(io.typefox.lsapi.ServerCapabilities)

Aggregations

ServerCapabilities (io.typefox.lsapi.ServerCapabilities)3 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)3 TextEditorConfiguration (org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration)3 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)3 LanguageServerEditorConfiguration (org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration)3