Search in sources :

Example 1 with BalloonBuilder

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

use of com.intellij.openapi.ui.popup.BalloonBuilder 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 BalloonBuilder

use of com.intellij.openapi.ui.popup.BalloonBuilder 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 BalloonBuilder

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

the class ExternalSystemUiUtil method showBalloon.

/**
   * Asks to show balloon that contains information related to the given component.
   *
   * @param component    component for which we want to show information
   * @param messageType  balloon message type
   * @param message      message to show
   */
public static void showBalloon(@NotNull JComponent component, @NotNull MessageType messageType, @NotNull String message) {
    final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null).setDisposable(ApplicationManager.getApplication()).setFadeoutTime(BALLOON_FADEOUT_TIME);
    Balloon balloon = builder.createBalloon();
    Dimension size = component.getSize();
    Balloon.Position position;
    int x;
    int y;
    if (size == null) {
        x = y = 0;
        position = Balloon.Position.above;
    } else {
        x = Math.min(10, size.width / 2);
        y = size.height;
        position = Balloon.Position.below;
    }
    balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 5 with BalloonBuilder

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

the class GeneralCodeStylePanel method showError.

private static void showError(final JTextField field, final String message) {
    BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR.getDefaultIcon(), MessageType.ERROR.getPopupBackground(), null);
    balloonBuilder.setFadeoutTime(1500);
    final Balloon balloon = balloonBuilder.createBalloon();
    final Rectangle rect = field.getBounds();
    final Point p = new Point(0, rect.height);
    final RelativePoint point = new RelativePoint(field, p);
    balloon.show(point, Balloon.Position.below);
    Disposer.register(ProjectManager.getInstance().getDefaultProject(), balloon);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

Aggregations

BalloonBuilder (com.intellij.openapi.ui.popup.BalloonBuilder)14 Balloon (com.intellij.openapi.ui.popup.Balloon)12 RelativePoint (com.intellij.ui.awt.RelativePoint)7 Disposable (com.intellij.openapi.Disposable)3 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 Project (com.intellij.openapi.project.Project)2 JBPopupFactory (com.intellij.openapi.ui.popup.JBPopupFactory)2 JBLabel (com.intellij.ui.components.JBLabel)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 MouseEvent (java.awt.event.MouseEvent)2 ArrayList (java.util.ArrayList)2 Executor (com.intellij.execution.Executor)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 JsonBundle (com.intellij.json.JsonBundle)1 CommonShortcuts (com.intellij.openapi.actionSystem.CommonShortcuts)1 ModalityState (com.intellij.openapi.application.ModalityState)1 FileChooserDescriptorFactory (com.intellij.openapi.fileChooser.FileChooserDescriptorFactory)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1