@Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(ANDROID_WIFI_ADB_TITLE, message, type, null); Notifications.Bus.notify(notification); } });
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); } }
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 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); }
@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(); } } } }
@Override public void initComponent() { LOG.debug("initComponent"); Notifications.Bus.register(IDEAVIM_STICKY_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON); ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { updateState(); } }); final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction(); EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getRawHandler())); // Register vim actions in command mode RegisterActions.registerActions(); // Add some listeners so we can handle special events setupListeners(); // Register ex handlers CommandParser.getInstance().registerHandlers(); if (!ApplicationManager.getApplication().isUnitTestMode()) { final File ideaVimRc = VimScriptParser.findIdeaVimRc(); if (ideaVimRc != null) { VimScriptParser.executeFile(ideaVimRc); } } LOG.debug("done"); }
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); }
/** * 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(); } }
@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 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()); } } };
/** * 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); } }
dialog = new GeneratorDialog(project, action); } else { Notifications.Bus.notify(new Notification( fileType.getLanguageName(), IgnoreBundle.message("action.newFile.exists", fileType.getLanguageName()),
@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 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); }); }
@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); }
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); }); }
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); } }
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" + "<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);