Java Code Examples for com.intellij.openapi.ui.popup.Balloon#show()
The following examples show how to use
com.intellij.openapi.ui.popup.Balloon#show() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Display a popup containing the property editing panel for the specified widget. */ public static Balloon showPopup( InspectorGroupManagerService inspectorGroupManagerService, EditorEx editor, DiagnosticsNode node, @NotNull InspectorService.Location location, FlutterDartAnalysisServer service, Point point ) { final Balloon balloon = showPopupHelper(inspectorGroupManagerService, editor.getProject(), node, location, service); if (point != null) { balloon.show(new PropertyBalloonPositionTrackerScreenshot(editor, point), Balloon.Position.below); } else { final int offset = location.getOffset(); final TextRange textRange = new TextRange(offset, offset + 1); balloon.show(new PropertyBalloonPositionTracker(editor, textRange), Balloon.Position.below); } return balloon; }
Example 2
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Display a popup containing the property editing panel for the specified widget. */ public static Balloon showPopup( InspectorGroupManagerService inspectorGroupManagerService, EditorEx editor, DiagnosticsNode node, @NotNull InspectorService.Location location, FlutterDartAnalysisServer service, Point point ) { final Balloon balloon = showPopupHelper(inspectorGroupManagerService, editor.getProject(), node, location, service); if (point != null) { balloon.show(new PropertyBalloonPositionTrackerScreenshot(editor, point), Balloon.Position.below); } else { final int offset = location.getOffset(); final TextRange textRange = new TextRange(offset, offset + 1); balloon.show(new PropertyBalloonPositionTracker(editor, textRange), Balloon.Position.below); } return balloon; }
Example 3
Source File: DiffUtil.java From consulo with Apache License 2.0 | 6 votes |
public static void showSuccessPopup(@Nonnull String message, @Nonnull RelativePoint point, @Nonnull Disposable disposable, @Nullable Runnable hyperlinkHandler) { HyperlinkListener listener = null; if (hyperlinkHandler != null) { listener = new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { hyperlinkHandler.run(); } }; } Color bgColor = MessageType.INFO.getPopupBackground(); Balloon balloon = JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(message, null, bgColor, listener) .setAnimationCycle(200) .createBalloon(); balloon.show(point, Balloon.Position.below); Disposer.register(disposable, balloon); }
Example 4
Source File: ExternalSystemUiUtil.java From consulo with Apache License 2.0 | 6 votes |
/** * 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); }
Example 5
Source File: MessageUtils.java From leetcode-editor with Apache License 2.0 | 5 votes |
public static void showMsg(JComponent component, MessageType messageType, String title, String body) { JBPopupFactory factory = JBPopupFactory.getInstance(); BalloonBuilder builder = factory.createHtmlTextBalloonBuilder(body, messageType, null); builder.setTitle(title); builder.setFillColor(JBColor.background()); Balloon b = builder.createBalloon(); Rectangle r = component.getBounds(); RelativePoint p = new RelativePoint(component, new Point(r.x + r.width, r.y + 30)); b.show(p, Balloon.Position.atRight); }
Example 6
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static Balloon showPopup( InspectorGroupManagerService inspectorGroupManagerService, Project project, Component component, @Nullable DiagnosticsNode node, @NonNls InspectorService.Location location, FlutterDartAnalysisServer service, Point point ) { final Balloon balloon = showPopupHelper(inspectorGroupManagerService, project, node, location, service); balloon.show(new RelativePoint(component, point), Balloon.Position.above); return balloon; }
Example 7
Source File: PropertyEditorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static Balloon showPopup( InspectorGroupManagerService inspectorGroupManagerService, Project project, Component component, @Nullable DiagnosticsNode node, @NonNls InspectorService.Location location, FlutterDartAnalysisServer service, Point point ) { final Balloon balloon = showPopupHelper(inspectorGroupManagerService, project, node, location, service); balloon.show(new RelativePoint(component, point), Balloon.Position.above); return balloon; }
Example 8
Source File: GLSLDeduceExpressionTypeAction.java From glsl4idea with GNU Lesser General Public License v3.0 | 5 votes |
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); }
Example 9
Source File: DirDiffTableModel.java From consulo with Apache License 2.0 | 5 votes |
private void reportException(final String htmlContent) { Runnable balloonShower = () -> { Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(htmlContent, MessageType.WARNING, null). setShowCallout(false).setHideOnClickOutside(true).setHideOnAction(true).setHideOnFrameResize(true).setHideOnKeyOutside(true). createBalloon(); final Rectangle rect = myPanel.getPanel().getBounds(); final Point p = new Point(rect.x + rect.width - 100, rect.y + 50); final RelativePoint point = new RelativePoint(myPanel.getPanel(), p); balloon.show(point, Balloon.Position.below); Disposer.register(myProject != null ? myProject : ApplicationManager.getApplication(), balloon); }; ApplicationManager.getApplication().invokeLater(balloonShower, o -> !(myProject == null || myProject.isDefault()) && ((!myProject.isOpen()) || myProject.isDisposed()) ); }
Example 10
Source File: UsagePreviewPanel.java From consulo with Apache License 2.0 | 5 votes |
private static void showBalloon(Project project, Editor editor, TextRange range, @Nonnull FindModel findModel) { try { String replacementPreviewText = FindManager.getInstance(project).getStringToReplace(editor.getDocument().getText(range), findModel, range.getStartOffset(), editor.getDocument().getText()); if (!Registry.is("ide.find.show.replacement.hint.for.simple.regexp") && (Comparing.equal(replacementPreviewText, findModel.getStringToReplace()))) { 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); Balloon balloon = balloonBuilder.createBalloon(); EditorUtil.disposeWithEditor(editor, balloon); balloon.show(new ReplacementBalloonPositionTracker(project, editor, range, findModel), Balloon.Position.below); editor.putUserData(REPLACEMENT_BALLOON_KEY, balloon); } catch (FindManager.MalformedReplacementStringException e) { //Not a problem, just don't show balloon in this case } }
Example 11
Source File: GotItMessage.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example 12
Source File: AnnotateDiffViewerAction.java From consulo with Apache License 2.0 | 5 votes |
private static void showNotification(@Nonnull DiffViewerBase viewer, @Nonnull Notification notification) { JComponent component = viewer.getComponent(); Window awtWindow = UIUtil.getWindow(component); if (awtWindow != null) { consulo.ui.Window uiWindow = TargetAWT.from(awtWindow); IdeFrame ideFrame = uiWindow.getUserData(IdeFrame.KEY); if (ideFrame != null && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == awtWindow) { notification.notify(viewer.getProject()); return; } } Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true, null, viewer); Dimension componentSize = component.getSize(); Dimension balloonSize = balloon.getPreferredSize(); int width = Math.min(balloonSize.width, componentSize.width); int height = Math.min(balloonSize.height, componentSize.height); // top-right corner, 20px to the edges RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2)); balloon.show(point, Balloon.Position.above); }
Example 13
Source File: GeneralCodeStylePanel.java From consulo with Apache License 2.0 | 5 votes |
private static void showError(final JTextField field, final String message) { BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR, 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); }
Example 14
Source File: ManageCodeStyleSchemesDialog.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example 15
Source File: GotoCustomRegionAction.java From consulo with Apache License 2.0 | 5 votes |
private static void notifyCustomRegionsUnavailable(@Nonnull Editor editor, @Nonnull 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); }
Example 16
Source File: DesktopBalloonLayoutImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void add(@Nonnull final Balloon balloon, @Nullable Object layoutData) { ApplicationManager.getApplication().assertIsDispatchThread(); Balloon merge = merge(layoutData); if (merge == null) { if (!myBalloons.isEmpty() && myBalloons.size() == getVisibleCount()) { remove(myBalloons.get(0)); } myBalloons.add(balloon); } else { int index = myBalloons.indexOf(merge); remove(merge); myBalloons.add(index, balloon); } if (layoutData instanceof BalloonLayoutData) { BalloonLayoutData balloonLayoutData = (BalloonLayoutData)layoutData; balloonLayoutData.closeAll = myCloseAll; balloonLayoutData.doLayout = myLayoutRunnable; myLayoutData.put(balloon, balloonLayoutData); } Disposer.register(balloon, new Disposable() { public void dispose() { clearNMore(balloon); remove(balloon, false); queueRelayout(); } }); if (myLafListener == null && layoutData != null) { myLafListener = new LafManagerListener() { @Override public void lookAndFeelChanged(LafManager source) { for (BalloonLayoutData layoutData : myLayoutData.values()) { if (layoutData.lafHandler != null) { layoutData.lafHandler.run(); } } } }; LafManager.getInstance().addLafManagerListener(myLafListener); } calculateSize(); relayout(); if (!balloon.isDisposed()) { balloon.show(myLayeredPane); } fireRelayout(); }