Search in sources :

Example 71 with Notification

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

the class PluginManagerMain method notifyPluginsUpdated.

public static void notifyPluginsUpdated(@Nullable Project project) {
    final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
    String title = IdeBundle.message("update.notifications.title");
    String action = IdeBundle.message(app.isRestartCapable() ? "ide.restart.action" : "ide.shutdown.action");
    String message = IdeBundle.message("ide.restart.required.notification", action, ApplicationNamesInfo.getInstance().getFullProductName());
    NotificationListener listener = new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            notification.expire();
            app.restart(true);
        }
    };
    UpdateChecker.NOTIFICATIONS.createNotification(title, XmlStringUtil.wrapInHtml(message), NotificationType.INFORMATION, listener).notify(project);
}
Also used : HTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent) ApplicationEx(com.intellij.openapi.application.ex.ApplicationEx) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 72 with Notification

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

the class IdeNotificationArea method updateStatus.

private void updateStatus() {
    final Project project = getProject();
    ArrayList<Notification> notifications = EventLog.getLogModel(project).getNotifications();
    applyIconToStatusAndToolWindow(project, createIconWithNotificationCount(notifications));
    int count = notifications.size();
    setToolTipText(count > 0 ? String.format("%s notification%s pending", count, count == 1 ? "" : "s") : "No new notifications");
    myStatusBar.updateWidget(ID());
}
Also used : Project(com.intellij.openapi.project.Project) Notification(com.intellij.notification.Notification)

Example 73 with Notification

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

the class IdeMessagePanel method showErrorNotification.

private void showErrorNotification(@Nullable String notificationText, @NotNull Project project) {
    Notification notification = new Notification("", AllIcons.Ide.FatalError, notificationText == null ? ERROR_TITLE : "", null, notificationText == null ? "" : notificationText, NotificationType.ERROR, null);
    if (notificationText == null) {
        notification.addAction(new NotificationAction(ERROR_LINK) {

            @Override
            public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
                notification.expire();
                _openFatals(null);
            }
        });
    }
    BalloonLayout layout = myFrame.getBalloonLayout();
    assert layout != null;
    BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
    layoutData.fadeoutTime = 5000;
    layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
    layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
    assert myBalloon == null;
    myBalloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
    Disposer.register(myBalloon, () -> myBalloon = null);
    layout.add(myBalloon);
}
Also used : Ref(com.intellij.openapi.util.Ref) BalloonLayout(com.intellij.ui.BalloonLayout) NotificationAction(com.intellij.notification.NotificationAction) BalloonLayoutData(com.intellij.ui.BalloonLayoutData) JBColor(com.intellij.ui.JBColor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Notification(com.intellij.notification.Notification)

Example 74 with Notification

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

the class DefaultIdeaErrorLogger method processMappingFailed.

private static void processMappingFailed(IdeaLoggingEvent event) throws InterruptedException, InvocationTargetException {
    if (!ourMappingFailedNotificationPosted && SystemInfo.isWindows && SystemInfo.is32Bit) {
        ourMappingFailedNotificationPosted = true;
        @SuppressWarnings("ThrowableResultOfMethodCallIgnored") String exceptionMessage = event.getThrowable().getMessage();
        String text = exceptionMessage + "<br>Possible cause: unable to allocate continuous memory chunk of necessary size.<br>" + "Reducing JVM maximum heap size (-Xmx) may help.";
        Notifications.Bus.notify(new Notification("Memory", "Memory Mapping Failed", text, NotificationType.WARNING), null);
    }
}
Also used : Notification(com.intellij.notification.Notification)

Example 75 with Notification

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

the class ProjectLoadingErrorsNotifierImpl method fireNotifications.

private void fireNotifications() {
    final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<>();
    synchronized (myLock) {
        if (myErrors.isEmpty())
            return;
        descriptionsMap.putAllValues(myErrors);
        myErrors.clear();
    }
    for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
        final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
        if (descriptions.isEmpty())
            continue;
        final String invalidElements = getInvalidElementsString(type, descriptions);
        final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";
        Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, errorDescription -> errorDescription.isValid());
                if (RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions)) {
                    notification.expire();
                }
            }
        }), myProject);
    }
}
Also used : MultiMap(com.intellij.util.containers.MultiMap) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ConfigurationErrorDescription(com.intellij.openapi.module.ConfigurationErrorDescription) ConfigurationErrorType(com.intellij.openapi.module.ConfigurationErrorType) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

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