public static void sendNotification(String message, NotificationType notificationType) { if(message == null || message.trim().length()==0){ return; } Notification notification = new Notification("com.dim.plugin.Gsonformat", "Gsonformat ", espaceString(message), notificationType); Notifications.Bus.notify(notification); }
private void notify(String message, NotificationType notificationType) { MONGO_GROUP.createNotification("[MongoPlugin] " + message, notificationType) .notify(project); } }
private void displayNewUserNotification() { Notification notification = new Notification( NOTIFICATION_GROUP.getDisplayId(), NOTIFICATION_TITLE, "The google-java-format plugin is disabled by default. " + "<a href=\"enable\">Enable for this project</a>.", NotificationType.INFORMATION, (n, e) -> { settings.setEnabled(true); n.expire(); }); notification.notify(project); } }
@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); } };
private void notifyAboutShortcutConflict(@NotNull final KeyStroke keyStroke) { VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.VIM); final String message = String.format( "Using the <b>%s</b> shortcut for Vim emulation.<br/>" + "You can redefine it as an <a href='#ide'>IDE shortcut</a> or " + "configure its handler in <a href='#settings'>Vim Emulation</a> settings.", KeymapUtil.getShortcutText(new KeyboardShortcut(keyStroke, null))); final NotificationListener listener = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) { final String description = e.getDescription(); if ("#ide".equals(description)) { VimPlugin.getKey().getSavedShortcutConflicts().put(keyStroke, ShortcutOwner.IDE); notification.expire(); } else if ("#settings".equals(description)) { ShowSettingsUtil.getInstance().editConfigurable((Project)null, new VimEmulationConfigurable()); } } }; final Notification notification = new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE, message, NotificationType.INFORMATION, listener); notification.notify(null); }
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; }
private static void showMissingLibraryNotification(@NotNull Project project, @NotNull Sdk sdk, @NotNull String libraryName) { Notification notification = new Notification( PerlBundle.message("perl.missing.library.notification"), PerlBundle.message("perl.missing.library.notification.title", libraryName), PerlBundle.message("perl.missing.library.notification.message", libraryName), NotificationType.ERROR ); AnAction installCpanmAction = ReadAction .compute(() -> CpanminusAdapter.createInstallAction(sdk, project, Collections.singletonList(libraryName), notification::expire)); if (installCpanmAction != null) { notification.addAction(installCpanmAction); } notification.addAction(CpanAdapter.createInstallAction(sdk, project, Collections.singletonList(libraryName), notification::expire)); Notifications.Bus.notify(notification, project); }
static void askToCreateShortcut(KeyPromoterAction action) { final int maxTips = settings.getMaxNumberOfTips(); if (maxTips != 0 && NOTIFICATION_LIST.size() >= maxTips) { final Notification notification = NOTIFICATION_LIST.removeFirst(); notification.expire(); } Notification notification = GROUP.createNotification( KeyPromoterBundle.message("kp.notification.group"), KeyPromoterBundle.message("kp.notification.ask.new.shortcut", action.getDescription()), NotificationType.INFORMATION, null ).setIcon(KeyPromoterIcons.KP_ICON) .addAction(new EditKeymapAction(action)); notification.addAction(new SuppressTipAction(action, notification)); NOTIFICATION_LIST.addLast(notification); notification.notify(null); }
public static void notifyEnableMessage(final Project project) { Notification notification = new Notification("Symfony Plugin", "Symfony Plugin", "Enable the Symfony Plugin <a href=\"enable\">with auto configuration now</a>, open <a href=\"config\">Project Settings</a> or <a href=\"dismiss\">dismiss</a> further messages", NotificationType.INFORMATION, (notification1, event) -> { // handle html click events if("config".equals(event.getDescription())) { // open settings dialog and show panel SettingsForm.show(project); } else if("enable".equals(event.getDescription())) { enablePluginAndConfigure(project); Notifications.Bus.notify(new Notification("Symfony Plugin", "Symfony Plugin", "Plugin enabled", NotificationType.INFORMATION), project); } else if("dismiss".equals(event.getDescription())) { // user doesnt want to show notification again Settings.getInstance(project).dismissEnableNotification = true; } notification1.expire(); }); Notifications.Bus.notify(notification, project); }
@Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { String description = event.getDescription(); if (GO_GET_LINK.equals(description)) { GoGetPackageFix.applyFix(myProject, myModule, myGoGetImportPath, false); notification.expire(); } } } }
@NotNull private static Notification createNotification(@NotNull final String dialogKey, @NotNull String title, @NotNull String message, @NotNull NotificationType icon, @Nullable NotificationListener question, @Nullable Runnable onMessageExpired) { final String groupId = P4Bundle.getString("notification.groupid"); Notification ret; if (question != null) { ret = new Notification(groupId, title, message, icon, question); } else { ret = new Notification(groupId, title, message, icon); } if (onMessageExpired != null) { ret.whenExpired(onMessageExpired); } return ret; } }
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); }); }
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); }
CloudSdkMessageBundle.message("managedsdk.update.notification"), NotificationType.INFORMATION); notification.addAction( new AnAction(CloudSdkMessageBundle.message("managedsdk.update.notification.cancel")) { @Override notification.addAction( new AnAction(CloudSdkMessageBundle.message("managedsdk.update.notification.disable")) { @Override
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; }
new Notification( VimPlugin.IDEAVIM_STICKY_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE, ShowSettingsUtil.getInstance().editConfigurable((Project)null, new VimEmulationConfigurable()); }).notify(null); manager.setActiveKeymap(keymap); new Notification( VimPlugin.IDEAVIM_STICKY_NOTIFICATION_ID, VimPlugin.IDEAVIM_NOTIFICATION_TITLE, "~/.ideavimrc using this command:<br/><br/>" + "<code>source ~/.vimrc</code>", NotificationType.INFORMATION).notify(null);
private static void showMissingLibraryNotification(@NotNull Project project, @NotNull Sdk sdk, @NotNull Collection<String> packageNames) { if (packageNames.isEmpty()) { return; } if (packageNames.size() == 1) { showMissingLibraryNotification(project, sdk, packageNames.iterator().next()); return; } Notification notification = new Notification( PerlBundle.message("perl.missing.library.notification"), PerlBundle.message("perl.missing.library.notification.title", packageNames.size()), StringUtil.join(ContainerUtil.sorted(packageNames), ", "), NotificationType.ERROR ); AnAction installCpanmAction = ReadAction.compute(() -> CpanminusAdapter.createInstallAction(sdk, project, packageNames, notification::expire)); if (installCpanmAction != null) { notification.addAction(installCpanmAction); } notification.addAction(CpanAdapter.createInstallAction(sdk, project, packageNames, notification::expire)); Notifications.Bus.notify(notification, 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); } };
static void showTip(KeyPromoterAction action, int count) { String message = KeyPromoterBundle.message("kp.notification.tip", action.getDescription(), count); final int maxTips = settings.getMaxNumberOfTips(); if (maxTips != 0 && NOTIFICATION_LIST.size() >= maxTips) { final Notification notification = NOTIFICATION_LIST.removeFirst(); notification.expire(); } final Notification notification = GROUP.createNotification(KeyPromoterBundle.message( "kp.notification.group"), message, NotificationType.INFORMATION, null).setIcon(KeyPromoterIcons.KP_ICON) .addAction(new EditKeymapAction(action, action.getShortcut())); notification.addAction(new SuppressTipAction(action, notification)); NOTIFICATION_LIST.addLast(notification); notification.notify(null); }