public void showIncomingChatInvitation(@NotNull ChatInvitation chatInvitation, @NotNull IncomingChatInvitationNotification notification) { IncomingChatInvitationPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingChatInvitationPopup(chatInvitation); IncomingChatInvitationPopup popup = new IncomingChatInvitationPopup(popupModel); IncomingChatInvitationPopupListener incomingChatInvitationPopupListener = new IncomingChatInvitationPopupListener(this, chatInvitation); ListenerService.putListenerToComponent(popup, IIncomingChatInvitationPopup.Listener.class, incomingChatInvitationPopupListener); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup); balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0)); balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0)); balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setShadow(true); IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject); RelativePoint pointToShowPopup = null; if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent()); Balloon balloon = balloonBuilder.createBalloon(); balloon.show(pointToShowPopup, Balloon.Position.atLeft); TrackingService.trace(SwingRawEvent.notificationShow(popup)); }
public void showIncomingChatInvitation(@NotNull IncomingAnswer incomingTip, @NotNull IncomingTipNotification notification) { IIncomingTipPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingTipPopup(incomingTip); IncomingTipPopup popup = new IncomingTipPopup(popupModel); DataService.putData(popup, TrackingKeys.Location, new Locations.TipAnswerNotification(incomingTip.getSolution().getId())); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup); balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0)); balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0)); balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setShadow(true); IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject); RelativePoint pointToShowPopup = null; if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent()); Balloon balloon = balloonBuilder.createBalloon(); data.put(popup, incomingTip); notifications.put(popup, notification); balloons.put(popup, balloon); balloon.show(pointToShowPopup, Balloon.Position.atLeft); TrackingService.trace(SwingRawEvent.notificationShow(popup)); }
public void showIncomingHelpRequest(@NotNull IncomingHelpRequest helpRequest, @NotNull IncomingHelpRequestNotification notification) { IHelpRequestPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertHelpRequestPopup(helpRequest); HelpRequestPopup popup = new HelpRequestPopup(popupModel); DataService.putData(popup, TrackingKeys.Location, new Locations.HelpRequestNotification(helpRequest.getMatch().getHelpRequest().getId())); DataService.putData(popup, TrackingKeys.WriteTipTransaction, Funnels.newTransactionId()); HelpRequestPopupListener helpRequestPopupListener = new HelpRequestPopupListener(this); ListenerService.putListenerToComponent(popup, IHelpRequestPopup.Listener.class, helpRequestPopupListener); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup); balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0)); balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0)); balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background)); balloonBuilder.setShadow(true); IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject); RelativePoint pointToShowPopup = null; if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent()); Balloon balloon = balloonBuilder.createBalloon(); data.put(popup, helpRequest); notifications.put(popup, notification); balloons.put(popup, balloon); balloon.show(pointToShowPopup, Balloon.Position.atLeft); TrackingService.trace(SwingRawEvent.notificationShow(popup)); }
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type, final boolean atTop, @Nullable final Disposable disposable) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); if (popupFactory == null) return; BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null); balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable); Balloon balloon = balloonBuilder.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); }
/** * 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); }
private void showBalloon(Editor editor, String replacementPreviewText) { if (ApplicationManager.getApplication().isUnitTestMode()) { myReplacementPreviewText = replacementPreviewText; return; } ReplacementView replacementView = new ReplacementView(replacementPreviewText); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(replacementView); balloonBuilder.setFadeoutTime(0); balloonBuilder.setFillColor(IdeTooltipManager.GRAPHITE_COLOR); balloonBuilder.setAnimationCycle(0); balloonBuilder.setHideOnClickOutside(false); balloonBuilder.setHideOnKeyOutside(false); balloonBuilder.setHideOnAction(false); balloonBuilder.setCloseButtonEnabled(true); myReplacementBalloon = balloonBuilder.createBalloon(); myReplacementBalloon.show(new ReplacementBalloonPositionTracker(editor), Balloon.Position.below); }
public void showNoSdkNotification(@NotNull final Project project) { final String text = "<html>No Python interpreter configured for the project<br><a href=\"\">Configure interpreter</a></html>"; final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance(). createHtmlTextBalloonBuilder(text, null, MessageType.WARNING.getPopupBackground(), new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { ApplicationManager.getApplication() .invokeLater(new Runnable() { @Override public void run() { ShowSettingsUtil.getInstance().showSettingsDialog(project, "Project Interpreter"); } }); } } }); balloonBuilder.setHideOnLinkClick(true); final Balloon balloon = balloonBuilder.createBalloon(); StudyUtils.showCheckPopUp(project, balloon); }
/** * 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(TimeUnit.SECONDS.toMillis(1)); 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); }
private static void showWrongJavaVersionBaloon() { // Just a copy paste from ChangesViewBaloonProblemNotifier final JFrame frame = WindowManager.getInstance().findVisibleFrame(); final JComponent component = frame.getRootPane(); if (component == null) { return; } final Rectangle rect = component.getVisibleRect(); final Point p = new Point(rect.x + 30, rect.y + rect.height - 10); final RelativePoint point = new RelativePoint(component, p); final MessageType messageType = MessageType.ERROR; final BalloonBuilder builder = JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(IdeBundle.message("use.sun.jdk.prompt"), messageType.getDefaultIcon(), messageType.getPopupBackground(), null); builder.setFadeoutTime(-1); builder.createBalloon().show(point, Balloon.Position.above); }
private void showBalloon(FindResult cursor, Editor editor, String replacementPreviewText) { if (ApplicationManager.getApplication().isUnitTestMode()) { myReplacementPreviewText = replacementPreviewText; return; } ReplacementView replacementView = new ReplacementView(replacementPreviewText, cursor); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(replacementView); balloonBuilder.setFadeoutTime(0); balloonBuilder.setFillColor(IdeTooltipManager.GRAPHITE_COLOR); balloonBuilder.setAnimationCycle(0); balloonBuilder.setHideOnClickOutside(false); balloonBuilder.setHideOnKeyOutside(false); balloonBuilder.setHideOnAction(false); balloonBuilder.setCloseButtonEnabled(true); myReplacementBalloon = balloonBuilder.createBalloon(); myReplacementBalloon.show(new ReplacementBalloonPositionTracker(editor), Balloon.Position.above); }
public static void showBalloon(@NotNull final Project project, @NotNull final String message, @NotNull final MessageType messageType) { final JFrame frame = WindowManager.getInstance().getFrame(project.isDefault() ? null : project); if (frame == null) return; final JComponent component = frame.getRootPane(); if (component == null) return; final Rectangle rect = component.getVisibleRect(); final Point p = new Point(rect.x + rect.width - 10, rect.y + 10); final RelativePoint point = new RelativePoint(component, p); final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance(). createHtmlTextBalloonBuilder(message, messageType.getDefaultIcon(), messageType.getPopupBackground(), null); balloonBuilder.setShowCallout(false).setCloseButtonEnabled(true) .createBalloon().show(point, Balloon.Position.atLeft); }
/** * 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(@Nonnull JComponent component, @Nonnull MessageType messageType, @Nonnull 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); }
private void showBalloon(Editor editor, String replacementPreviewText) { if (ApplicationManager.getApplication().isUnitTestMode()) { myReplacementPreviewText = replacementPreviewText; return; } ReplacementView replacementView = new ReplacementView(replacementPreviewText); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(replacementView); balloonBuilder.setFadeoutTime(0); balloonBuilder.setFillColor(IdeTooltipManager.GRAPHITE_COLOR); balloonBuilder.setAnimationCycle(0); balloonBuilder.setHideOnClickOutside(false); balloonBuilder.setHideOnKeyOutside(false); balloonBuilder.setHideOnAction(false); balloonBuilder.setCloseButtonEnabled(true); myReplacementBalloon = balloonBuilder.createBalloon(); myReplacementBalloon.show(new ReplacementBalloonPositionTracker(editor), Balloon.Position.above); }
private void onChangeResolved(@NotNull TextMergeChange change) { if (change.isResolved()) { onChangeRemoved(change); } else { onChangeAdded(change); } if (getChangesCount() == 0 && getConflictsCount() == 0) { LOG.assertTrue(getFirstUnresolvedChange(true, null) == null); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { String message = "All changes have been processed.<br><a href=\"\">Save changes and finish merging</a>"; HyperlinkListener listener = new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { destroyChangedBlocks(); myMergeContext.finishMerge(MergeResult.RESOLVED); } }; JComponent component = getEditor(ThreeSide.BASE).getComponent(); Point point = new Point(component.getWidth() / 2, JBUI.scale(5)); Color bgColor = MessageType.INFO.getPopupBackground(); BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, null, bgColor, listener) .setAnimationCycle(200); Balloon balloon = balloonBuilder.createBalloon(); balloon.show(new RelativePoint(component, point), Balloon.Position.below); Disposer.register(MyThreesideViewer.this, balloon); } }); } }
public void show(RelativePoint point, Balloon.Position position) { 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); }
@NotNull @Override public BalloonBuilder setClickHandler(ActionListener listener, boolean closeOnClick) { myClickHandler = listener; myCloseOnClick = closeOnClick; return this; }
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); }
private static void showStatus(final Component component, final String message, MessageType messageType) { BalloonBuilder balloonBuilder = JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(message, messageType.getDefaultIcon(), messageType.getPopupBackground(), null); balloonBuilder.setFadeoutTime(5000); final Balloon balloon = balloonBuilder.createBalloon(); final Rectangle rect = component.getBounds(); final Point p = new Point(rect.x, rect.y + rect.height); final RelativePoint point = new RelativePoint(component, p); balloon.show(point, Balloon.Position.below); Disposer.register(ProjectManager.getInstance().getDefaultProject(), balloon); }
private static void showWarning(@NotNull final IpnbFileEditor fileEditor, @NotNull final String message, @Nullable final HyperlinkAdapter listener) { BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder( message, null, MessageType.WARNING.getPopupBackground(), listener); final Balloon balloon = balloonBuilder.createBalloon(); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { balloon.showInCenterOf(fileEditor.getRunCellButton()); } }); }
public static void showPopup(@Nonnull final String text, @Nonnull final MessageType type) { SwingUtils.safeSwing(new Runnable() { @Override public void run() { final JBPopupFactory factory = JBPopupFactory.getInstance(); final BalloonBuilder builder = factory.createHtmlTextBalloonBuilder(StringEscapeUtils.escapeHtml(text), type, null); final Balloon balloon = builder.createBalloon(); balloon.setAnimationEnabled(true); final Component frame = WindowManager.getInstance().findVisibleFrame(); if (frame != null) balloon.show(new RelativePoint(frame, new Point(frame.getWidth(), frame.getHeight())), Balloon.Position.below); } }); }
private void showErrorBallon(Editor editor, String message) { BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder("hello", MessageType.ERROR, null); Balloon balloon = builder.createBalloon(); balloon.setTitle(message); CaretModel caretModel = editor.getCaretModel(); Point point = editor.visualPositionToXY(caretModel.getVisualPosition()); RelativePoint where = new RelativePoint(point); balloon.show(where, Balloon.Position.below); }
private void showBalloon(AnActionEvent e, String html) { final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE); if(editor == null) return; final JBPopupFactory factory = JBPopupFactory.getInstance(); final BalloonBuilder builder = factory.createBalloonBuilder(new JLabel(html)); Balloon balloon = builder.createBalloon(); RelativePoint position = factory.guessBestPopupLocation(editor); balloon.show(position, Balloon.Position.below); }
protected void showBalloon() { final JComponent component = getComponent(); if (component == null) return; if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true); myBalloon = balloonBuilder.createBalloon(); Disposer.register(myProject, myBalloon); Disposer.register(myBalloon, new Disposable() { @Override public void dispose() { releaseIfNotRestart(); } }); final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(myEditor); topLevelEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); myBalloon.show(new PositionTracker<Balloon>(topLevelEditor.getContentComponent()) { @Override public RelativePoint recalculateLocation(Balloon object) { if (myTarget != null && !popupFactory.isBestPopupLocationVisible(topLevelEditor)) { return myTarget; } final RelativePoint target = popupFactory.guessBestPopupLocation(topLevelEditor); if (target == null) return myTarget; final Point screenPoint = target.getScreenPoint(); int y = screenPoint.y; if (target.getPoint().getY() > topLevelEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) { y -= topLevelEditor.getLineHeight(); } myTarget = new RelativePoint(new Point(screenPoint.x, y)); return myTarget; } }, Balloon.Position.above); }
public void show(RelativePoint point, Balloon.Position position) { final GotItPanel panel = new GotItPanel(); panel.myTitle.setText(myTitle); panel.myMessage.setText(myMessage); panel.myButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(panel.myRoot); if (myDisposable != null) { builder.setDisposable(myDisposable); } builder.setFillColor(UIUtil.getListBackground()); builder.setHideOnClickOutside(false); builder.setHideOnAction(false); builder.setHideOnFrameResize(false); builder.setHideOnKeyOutside(false); builder.setShowCallout(myShowCallout); builder.setBlockClicksThroughBalloon(true); final Balloon balloon = builder.createBalloon(); panel.myButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { balloon.hide(); if (myCallback != null) { myCallback.run(); } } }); balloon.show(point, position); }
@Nonnull @Override public BalloonBuilder setClickHandler(ActionListener listener, boolean closeOnClick) { myClickHandler = listener; myCloseOnClick = closeOnClick; return this; }
protected void showBalloon() { final JComponent component = getComponent(); if (component == null) return; if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true); myBalloon = balloonBuilder.createBalloon(); final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(myEditor); Disposer.register(myProject, myBalloon); Disposer.register(myBalloon, new Disposable() { @Override public void dispose() { releaseIfNotRestart(); topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null); } }); topLevelEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); myBalloon.show(new PositionTracker<Balloon>(topLevelEditor.getContentComponent()) { @Override public RelativePoint recalculateLocation(Balloon object) { if (myTarget != null && !popupFactory.isBestPopupLocationVisible(topLevelEditor)) { return myTarget; } if (myCaretRangeMarker != null && myCaretRangeMarker.isValid()) { topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, topLevelEditor.offsetToVisualPosition(myCaretRangeMarker.getStartOffset())); } final RelativePoint target = popupFactory.guessBestPopupLocation(topLevelEditor); final Point screenPoint = target.getScreenPoint(); int y = screenPoint.y; if (target.getPoint().getY() > topLevelEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) { y -= topLevelEditor.getLineHeight(); } myTarget = new RelativePoint(new Point(screenPoint.x, y)); return myTarget; } }, Balloon.Position.above); }
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; }); }
/** * @param event ActionSystem event */ public void actionPerformed(AnActionEvent event) { String[] sweepPaths = {}; String sweepPathsPrefString = SweepPreferences.getPaths(); if (sweepPathsPrefString != null && ! sweepPathsPrefString.isEmpty()) { sweepPaths = StringHelper.extractTreePathStringsFromPref(sweepPathsPrefString); } if (sweepPaths == null || sweepPaths.length == 0) { JOptionPane.showMessageDialog(null, "Please configure path(s) to be swept in the plugin preferences."); } else { Integer[] amountDeleted = this.sweepFoldersContent(sweepPaths); Balloon.Position pos = Balloon.Position.below; String balloonText = "Deleted " + amountDeleted[1] + " files / " + amountDeleted[0] + " directories"; JBColor backgroundColor = new JBColor(new Color(245, 245, 245), new Color(60, 63, 65)); BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(balloonText, null, backgroundColor, null); Balloon balloon = builder.createBalloon(); balloon.setAnimationEnabled(true); Component eventComponent = event.getInputEvent().getComponent(); Point componentLocation = eventComponent.getLocation(); Integer x= new Double(componentLocation.getX()).intValue() + eventComponent.getWidth() + 40; Integer y= new Double(componentLocation.getY()).intValue() + eventComponent.getHeight() + 42; RelativePoint balloonPosition = new RelativePoint(new Point(x, y)); balloon.show(balloonPosition, pos); VirtualFileManager.getInstance().asyncRefresh(null); } }
public static void showTestResultPopUp(@NotNull 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); }
@NotNull @Override public BalloonBuilder setHideOnAction(boolean hideOnAction) { myHideOnAction = hideOnAction; return this; }
@NotNull @Override public BalloonBuilder setDialogMode(boolean dialogMode) { myDialogMode = dialogMode; return this; }
@NotNull @Override public BalloonBuilder setBorderColor(@NotNull final Color color) { myBorder = color; return this; }
@NotNull @Override public BalloonBuilder setBorderInsets(@Nullable Insets insets) { myBorderInsets = insets; return this; }
@NotNull @Override public BalloonBuilder setFillColor(@NotNull final Color color) { myFill = color; return this; }
@NotNull @Override public BalloonBuilder setHideOnClickOutside(final boolean hide) { myHideOnMouseOutside = hide; return this; }
@NotNull @Override public BalloonBuilder setHideOnKeyOutside(final boolean hide) { myHideOnKeyOutside = hide; return this; }
@NotNull @Override public BalloonBuilder setShowCallout(final boolean show) { myShowCallout = show; return this; }