@Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(ANDROID_WIFI_ADB_TITLE, message, type, null); Notifications.Bus.notify(notification); } });
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); }
/** * 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); } }
@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); }
@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 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); }); }
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)); }
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 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); } }
@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); } };
Notification notification = GoConstants.GO_NOTIFICATION_GROUP.createNotification("Vendoring usage is detected", "<p><strong>vendor</strong> directory usually means that project uses Go Vendor Experiment.</p>\n" + "<p>Selected Go SDK version support vendoring but it's disabled by default.</p>\n" +
private void notify(String message, NotificationType notificationType) { MONGO_GROUP.createNotification("[MongoPlugin] " + message, notificationType) .notify(project); } }
public static void showWarning(final Project project, final String warningText) { BALLOON_GROUP .createNotification("", warningText, WARNING, URL_OPENING_LISTENER) .notify(project); }
public static void showError(final Project project, final String errorText) { BALLOON_GROUP .createNotification("", errorText, ERROR, URL_OPENING_LISTENER) .notify(project); }
public static void showInfo(final Project project, final String infoText) { BALLOON_GROUP .createNotification("", infoText, INFORMATION, URL_OPENING_LISTENER) .notify(project); }
@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 showException(final Project project, final Throwable t) { LOG_ONLY_GROUP .createNotification(titleFor(t), messageFor(t), ERROR, URL_OPENING_LISTENER) .notify(project); }
private static void notifyServiceAccountError(Project project, String name, String errorMessage) { Notification notification = NOTIFICATION_GROUP.createNotification( GoogleCloudApisMessageBundle.message("cloud.apis.service.account.created.error.title"), null /*subtitle*/, GoogleCloudApisMessageBundle.message( "cloud.apis.service.account.created.error.message", name, errorMessage), NotificationType.ERROR); notification.notify(project); }
private static void notifyApiEnableError(Set<CloudLibrary> apis, Project project) { Notification notification = NOTIFICATION_GROUP.createNotification( GoogleCloudApisMessageBundle.message("cloud.apis.enable.error.title"), null /*subtitle*/, GoogleCloudApisMessageBundle.message( "cloud.apis.enable.error.message", joinApiNames(apis)), NotificationType.ERROR); notification.notify(project); }