HintHint (Editor editor, Point p, LightweightHint hint, @PositionFlags short constraint, boolean createInEditorComponent) { JRootPane rootPane = editor.getComponent().getRootPane(); if (rootPane == null) { return new HintHint(editor, p); } JLayeredPane lp = rootPane.getLayeredPane(); HintHint hintInfo = new HintHint(editor, SwingUtilities.convertPoint(lp, p, editor.getContentComponent())); boolean showByBalloon = Registry.is("editor.balloonHints"); if (showByBalloon) { if (!createInEditorComponent) { hintInfo = new HintHint(lp, p); } hintInfo.setAwtTooltip(true).setHighlighterType(true); } hintInfo.initStyleFrom(hint.getComponent()); if (showByBalloon) { if (!hintInfo.isBorderColorSet()) { hintInfo.setBorderColor(new JBColor(Color.gray, Gray._140)); } hintInfo.setFont(hintInfo.getTextFont().deriveFont(Font.PLAIN)); hintInfo.setCalloutShift((int)(editor.getLineHeight() * 0.1)); } hintInfo.setPreferredPosition(Balloon.Position.above); if (constraint == UNDER || constraint == RIGHT_UNDER) { hintInfo.setPreferredPosition(Balloon.Position.below); } else if (constraint == RIGHT) { hintInfo.setPreferredPosition(Balloon.Position.atRight); } else if (constraint == LEFT) { hintInfo.setPreferredPosition(Balloon.Position.atLeft); } if (hint.isAwtTooltip()) { hintInfo.setAwtTooltip(true); } hintInfo.setPositionChangeShift(0, editor.getLineHeight()); return hintInfo; }