IDEA-229335 Light Editor: color of inactive tabs matches background color of editor

GitOrigin-RevId: 2889127c73cdbc6ed77f04e14fd4cb4eeb7dd178
This commit is contained in:
Rustam Vishnyakov
2019-12-30 11:01:15 +00:00
committed by intellij-monorepo-bot
parent 69c27453bc
commit dd5ed9a83e
@@ -14,6 +14,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.tabs.TabInfo;
import com.intellij.ui.tabs.TabsListener;
import com.intellij.ui.tabs.impl.JBEditorTabs;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -30,11 +31,21 @@ class LightEditTabs extends JBEditorTabs {
addListener(new TabsListener() {
@Override
public void selectionChanged(TabInfo oldSelection, TabInfo newSelection) {
ObjectUtils.consumeIfNotNull(oldSelection, tabInfo -> tabInfo.setTabColor(getUnselectedTabColor()));
ObjectUtils.consumeIfNotNull(newSelection, tabInfo -> tabInfo.setTabColor(getSelectedTabColor()));
onSelectionChange(newSelection);
}
});
}
private static Color getSelectedTabColor() {
return EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground();
}
private static Color getUnselectedTabColor() {
return null;
}
void addEditorTab(@NotNull LightEditorInfo editorInfo) {
addEditorTab(editorInfo, -1);
}
@@ -42,8 +53,7 @@ class LightEditTabs extends JBEditorTabs {
private void addEditorTab(@NotNull LightEditorInfo editorInfo, int index) {
TabInfo tabInfo = new TabInfo(new EditorContainer(editorInfo.getEditor()))
.setText(editorInfo.getFile().getPresentableName())
.setIcon(getFileTypeIcon(editorInfo))
.setTabColor(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
.setIcon(getFileTypeIcon(editorInfo));
tabInfo.setObject(editorInfo);