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