Search in sources :

Example 1 with BalloonLayoutData

use of com.intellij.ui.BalloonLayoutData 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 2 with BalloonLayoutData

use of com.intellij.ui.BalloonLayoutData in project intellij-plugins by JetBrains.

the class DartFeedbackBuilder method showErrorNotification.

private static void showErrorNotification(@NotNull Notification notification, @NotNull Project project) {
    // Adapted from IdeMessagePanel.showErrorNotification()
    IdeFrame myFrame = WindowManager.getInstance().getIdeFrame(project);
    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);
    Balloon balloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
    layout.add(balloon);
}
Also used : BalloonLayout(com.intellij.ui.BalloonLayout) BalloonLayoutData(com.intellij.ui.BalloonLayoutData) Balloon(com.intellij.openapi.ui.popup.Balloon) JBColor(com.intellij.ui.JBColor) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Aggregations

BalloonLayout (com.intellij.ui.BalloonLayout)2 BalloonLayoutData (com.intellij.ui.BalloonLayoutData)2 JBColor (com.intellij.ui.JBColor)2 Notification (com.intellij.notification.Notification)1 NotificationAction (com.intellij.notification.NotificationAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Balloon (com.intellij.openapi.ui.popup.Balloon)1 Ref (com.intellij.openapi.util.Ref)1 IdeFrame (com.intellij.openapi.wm.IdeFrame)1