[git] IDEA-89452 "File" or "Folder"

This commit is contained in:
Kirill Likhodedov
2012-07-30 17:32:12 +04:00
parent 1b575436db
commit 3b42ba22e7
2 changed files with 14 additions and 3 deletions
@@ -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";
}
}
}
@@ -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);
}
}