Search in sources :

Example 1 with HighlighterSettingsConfig

use of com.tobszarny.intellij.plugin.activetabhighlighter.config.HighlighterSettingsConfig in project ActiveTabHighlighterPlugin by tobszarny.

the class CustomEditorTabColorProvider method getEditorTabColor.

@Nullable
@Override
public Color getEditorTabColor(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    final FileEditorManagerEx fileEditorManagerEx = FileEditorManagerEx.getInstanceEx(project);
    FileColorManager fileColorManager = FileColorManager.getInstance(project);
    HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getSettings(project);
    if (highlighterSettingsConfig.isBackgroundColorUsed()) {
        EditorWindow activeWindow = fileEditorManagerEx.getCurrentWindow();
        if (activeWindow != null) {
            final EditorWithProviderComposite selectedEditor = activeWindow.getSelectedEditor();
            if (selectedEditor != null && virtualFile.equals(selectedEditor.getFile())) {
                return highlighterSettingsConfig.getBackgroundColor();
            }
        }
    }
    return fileColorManager.getFileColor(virtualFile);
}
Also used : EditorWithProviderComposite(com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite) HighlighterSettingsConfig(com.tobszarny.intellij.plugin.activetabhighlighter.config.HighlighterSettingsConfig) FileColorManager(com.intellij.ui.FileColorManager) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)1 EditorWindow (com.intellij.openapi.fileEditor.impl.EditorWindow)1 EditorWithProviderComposite (com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite)1 FileColorManager (com.intellij.ui.FileColorManager)1 HighlighterSettingsConfig (com.tobszarny.intellij.plugin.activetabhighlighter.config.HighlighterSettingsConfig)1 Nullable (org.jetbrains.annotations.Nullable)1