public static void displayFetchResult( @NotNull Project project, @NotNull GitFetchResult result, @Nullable String errorNotificationTitle, @NotNull Collection<? extends Exception> errors) { if (result.isSuccess()) { GitVcs.NOTIFICATION_GROUP_ID .createNotification( "Fetched successfully" + result.getAdditionalInfo(), NotificationType.INFORMATION) .notify(project); } else if (result.isCancelled()) { GitVcs.NOTIFICATION_GROUP_ID .createNotification( "Fetch cancelled by user" + result.getAdditionalInfo(), NotificationType.WARNING) .notify(project); } else if (result.isNotAuthorized()) { String title; String description; if (errorNotificationTitle != null) { title = errorNotificationTitle; description = "Fetch failed: couldn't authorize"; } else { title = "Fetch failed"; description = "Couldn't authorize"; } description += result.getAdditionalInfo(); GitUIUtil.notifyMessage(project, title, description, NotificationType.ERROR, true, null); } else { GitVcs instance = GitVcs.getInstance(project); if (instance != null && instance.getExecutableValidator().isExecutableValid()) { GitUIUtil.notifyMessage( project, "Fetch failed", result.getAdditionalInfo(), NotificationType.ERROR, true, errors); } } }
/** Displays a "success"-notification. */ public static void notifySuccess(Project project, String title, String description) { GitVcs.NOTIFICATION_GROUP_ID .createNotification(title, description, NotificationType.INFORMATION, null) .notify(project); }