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);
}
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);
}
}
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;
}
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;
}
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);
}
Aggregations