Search in sources :

Example 21 with Balloon

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

the class GotoCustomRegionAction method notifyCustomRegionsUnavailable.

private static void notifyCustomRegionsUnavailable(@NotNull Editor editor, @NotNull Project project) {
    final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
    Balloon balloon = popupFactory.createHtmlTextBalloonBuilder(IdeBundle.message("goto.custom.region.message.unavailable"), MessageType.INFO, null).setFadeoutTime(2000).setHideOnClickOutside(true).setHideOnKeyOutside(true).createBalloon();
    Disposer.register(project, balloon);
    balloon.show(popupFactory.guessBestPopupLocation(editor), Balloon.Position.below);
}
Also used : JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) Balloon(com.intellij.openapi.ui.popup.Balloon)

Example 22 with Balloon

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

the class BalloonLayoutImpl method doLayout.

private void doLayout(List<Balloon> balloons, int startX, int bottomY) {
    int y = bottomY;
    ToolWindowsPane pane = UIUtil.findComponentOfType(myParent, ToolWindowsPane.class);
    if (pane != null) {
        y -= pane.getBottomHeight();
    }
    if (myParent instanceof IdeRootPane) {
        y -= ((IdeRootPane) myParent).getStatusBarHeight();
    }
    for (Balloon balloon : balloons) {
        Rectangle bounds = new Rectangle(getSize(balloon));
        y -= bounds.height;
        bounds.setLocation(startX - bounds.width, y);
        balloon.setBounds(bounds);
    }
}
Also used : IdeRootPane(com.intellij.openapi.wm.impl.IdeRootPane) Balloon(com.intellij.openapi.ui.popup.Balloon) ToolWindowsPane(com.intellij.openapi.wm.impl.ToolWindowsPane)

Example 23 with Balloon

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

the class BalloonLayoutImpl method createColumns.

private List<ArrayList<Balloon>> createColumns(Rectangle layoutRec) {
    List<ArrayList<Balloon>> columns = new ArrayList<>();
    ArrayList<Balloon> eachColumn = new ArrayList<>();
    columns.add(eachColumn);
    int eachColumnHeight = 0;
    for (Balloon each : myBalloons) {
        final Dimension eachSize = getSize(each);
        if (eachColumnHeight + eachSize.height > layoutRec.getHeight()) {
            eachColumn = new ArrayList<>();
            columns.add(eachColumn);
            eachColumnHeight = 0;
        }
        eachColumn.add(each);
        eachColumnHeight += eachSize.height;
    }
    return columns;
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon)

Example 24 with Balloon

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

the class BalloonLayoutImpl method dispose.

public void dispose() {
    myLayeredPane.removeComponentListener(myResizeListener);
    if (myLafListener != null) {
        LafManager.getInstance().removeLafManagerListener(myLafListener);
        myLafListener = null;
    }
    for (Balloon balloon : new ArrayList<>(myBalloons)) {
        Disposer.dispose(balloon);
    }
    myRelayoutAlarm.cancelAllRequests();
    myBalloons.clear();
    myLayoutData.clear();
    myListeners.clear();
    myLayeredPane = null;
    myParent = null;
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon)

Example 25 with Balloon

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

the class GotItMessage method show.

public void show(RelativePoint point, Balloon.Position position) {
    if (myDisposable != null && Disposer.isDisposed(myDisposable)) {
        return;
    }
    final GotItPanel panel = new GotItPanel();
    panel.myTitle.setText(myTitle);
    panel.myMessage.setText(myMessage);
    if (myHyperlinkListener != null) {
        panel.myMessage.addHyperlinkListener(myHyperlinkListener);
    }
    panel.myButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(panel.myRoot);
    if (myDisposable != null) {
        builder.setDisposable(myDisposable);
    }
    final Balloon balloon = builder.setFillColor(UIUtil.getListBackground()).setHideOnClickOutside(false).setHideOnAction(false).setHideOnFrameResize(false).setHideOnKeyOutside(false).setShowCallout(myShowCallout).setBlockClicksThroughBalloon(true).createBalloon();
    panel.myButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            balloon.hide();
            if (myCallback != null) {
                myCallback.run();
            }
        }
    });
    balloon.show(point, position);
}
Also used : MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) Balloon(com.intellij.openapi.ui.popup.Balloon) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

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