void (@NotNull DiffViewerBase viewer, @NotNull Notification notification) { JComponent component = viewer.getComponent(); Window window = ComponentUtil.getWindow(component); if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) { notification.notify(viewer.getProject()); return; } Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true, BalloonLayoutData.fullContent(), 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); }