void (Editor editor, PsiFile newFile, JComponent component) { Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(component) .setShadow(true) .setAnimationCycle(0) .setHideOnClickOutside(true) .setHideOnKeyOutside(true) .setHideOnAction(false) .setFillColor(UIUtil.getPanelBackground()) .createBalloon(); DumbAwareAction.create(e -> balloon.hide()) .registerCustomShortcutSet(CommonShortcuts.ESCAPE, component); Disposer.register(newFile.getProject(), balloon); Balloon.Position position = QuickEditAction.getBalloonPosition(editor); RelativePoint point = JBPopupFactory.getInstance().guessBestPopupLocation(editor); if (position == Balloon.Position.above) { Point p = point.getPoint(); point = new RelativePoint(point.getComponent(), new Point(p.x, p.y - editor.getLineHeight())); } balloon.show(point, position); }