show paths relative to user home as file locations in Changes view

This commit is contained in:
Dmitry Jemerov
2013-06-12 16:50:54 +02:00
parent ea9d1fa082
commit df1a6d0a59
3 changed files with 4 additions and 3 deletions
@@ -75,7 +75,7 @@ public class ChangesBrowserChangeNode extends ChangesBrowserNode<Change> 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);
}
@@ -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<VirtualFile> 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);
@@ -56,7 +56,7 @@ public class ChangesBrowserFilePathNode extends ChangesBrowserNode<FilePath> {
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),