Search in sources :

Example 26 with Balloon

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

the class InplaceChangeSignature method showBalloon.

protected void showBalloon() {
    NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
    checkBox.addActionListener(e -> {
        myDelegate = checkBox.isSelected();
        updateCurrentInfo();
    });
    JPanel content = new JPanel(new BorderLayout());
    content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH);
    content.add(myPreview.getComponent(), BorderLayout.CENTER);
    updateMethodSignature(myStableChange);
    content.add(checkBox, BorderLayout.SOUTH);
    final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true);
    myBalloon = balloonBuilder.createBalloon();
    myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
    myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {

        @Override
        public RelativePoint recalculateLocation(Balloon object) {
            int offset = myStableChange.getMethod().getTextOffset();
            VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
            Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column));
            return new RelativePoint(myEditor.getContentComponent(), point);
        }
    }, Balloon.Position.above);
    Disposer.register(myBalloon, () -> {
        EditorFactory.getInstance().releaseEditor(myPreview);
        myPreview = null;
    });
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) NonFocusableCheckBox(com.intellij.ui.NonFocusableCheckBox) 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)

Example 27 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 28 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 29 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 30 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)

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