Search in sources :

Example 1 with TextEditorConfiguration

use of org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration 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 TextEditorConfiguration

use of org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration 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 TextEditorConfiguration

use of org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration in project che by eclipse.

the class PublishDiagnosticsProcessor method processDiagnostics.

public void processDiagnostics(PublishDiagnosticsParamsDTO diagnosticsMessage) {
    EditorPartPresenter openedEditor = editorAgent.getOpenedEditor(new Path(diagnosticsMessage.getUri()));
    //TODO add markers
    if (openedEditor == null) {
        return;
    }
    if (openedEditor instanceof TextEditor) {
        TextEditorConfiguration editorConfiguration = ((TextEditor) openedEditor).getConfiguration();
        AnnotationModel annotationModel = editorConfiguration.getAnnotationModel();
        if (annotationModel != null && annotationModel instanceof DiagnosticCollector) {
            DiagnosticCollector collector = (DiagnosticCollector) annotationModel;
            collector.beginReporting();
            try {
                for (DiagnosticDTO diagnostic : diagnosticsMessage.getDiagnostics()) {
                    collector.acceptDiagnostic(diagnostic);
                }
            } finally {
                collector.endReporting();
            }
        }
    }
}
Also used : Path(org.eclipse.che.ide.resource.Path) TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) DiagnosticDTO(org.eclipse.che.api.languageserver.shared.lsapi.DiagnosticDTO) AnnotationModel(org.eclipse.che.ide.api.editor.annotation.AnnotationModel) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) TextEditorConfiguration(org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration)

Example 4 with TextEditorConfiguration

use of org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration in project che by eclipse.

the class JsJavaEditorProvider method getEditor.

@Override
public TextEditor getEditor() {
    LOG.fine("JsJavaEditor instance creation.");
    final TextEditor textEditor = super.getEditor();
    if (textEditor instanceof OrionEditorPresenter) {
        final OrionEditorPresenter editor = (OrionEditorPresenter) textEditor;
        final TextEditorConfiguration configuration = configurationFactory.create(editor);
        editor.initialize(configuration);
        editor.addEditorUpdateAction(new EditorUpdateAction() {

            @Override
            public void doRefresh() {
                final Reconciler reconciler = configuration.getReconciler();
                if (reconciler != null) {
                    final ReconcilingStrategy strategy = reconciler.getReconcilingStrategy(DEFAULT_CONTENT_TYPE);
                    if (strategy instanceof JavaReconcilerStrategy) {
                        ((JavaReconcilerStrategy) strategy).parse();
                    }
                }
            }
        });
    }
    watcher.editorOpened(textEditor);
    return textEditor;
}
Also used : ReconcilingStrategy(org.eclipse.che.ide.api.editor.reconciler.ReconcilingStrategy) TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) Reconciler(org.eclipse.che.ide.api.editor.reconciler.Reconciler) EditorUpdateAction(org.eclipse.che.ide.api.editor.editorconfig.EditorUpdateAction) TextEditorConfiguration(org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration) OrionEditorPresenter(org.eclipse.che.ide.editor.orion.client.OrionEditorPresenter)

Example 5 with TextEditorConfiguration

use of org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration 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

TextEditorConfiguration (org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration)5 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)5 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)4 ServerCapabilities (io.typefox.lsapi.ServerCapabilities)3 LanguageServerEditorConfiguration (org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration)3 DiagnosticDTO (org.eclipse.che.api.languageserver.shared.lsapi.DiagnosticDTO)1 AnnotationModel (org.eclipse.che.ide.api.editor.annotation.AnnotationModel)1 EditorUpdateAction (org.eclipse.che.ide.api.editor.editorconfig.EditorUpdateAction)1 Reconciler (org.eclipse.che.ide.api.editor.reconciler.Reconciler)1 ReconcilingStrategy (org.eclipse.che.ide.api.editor.reconciler.ReconcilingStrategy)1 OrionEditorPresenter (org.eclipse.che.ide.editor.orion.client.OrionEditorPresenter)1 Path (org.eclipse.che.ide.resource.Path)1