From df1a6d0a592e673a5b2d189118469f4bb8403ab8 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 12 Jun 2013 16:46:40 +0200 Subject: [PATCH] show paths relative to user home as file locations in Changes view --- .../openapi/vcs/changes/ui/ChangesBrowserChangeNode.java | 2 +- .../openapi/vcs/changes/ui/ChangesBrowserFileNode.java | 3 ++- .../openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeNode.java index 3cefb2b118d4..1eb151c0c94e 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserChangeNode.java @@ -75,7 +75,7 @@ public class ChangesBrowserChangeNode extends ChangesBrowserNode impleme if (renderer.isShowFlatten()) { final File parentFile = filePath.getIOFile().getParentFile(); if (parentFile != null) { - renderer.append(" (" + parentFile.getPath() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); + renderer.append(" (" + FileUtil.getLocationRelativeToUserHome(parentFile.getPath()) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); } appendSwitched(renderer); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java index 17eee40e803f..fbb06c6a7058 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java @@ -17,6 +17,7 @@ package com.intellij.openapi.vcs.changes.ui; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.FileStatusManager; @@ -59,7 +60,7 @@ public class ChangesBrowserFileNode extends ChangesBrowserNode impl if (renderer.isShowFlatten() && file.isValid()) { final VirtualFile parentFile = file.getParent(); assert parentFile != null; - renderer.append(" (" + parentFile.getPresentableUrl() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); + renderer.append(" (" + FileUtil.getLocationRelativeToUserHome(parentFile.getPresentableUrl()) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); } else if (getCount() != 1 || getDirectoryCount() != 0) { appendCount(renderer); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java index 5f981ceae16c..6220696849a9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFilePathNode.java @@ -56,7 +56,7 @@ public class ChangesBrowserFilePathNode extends ChangesBrowserNode { if (renderer.isShowFlatten()) { renderer.append(path.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); final FilePath parentPath = path.getParentPath(); - renderer.append(" (" + parentPath.getPresentableUrl() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); + renderer.append(" (" + FileUtil.getLocationRelativeToUserHome(parentPath.getPresentableUrl()) + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES); } else { renderer.append(getRelativePath(safeCastToFilePath(((ChangesBrowserNode)getParent()).getUserObject()), path),