如何设置PsiFileNode或其子项的背景颜色

问题描述 投票:0回答:2

如何设置PsiFileNode或其子项的背景颜色?我知道如何更改PsiFileNode fileName前景

    public class MarkedFile extends PsiFileNode {
    private Color backgroundColor;

    public MarkedFile(Project project, @NotNull PsiFile value, ViewSettings viewSettings, Color backgroundColor) {
        super(project, value, viewSettings);
        this.backgroundColor = backgroundColor;
    }

    public Color getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(Color backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    @NotNull
    @Override
    protected PresentationData createPresentation() {
        PresentationData presentationData = super.createPresentation();
        presentationData.setForcedTextForeground(backgroundColor);
        return presentationData;
    }
  }

但是如何设置文件的背景颜色,因为我们可以在“目标”或“out”java目录中看到它

java intellij-idea intellij-plugin
2个回答
0
投票

您可以通过EditorTabColorProvider.EP_NAME扩展点控制项目树和选项卡中文件的背景颜色。覆盖getProjectViewColor以突出显示项目树中的文件。


1
投票

树视图中节点的背景颜色由文件颜色(“设置”|“外观和行为”|“文件颜色”)控制。无法覆盖单个节点的背景颜色。

© www.soinside.com 2019 - 2024. All rights reserved.