Search in sources :

Example 6 with Notification

use of com.intellij.notification.Notification in project jscs-plugin by idok.

the class JscsProjectComponent method validationFailed.

private void validationFailed(String msg) {
    NotificationListener notificationListener = new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            JscsInspection.showSettings(project);
        }
    };
    String errorMessage = msg + FIX_CONFIG_HREF;
    showInfoNotification(errorMessage, NotificationType.WARNING, notificationListener);
    LOG.debug(msg);
    settingValidStatus = false;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 7 with Notification

use of com.intellij.notification.Notification in project jscs-plugin by idok.

the class JscsProjectComponent method showInfoNotification.

public void showInfoNotification(String content, NotificationType type) {
    Notification errorNotification = new Notification(PLUGIN_NAME, PLUGIN_NAME, content, type);
    Notifications.Bus.notify(errorNotification, this.project);
}
Also used : Notification(com.intellij.notification.Notification)

Example 8 with Notification

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

the class GoModuleLibrariesInitializer method showNotification.

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);
    }
}
Also used : 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 9 with Notification

use of com.intellij.notification.Notification in project intellij-plugins by StepicOrg.

the class ActionUtils method notify.

static void notify(@NotNull Project project, @NotNull String title, @NotNull String content, @NotNull NotificationType type) {
    if (content.isEmpty()) {
        content = "<empty>";
    }
    Notification notification = new Notification("Step.sending", title, content, type);
    notification.notify(project);
}
Also used : Notification(com.intellij.notification.Notification)

Example 10 with Notification

use of com.intellij.notification.Notification in project intellij-community by JetBrains.

the class TaskManagerTest method testNotifications.

public void testNotifications() throws Exception {
    final Ref<Notification> notificationRef = new Ref<>();
    getProject().getMessageBus().connect(myFixture.getTestRootDisposable()).subscribe(Notifications.TOPIC, new NotificationsAdapter() {

        @Override
        public void notify(@NotNull Notification notification) {
            notificationRef.set(notification);
        }
    });
    TestRepository repository = new TestRepository() {

        @Override
        public Task[] getIssues(@Nullable String query, int max, long since) throws Exception {
            throw new Exception();
        }
    };
    myTaskManager.setRepositories(Collections.singletonList(repository));
    myTaskManager.updateIssues(null);
    assertNull(notificationRef.get());
    myTaskManager.getIssues("");
    assertNotNull(notificationRef.get());
}
Also used : NotificationsAdapter(com.intellij.notification.NotificationsAdapter) Ref(com.intellij.openapi.util.Ref) Notification(com.intellij.notification.Notification) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Notification (com.intellij.notification.Notification)108 HyperlinkEvent (javax.swing.event.HyperlinkEvent)34 NotNull (org.jetbrains.annotations.NotNull)34 NotificationListener (com.intellij.notification.NotificationListener)33 Project (com.intellij.openapi.project.Project)19 IOException (java.io.IOException)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 File (java.io.File)8 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)7 Nullable (org.jetbrains.annotations.Nullable)7 Module (com.intellij.openapi.module.Module)6 Task (com.intellij.openapi.progress.Task)6 ExecutionException (com.intellij.execution.ExecutionException)4 NotificationType (com.intellij.notification.NotificationType)4 Application (com.intellij.openapi.application.Application)3 Library (com.intellij.openapi.roots.libraries.Library)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ArrayList (java.util.ArrayList)3 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)2 NotificationAction (com.intellij.notification.NotificationAction)2