Search in sources :

Example 1 with Balloon

use of com.intellij.openapi.ui.popup.Balloon in project intellij-community by JetBrains.

the class StudyUtils method showErrorPopupOnToolbar.

public static void showErrorPopupOnToolbar(@NotNull Project project, String content) {
    final Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(content, MessageType.ERROR, null).createBalloon();
    showCheckPopUp(project, balloon);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon)

Example 2 with Balloon

use of com.intellij.openapi.ui.popup.Balloon in project intellij-community by JetBrains.

the class StudyRefreshTaskFileAction method showBalloon.

private static void showBalloon(@NotNull final Project project, String text, @NotNull final MessageType messageType) {
    BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, messageType, null);
    final Balloon balloon = balloonBuilder.createBalloon();
    StudyEditor selectedStudyEditor = StudyUtils.getSelectedStudyEditor(project);
    assert selectedStudyEditor != null;
    balloon.show(StudyUtils.computeLocation(selectedStudyEditor.getEditor()), Balloon.Position.above);
    Disposer.register(project, balloon);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) StudyEditor(com.jetbrains.edu.learning.editor.StudyEditor) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

Example 3 with Balloon

use of com.intellij.openapi.ui.popup.Balloon in project intellij-community by JetBrains.

the class StudyCheckUtils method showTestResultPopUp.

public static void showTestResultPopUp(final String text, Color color, @NotNull final Project project) {
    BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, null, color, null);
    final Balloon balloon = balloonBuilder.createBalloon();
    StudyUtils.showCheckPopUp(project, balloon);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

Example 4 with Balloon

use of com.intellij.openapi.ui.popup.Balloon in project intellij-community by JetBrains.

the class IpnbConnectionManager method showWarning.

private static void showWarning(@NotNull final IpnbFileEditor fileEditor, @NotNull final String message, @Nullable final HyperlinkAdapter listener) {
    ApplicationManager.getApplication().invokeLater(() -> {
        BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, null, MessageType.WARNING.getPopupBackground(), listener);
        final Balloon balloon = balloonBuilder.createBalloon();
        ApplicationManager.getApplication().invokeLater(() -> balloon.showInCenterOf(fileEditor.getRunCellButton()));
    });
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

Example 5 with Balloon

use of com.intellij.openapi.ui.popup.Balloon in project intellij-community by JetBrains.

the class PyStudyShowTutorial method projectOpened.

@Override
public void projectOpened() {
    ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {

        @Override
        public void run() {
            ApplicationManager.getApplication().runWriteAction(new DumbAwareRunnable() {

                @Override
                public void run() {
                    if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
                        final String content = "<html>If you'd like to learn more about PyCharm Edu, " + "click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
                        final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION, new NotificationListener.UrlOpeningListener(true));
                        Notifications.Bus.notify(notification);
                        Balloon balloon = notification.getBalloon();
                        if (balloon != null) {
                            balloon.addListener(new JBPopupAdapter() {

                                @Override
                                public void onClosed(LightweightWindowEvent event) {
                                    notification.expire();
                                }
                            });
                        }
                        notification.whenExpired(() -> PropertiesComponent.getInstance().setValue(ourShowPopup, false, true));
                    }
                }
            });
        }
    });
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) JBPopupAdapter(com.intellij.openapi.ui.popup.JBPopupAdapter) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener) LightweightWindowEvent(com.intellij.openapi.ui.popup.LightweightWindowEvent)

Aggregations

Balloon (com.intellij.openapi.ui.popup.Balloon)40 RelativePoint (com.intellij.ui.awt.RelativePoint)14 BalloonBuilder (com.intellij.openapi.ui.popup.BalloonBuilder)11 IdeFrame (com.intellij.openapi.wm.IdeFrame)5 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)4 Disposable (com.intellij.openapi.Disposable)3 JBPopupFactory (com.intellij.openapi.ui.popup.JBPopupFactory)3 LightweightWindowEvent (com.intellij.openapi.ui.popup.LightweightWindowEvent)3 BalloonImpl (com.intellij.ui.BalloonImpl)3 HyperlinkEvent (javax.swing.event.HyperlinkEvent)3 Executor (com.intellij.execution.Executor)2 Notification (com.intellij.notification.Notification)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 BalloonLayout (com.intellij.ui.BalloonLayout)2 Alarm (com.intellij.util.Alarm)2 java.awt (java.awt)2 MouseEvent (java.awt.event.MouseEvent)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2