Search in sources :

Example 21 with NotificationListener

use of com.intellij.notification.NotificationListener in project intellij-plugins by JetBrains.

the class Flexmojos4GenerateConfigTask method showWarningWithDetails.

private static void showWarningWithDetails(final Project project, final String details) {
    final NotificationListener listener = new NotificationListener.Adapter() {

        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
            Messages.showErrorDialog(project, FlexBundle.message("flexmojos4.details.start", details), FlexBundle.message("flexmojos.project.import"));
            notification.expire();
        }
    };
    new Notification("Maven", FlexBundle.message("flexmojos.project.import"), FlexBundle.message("flexmojos4.warning.with.link"), NotificationType.WARNING, listener).notify(project);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) MavenRootModelAdapter(org.jetbrains.idea.maven.importing.MavenRootModelAdapter) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 22 with NotificationListener

use of com.intellij.notification.NotificationListener in project intellij-plugins by JetBrains.

the class DesignerApplicationManager method notifyUser.

static void notifyUser(boolean debug, @NotNull String text, @NotNull Project project, @Nullable final Consumer<String> handler) {
    Notification notification = new Notification(FlashUIDesignerBundle.message("plugin.name"), getOpenActionTitle(debug), text, NotificationType.ERROR, handler == null ? null : new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
                return;
            }
            notification.expire();
            if ("help".equals(event.getDescription())) {
                HelpManager.getInstance().invokeHelp("flex.ui.designer.launch");
            } else {
                handler.consume(event.getDescription());
            }
        }
    });
    notification.notify(project);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 23 with NotificationListener

use of com.intellij.notification.NotificationListener in project buck by facebook.

the class BuckPluginNotifications method notifyActionToolbar.

public static void notifyActionToolbar(final Project project) {
    if (!PropertiesComponent.getInstance().isValueSet(GROUP_DISPLAY_ID)) {
        Notifications.Bus.notify(new Notification(GROUP_DISPLAY_ID, "Buck Plugin", "<html><a href=''>Enable</a> the toolbar to easily access the buck plugin actions." + "<br>You can enable/disable it at any time by pressing on View > Toolbar " + "in the menu.</html>", NotificationType.INFORMATION, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent hyperlinkEvent) {
                BuckToolWindowFactory.showMainToolbar(project);
            }
        }), project);
        PropertiesComponent.getInstance().setValue(GROUP_DISPLAY_ID, "true");
    }
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 24 with NotificationListener

use of com.intellij.notification.NotificationListener in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoModuleLibrariesInitializer method showVendoringNotification.

private void showVendoringNotification() {
    if (!myModuleInitialized || myModule.isDisposed()) {
        return;
    }
    Project project = myModule.getProject();
    String version = GoSdkService.getInstance(project).getSdkVersion(myModule);
    if (!GoVendoringUtil.supportsVendoring(version) || GoVendoringUtil.supportsVendoringByDefault(version)) {
        return;
    }
    if (GoModuleSettings.getInstance(myModule).getVendoringEnabled() != ThreeState.UNSURE) {
        return;
    }
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
    boolean shownAlready;
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (propertiesComponent) {
        shownAlready = propertiesComponent.getBoolean(GO_VENDORING_NOTIFICATION_HAD_BEEN_SHOWN, false);
        if (!shownAlready) {
            propertiesComponent.setValue(GO_VENDORING_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())) {
                    GoModuleSettings.showModulesConfigurable(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);
    }
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 25 with NotificationListener

use of com.intellij.notification.NotificationListener in project ideavim by JetBrains.

the class VimShortcutKeyAction method notifyAboutShortcutConflict.

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);
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) VimEmulationConfigurable(com.maddyhome.idea.vim.ui.VimEmulationConfigurable) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

NotificationListener (com.intellij.notification.NotificationListener)36 HyperlinkEvent (javax.swing.event.HyperlinkEvent)28 Notification (com.intellij.notification.Notification)26 NotNull (org.jetbrains.annotations.NotNull)23 Project (com.intellij.openapi.project.Project)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 GuardedBy (com.android.annotations.concurrency.GuardedBy)2 IDevice (com.android.ddmlib.IDevice)2 com.android.tools.idea.fd (com.android.tools.idea.fd)2 RestartActivityAction (com.android.tools.idea.fd.actions.RestartActivityAction)2 ConsolePrinter (com.android.tools.idea.run.ConsolePrinter)2 LaunchStatus (com.android.tools.idea.run.util.LaunchStatus)2 BrowserUtil (com.intellij.ide.BrowserUtil)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)2 NotificationType (com.intellij.notification.NotificationType)2 ShowSettingsUtil (com.intellij.openapi.options.ShowSettingsUtil)2 MultiMap (com.intellij.util.containers.MultiMap)2 File (java.io.File)2 Set (java.util.Set)2 Nullable (org.jetbrains.annotations.Nullable)2