@Override public void consume(Exception e) { String message = String.format( "<html>\n" + " There was an error while creating a GitHub issue: %s\n" + " <br>\n" + " Please consider <a href=\"" + ISSUES_URL + "/new\">manually creating an issue</a>\n" + "</html>", e.getMessage() ); ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, message, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER ).setImportant(false).notify(project); } };
@Override public void consume(Boolean opened) { String url = null; String linkText = null; //noinspection ConstantConditions final SubmittedReportInfo reportInfo = new SubmittedReportInfo( url, linkText, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE ); consumer.consume(reportInfo); // pseudo-named-arguments NotificationListener notificationListener = null; //noinspection ConstantConditions ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, "Submitted", NotificationType.INFORMATION, notificationListener ).setImportant(false).notify(project); } };
@Override public void consume(Exception ex) { String message = ErrorReporterBundle.message("error.googlefeedback.error", ex.getMessage()); ReportMessages.GROUP .createNotification( ReportMessages.ERROR_REPORT, message, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER) .setImportant(false) .notify(project); } };
void notifyModuleStale() { if (shown) { return; } Notification notification = new Notification(GROUP_BINDING_PROBLEM, "<b>SonarLint - Project's binding data is invalid</b>", UPDATE_BINDING_MSG, NotificationType.WARNING, new OpenProjectSettingsNotificationListener(myProject)); notification.setImportant(true); notification.notify(myProject); shown = true; }
void notifyServerNotUpdated() { if (shown) { return; } Notification notification = new Notification(GROUP_BINDING_PROBLEM, "<b>SonarLint - No data for SonarQube server</b>", UPDATE_SERVER_MSG, NotificationType.WARNING, new OpenGeneralSettingsNotificationListener(myProject)); notification.setImportant(true); notification.notify(myProject); shown = true; }
void notifyServerIdInvalid() { if (shown) { return; } Notification notification = new Notification(GROUP_BINDING_PROBLEM, "<b>SonarLint - Project bound to invalid SonarQube server</b>", UPDATE_BINDING_MSG, NotificationType.WARNING, new OpenProjectSettingsNotificationListener(myProject)); notification.setImportant(true); notification.notify(myProject); shown = true; }
void notifyModuleInvalid() { if (shown) { return; } Notification notification = new Notification(GROUP_BINDING_PROBLEM, "<b>SonarLint - Project bound to an invalid remote project</b>", UPDATE_BINDING_MSG, NotificationType.WARNING, new OpenProjectSettingsNotificationListener(myProject)); notification.setImportant(true); notification.notify(myProject); shown = true; }
void notifyServerStorageNeedsUpdate(String serverId) { if (shown) { return; } Notification notification = new Notification(GROUP_BINDING_PROBLEM, "<b>SonarLint - Binding for server '" + serverId + "' outdated</b>", UPDATE_SERVER_MSG, NotificationType.WARNING, new OpenGeneralSettingsNotificationListener(myProject)); notification.setImportant(true); notification.notify(myProject); shown = true; }
@Override public void consume(String token) { final SubmittedReportInfo reportInfo = new SubmittedReportInfo( null, "Issue " + token, SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); callback.consume(reportInfo); ReportMessages.GROUP .createNotification( ReportMessages.ERROR_REPORT, "Submitted", NotificationType.INFORMATION, null) .setImportant(false) .notify(project); } };
@Override public void handle(SonarQubeNotification notification) { Notification notif = new Notification(GROUP_SONARQUBE_EVENT, "<b>SonarQube event</b>", createMessage(notification), NotificationType.INFORMATION, new NotificationListener.UrlOpeningListener(true)); notif.setImportant(true); notif.notify(myProject); }
private void showNotification(final Project project) { final Notification notification = notificationGroup.createNotification( HybrisI18NBundleUtils.message("hybris.project.open.outdated.title"), HybrisI18NBundleUtils.message("hybris.project.open.outdated.text"), NotificationType.INFORMATION, (myNotification, myHyperlinkEvent) -> ProjectRefreshAction.triggerAction() ); notification.setImportant(true); Notifications.Bus.notify(notification, project); }
@Override public void consume(SubmittedReportInfo reportInfo) { myOriginalConsumer.consume(reportInfo); if (reportInfo.getStatus().equals(SubmissionStatus.FAILED)) { ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, reportInfo.getLinkText(), NotificationType.ERROR, null).setImportant(false).notify(myProject); } else { ReportMessages.GROUP.createNotification( ReportMessages.ERROR_REPORT, reportInfo.getLinkText(), NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(myProject); } } }
private void showInfoBubble(final Project project, String titleKey, String textKey) { final PropertiesComponent properties = PropertiesComponent.getInstance(); final long lastNotificationTime = properties.getOrInitLong(LAST_BUBBLE_INFO_TIME_PROPERTY, 0); final long currentTime = System.currentTimeMillis(); if (currentTime - lastNotificationTime >= DateFormatUtil.MONTH) { properties.setValue(LAST_BUBBLE_INFO_TIME_PROPERTY, String.valueOf(currentTime)); final Notification notification = notificationGroup.createNotification( HybrisI18NBundleUtils.message(titleKey), HybrisI18NBundleUtils.message(textKey), NotificationType.INFORMATION, (myNotification, myHyperlinkEvent) -> goToDiscountOffer(myHyperlinkEvent) ); notification.setImportant(true); Notifications.Bus.notify(notification, project); ApplicationManager.getApplication().invokeLater(() -> { if (!notificationClosingAlarm.isDisposed()) { notificationClosingAlarm.addRequest(notification::hideBalloon, 3000); } }); } }
public void projectOpened() { PerlApplicationSettings settings = PerlApplicationSettings.getInstance(); if (settings.shouldShowAnnounce()) { StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> { settings.setAnnounceShown(); NotificationGroup group = new NotificationGroup(PerlBundle.message("plugin.update.baloon.group"), NotificationDisplayType.STICKY_BALLOON, true); Notification notification = group.createNotification( PerlBundle.message("plugin.update.baloon.title", PerlPluginUtil.getPluginVersion()), PerlBundle.message("plugin.update.baloon.text"), NotificationType.INFORMATION, new NotificationListener.UrlOpeningListener(false) ).setImportant(true) .addAction( new BrowseNotificationAction(PerlBundle.message("plugin.update.baloon.changes"), "https://plugins.jetbrains.com/plugin/7796")) .addAction(new BrowseNotificationAction(PerlBundle.message("plugin.update.baloon.tracker"), "https://github.com/hurricup/Perl5-IDEA/issues")) .addAction(new BrowseNotificationAction(PerlBundle.message("plugin.update.baloon.support"), "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HJCUADZKY5G7E")); Notifications.Bus.notify(notification); }); } StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> { PerlNamesCache.getInstance(myProject).forceCacheUpdate(); ApplicationManager.getApplication().invokeLater(FileContentUtil::reparseOpenedFiles); }); }