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); }
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
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); }
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); }
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); }
public static void showUnconfiguredInterpreterNotification(@NotNull Project project) { Notification notification = new Notification( PerlBundle.message("perl.select.sdk.notification"), PerlBundle.message("perl.select.sdk.notification.title"), PerlBundle.message("perl.select.sdk.notification.message"), NotificationType.ERROR ); notification.addAction(new DumbAwareAction(PerlBundle.message("perl.configure.interpreter.action")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { Perl5SettingsConfigurable.open(project); notification.expire(); } }); Notifications.Bus.notify(notification, project); }
); notification.addAction(new DumbAwareAction(PerlBundle.message("perl.cache.cleaner.action.clean")) { @Override public void actionPerformed(@NotNull AnActionEvent event) {
@VisibleForTesting void showCloudSdkNotification(String notificationMessage, NotificationType notificationType) { if (!CloudSdkValidator.getInstance().isValidCloudSdk()) { Notification invalidSdkWarning = new Notification( new PropertiesFileFlagReader().getFlagString("notifications.plugin.groupdisplayid"), CloudSdkMessageBundle.message("cloudsdk.notification.title"), notificationMessage, notificationType); // add a link to SDK settings for a quick fix if this is a fatal error. if (notificationType == NotificationType.ERROR) { invalidSdkWarning.addAction( new AnAction( CloudSdkMessageBundle.message("appengine.deployment.error.sdk.settings.action")) { @Override public void actionPerformed(AnActionEvent e) { ShowSettingsUtil.getInstance() .showSettingsDialog( null /* IDE-wide settings, no project needed. */, CloudSdkConfigurable.class); // expire if action has been called to avoid error hanging out forever. invalidSdkWarning.expire(); } }); } Notifications.Bus.notify(invalidSdkWarning); } }
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); }); }
NotificationType.ERROR ); Notifications.Bus.notify(notification.addAction( new DumbAwareAction(action.getTemplatePresentation().getText()) { @Override