/** * Shows {@link Notification}. * * @param project current project * @param title notification title * @param group notification group * @param content notification text * @param type notification type * @param listener optional listener */ public static void show(@NotNull Project project, @NotNull String title, @NotNull String content, @NotNull NotificationGroup group, @NotNull NotificationType type, @Nullable NotificationListener listener) { Notification notification = group.createNotification(title, content, type, listener); Notifications.Bus.notify(notification, project); } }
private static void error(@NotNull String title, @NotNull Project project, @Nullable Exception ex) { String message = ex == null ? "" : ExceptionUtil.getUserStackTrace(ex, LOG); NotificationType type = NotificationType.ERROR; Notifications.Bus.notify(GoConstants.GO_EXECUTION_NOTIFICATION_GROUP.createNotification(title, message, type, null), project); }
@Override protected boolean doSomething(@NotNull VirtualFile virtualFile, @Nullable Module module, @NotNull Project project, @NotNull String title) throws ExecutionException { VirtualFile executable = getExecutable(project, module); if (executable == null) { String message = "Can't find `" + myExecutableName + "` in GOPATH. Try to invoke <a href=\"" + GO_GET_LINK + "\">go get " + myExecutableName + "</a>"; NotificationListener listener = new MyNotificationListener(project, module); Notifications.Bus.notify(GoConstants.GO_NOTIFICATION_GROUP.createNotification(title, message, NotificationType.WARNING, listener), project); return false; } return super.doSomething(virtualFile, module, project, title); }
public static void debug(String text) { if (LEVEL >= DEBUG) { Notifications.Bus.notify( new Notification(NAME, NAME + " [DEBUG]", redirect(text), NotificationType.INFORMATION)); } }
@Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(Constant.TITLE, message == null || message.trim().length() == 0 ? "[Empty]" : message, type, new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent hyperlinkEvent) { URL url = hyperlinkEvent.getURL(); if (url == null) { return; } if (listener != null) { listener.onUrlClick(url); return; } if ("file".equals(url.getProtocol())) { if ("open".equals(url.getHost())) { String[] args = url.getQuery().split("="); if (args.length == 2) { Utils.openDirectory(args[1]); } } } } }); Notifications.Bus.notify(notification); } });
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); }
private static void showErrorNotification(@NotNull Project project, @NotNull String content) { Notifications.Bus.notify(new Notification(SymfonyInstallerUtil.INSTALLER_GROUP_DISPLAY_ID, "Symfony-Installer", content, NotificationType.ERROR, null), project); }
private static void showInfoNotification(@NotNull Project project, @NotNull String content) { Notifications.Bus.notify(new Notification(SymfonyInstallerUtil.INSTALLER_GROUP_DISPLAY_ID, "Symfony-Installer", content, NotificationType.INFORMATION, null), project); }
public void showInfoNotification(String content) { Notification errorNotification = new Notification("Symfony Plugin", "Symfony Plugin", content, NotificationType.INFORMATION); Notifications.Bus.notify(errorNotification, this.project); }
private void notifyFailure(final Exception exception) { Notification notification = new Notification( "Swagger UI", "Could not generate Swagger UI", exception.getMessage(), NotificationType.WARNING); Notifications.Bus.notify(notification); }
dialog = new GeneratorDialog(project, action); } else { Notifications.Bus.notify(new Notification( fileType.getLanguageName(), IgnoreBundle.message("action.newFile.exists", fileType.getLanguageName()),
private static void showNotification(@NotNull Project project) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); PropertiesComponent projectPropertiesComponent = PropertiesComponent.getInstance(project); boolean shownAlready; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (propertiesComponent) { shownAlready = propertiesComponent.getBoolean(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false) || projectPropertiesComponent.getBoolean(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false); if (!shownAlready) { propertiesComponent.setValue(BALLERINA_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true)); } } if (!shownAlready) { NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && "configure".equals(event.getDescription())) { BallerinaLibrariesConfigurableProvider.showModulesConfigurable(project); } } }; Notification notification = BallerinaConstants.BALLERINA_NOTIFICATION_GROUP.createNotification("BALLERINA_REPOSITORY was " + "detected", "We've detected some packages from your BALLERINA_REPOSITORY.\n", NotificationType.INFORMATION, notificationListener); Notifications.Bus.notify(notification, project); } }
"<p>You may want to explicitly enabled Go Vendor Experiment in the <a href='configure'>project settings</a>.</p>", NotificationType.INFORMATION, notificationListener); Notifications.Bus.notify(notification, project);
/** * Creates new user template. */ private void performCreateAction() { IgnoreSettings.UserTemplate template = new IgnoreSettings.UserTemplate(name.getText(), previewDocument.getText()); settings.getUserTemplates().add(template); Notifications.Bus.notify(new Notification( IgnoreBundle.PLUGIN_ID, IgnoreBundle.message("dialog.userTemplate.added"), IgnoreBundle.message("dialog.userTemplate.added.description", template.getName()), NotificationType.INFORMATION ), project); super.doOKAction(); } }
private static void showNotification(@NotNull Project project) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); PropertiesComponent projectPropertiesComponent = PropertiesComponent.getInstance(project); boolean shownAlready; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (propertiesComponent) { shownAlready = propertiesComponent.getBoolean(GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false) || projectPropertiesComponent.getBoolean(GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false); if (!shownAlready) { propertiesComponent.setValue(GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true)); } } if (!shownAlready) { NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && "configure".equals(event.getDescription())) { GoLibrariesConfigurableProvider.showModulesConfigurable(project); } } }; Notification notification = GoConstants.GO_NOTIFICATION_GROUP.createNotification("GOPATH was detected", "We've detected some libraries from your GOPATH.\n" + "You may want to add extra libraries in <a href='configure'>Go Libraries configuration</a>.", NotificationType.INFORMATION, notificationListener); Notifications.Bus.notify(notification, project); } }
private void showNotification(@NotNull String message, NotificationType type) { ApplicationManager.getApplication().invokeLater(() -> { String title = getPresentableName(); Notifications.Bus.notify(BallerinaConstants.BALLERINA_EXECUTION_NOTIFICATION_GROUP .createNotification(title, message, type, null), myProject); }); }
@Override public void initComponent() { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); boolean wasDisplayed; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (propertiesComponent) { wasDisplayed = propertiesComponent.getBoolean(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, false); propertiesComponent.setValue(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, true); } if (wasDisplayed) return; Notifications.Bus.notify(GoConstants.GO_NOTIFICATION_GROUP.createNotification("Learn how to setup a new Go project", "Please visit our " + "<a href=\"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/wiki/v1.0.0-Setup-initial-project\">wiki page<a/>" + " to learn how to setup a new Go project", NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER)); }
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); }
@Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(ANDROID_WIFI_ADB_TITLE, message, type, null); Notifications.Bus.notify(notification); } });
private void showNotification(@NotNull String message, NotificationType type) { ApplicationManager.getApplication().invokeLater(() -> { String title = getPresentableName(); Notifications.Bus.notify(GoConstants.GO_EXECUTION_NOTIFICATION_GROUP.createNotification(title, message, type, null), myProject); }); }