[git] IDEA-89452 "File" or "Folder"
authorKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Mon, 30 Jul 2012 13:31:48 +0000 (17:31 +0400)
committerKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Mon, 30 Jul 2012 13:32:12 +0000 (17:32 +0400)
plugins/git4idea/src/git4idea/GitUtil.java
plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java

index 8bb458675347579efd10c4531ea5acc174754d17..6b6cd840542029be062ac94723496fed458af878 100644 (file)
@@ -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";
+    }
+  }
 }
index 691d5e08c88f388485b465124799ddb6a1ba4004..0ec99f63c5eea44223be9d3348bf8336d568512d 100644 (file)
@@ -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 <code>%s</code> doesn't exist in branch <code>%s</code>", 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 <code>%s</code> doesn't exist in branch <code>%s</code>",
+                                            GitUtil.fileOrFolder(file), file.getPresentableUrl(), branchToCompare),
                               NotificationType.WARNING, true, null);
     }
   }