From 3b42ba22e7b4b4f469beff78a211e855edddc1a7 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 30 Jul 2012 17:31:48 +0400 Subject: [PATCH] [git] IDEA-89452 "File" or "Folder" --- plugins/git4idea/src/git4idea/GitUtil.java | 10 ++++++++++ .../git4idea/actions/GitCompareWithBranchAction.java | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index 8bb458675347..6b6cd8405420 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -855,4 +855,14 @@ public class GitUtil { } return hash; } + + @NotNull + public static String fileOrFolder(@NotNull VirtualFile file) { + if (file.isDirectory()) { + return "Folder"; + } + else { + return "File"; + } + } } diff --git a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java index 691d5e08c88f..0ec99f63c5ee 100644 --- a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java +++ b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java @@ -209,9 +209,10 @@ public class GitCompareWithBranchAction extends DumbAwareAction { new GitDiffFromHistoryHandler(project).showDiffForTwo(new FilePathImpl(file), compareRevision, currentRevision); } - private static void fileDoesntExistInBranchError(Project project, VirtualFile file, String branchToCompare) { - GitUIUtil.notifyMessage(project, "File doesn't exist in branch", - String.format("File %s doesn't exist in branch %s", file.getPresentableUrl(), branchToCompare), + private static void fileDoesntExistInBranchError(@NotNull Project project, @NotNull VirtualFile file, @NotNull String branchToCompare) { + GitUIUtil.notifyMessage(project, GitUtil.fileOrFolder(file) + " doesn't exist in branch", + String.format("%s %s doesn't exist in branch %s", + GitUtil.fileOrFolder(file), file.getPresentableUrl(), branchToCompare), NotificationType.WARNING, true, null); } }