Search in sources :

Example 1 with DelegateColorScheme

use of com.intellij.openapi.editor.colors.impl.DelegateColorScheme in project intellij-community by JetBrains.

the class ConsoleViewUtil method setupConsoleEditor.

public static void setupConsoleEditor(@NotNull final EditorEx editor, final boolean foldingOutlineShown, final boolean lineMarkerAreaShown) {
    ApplicationManager.getApplication().runReadAction(() -> {
        editor.setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.CONSOLE);
        final EditorSettings editorSettings = editor.getSettings();
        editorSettings.setLineMarkerAreaShown(lineMarkerAreaShown);
        editorSettings.setIndentGuidesShown(false);
        editorSettings.setLineNumbersShown(false);
        editorSettings.setFoldingOutlineShown(foldingOutlineShown);
        editorSettings.setAdditionalPageAtBottom(false);
        editorSettings.setAdditionalColumnsCount(0);
        editorSettings.setAdditionalLinesCount(0);
        editorSettings.setRightMarginShown(false);
        editorSettings.setCaretRowShown(false);
        editor.getGutterComponentEx().setPaintBackground(false);
        editor.putUserData(EDITOR_IS_CONSOLE_VIEW, true);
        final DelegateColorScheme scheme = updateConsoleColorScheme(editor.getColorsScheme());
        if (UISettings.getInstance().getPresentationMode()) {
            scheme.setEditorFontSize(UISettings.getInstance().getPresentationModeFontSize());
        }
        editor.setColorsScheme(scheme);
    });
}
Also used : DelegateColorScheme(com.intellij.openapi.editor.colors.impl.DelegateColorScheme)

Example 2 with DelegateColorScheme

use of com.intellij.openapi.editor.colors.impl.DelegateColorScheme in project intellij-community by JetBrains.

the class EventLogConsole method installNotificationsFont.

private void installNotificationsFont(@NotNull final EditorEx editor) {
    final DelegateColorScheme globalScheme = new DelegateColorScheme(EditorColorsManager.getInstance().getGlobalScheme()) {

        @Override
        public String getEditorFontName() {
            return getConsoleFontName();
        }

        @Override
        public int getEditorFontSize() {
            return getConsoleFontSize();
        }

        @Override
        public String getConsoleFontName() {
            return NotificationsUtil.getFontName();
        }

        @Override
        public int getConsoleFontSize() {
            Pair<String, Integer> data = NotificationsUtil.getFontData();
            return data == null ? super.getConsoleFontSize() : data.second;
        }

        @Override
        public void setEditorFontName(String fontName) {
        }

        @Override
        public void setConsoleFontName(String fontName) {
        }

        @Override
        public void setEditorFontSize(int fontSize) {
        }

        @Override
        public void setConsoleFontSize(int fontSize) {
        }
    };
    ApplicationManager.getApplication().getMessageBus().connect(myProjectModel).subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {

        @Override
        public void globalSchemeChange(EditorColorsScheme scheme) {
            globalScheme.setDelegate(EditorColorsManager.getInstance().getGlobalScheme());
            editor.reinitSettings();
        }
    });
    editor.setColorsScheme(ConsoleViewUtil.updateConsoleColorScheme(editor.createBoundColorSchemeDelegate(globalScheme)));
    if (editor instanceof EditorImpl) {
        ((EditorImpl) editor).setUseEditorAntialiasing(false);
    }
}
Also used : EditorColorsListener(com.intellij.openapi.editor.colors.EditorColorsListener) EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) DelegateColorScheme(com.intellij.openapi.editor.colors.impl.DelegateColorScheme)

Example 3 with DelegateColorScheme

use of com.intellij.openapi.editor.colors.impl.DelegateColorScheme in project intellij-community by JetBrains.

the class EditorTextFieldCellRenderer method getEditorPanel.

@NotNull
private RendererComponent getEditorPanel(final JTable table) {
    RendererComponent panel = UIUtil.getClientProperty(table, MY_PANEL_PROPERTY);
    if (panel != null) {
        DelegateColorScheme scheme = (DelegateColorScheme) panel.getEditor().getColorsScheme();
        scheme.setDelegate(EditorColorsManager.getInstance().getGlobalScheme());
        return panel;
    }
    panel = createRendererComponent(myProject, myFileType, myInheritFontFromLaF);
    Disposer.register(this, panel);
    Disposer.register(this, new Disposable() {

        @Override
        public void dispose() {
            UIUtil.putClientProperty(table, MY_PANEL_PROPERTY, null);
        }
    });
    table.putClientProperty(MY_PANEL_PROPERTY, panel);
    return panel;
}
Also used : Disposable(com.intellij.openapi.Disposable) DelegateColorScheme(com.intellij.openapi.editor.colors.impl.DelegateColorScheme) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DelegateColorScheme (com.intellij.openapi.editor.colors.impl.DelegateColorScheme)3 Disposable (com.intellij.openapi.Disposable)1 EditorColorsListener (com.intellij.openapi.editor.colors.EditorColorsListener)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 EditorImpl (com.intellij.openapi.editor.impl.EditorImpl)1 NotNull (org.jetbrains.annotations.NotNull)1