From c064e86a8c7c0df0586670cc0bd2ca5221abc08e Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Tue, 15 Jan 2019 17:48:02 +0300 Subject: [PATCH] IDEA-170942 vcs: use background color from scope for non-existent files --- .../intellij/openapi/vcs/changes/ui/ChangesTree.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java index 1c45e9bec6d1..7c38bd131d7d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTree.java @@ -700,10 +700,10 @@ public abstract class ChangesTree extends Tree implements DataProvider { public Color getFileColorFor(Object object) { VirtualFile file; if (object instanceof FilePath) { - file = ((FilePath)object).getVirtualFile(); + file = getVirtualFileFor((FilePath)object); } else if (object instanceof Change) { - file = ((Change)object).getVirtualFile(); + file = getVirtualFileFor(ChangesUtil.getFilePath((Change)object)); } else { file = ObjectUtils.tryCast(object, VirtualFile.class); @@ -715,6 +715,12 @@ public abstract class ChangesTree extends Tree implements DataProvider { return super.getFileColorFor(object); } + @Nullable + private static VirtualFile getVirtualFileFor(@NotNull FilePath filePath) { + if (filePath.isNonLocal()) return null; + return ChangesUtil.findValidParentAccurately(filePath); + } + @Override protected void processMouseEvent(MouseEvent e) { if (e.getID() == MouseEvent.MOUSE_PRESSED) {