InputPanel.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:intellij-plugin-v4 作者:
public void highlightAndOfferHint(Editor editor, int offset,
                                  Interval sourceInterval,
                                  JBColor color,
                                  EffectType effectType, String hintText) {
    CaretModel caretModel = editor.getCaretModel();
    final TextAttributes attr = new TextAttributes();
    attr.setForegroundColor(color);
    attr.setEffectColor(color);
    attr.setEffectType(effectType);
    MarkupModel markupModel = editor.getMarkupModel();
    markupModel.addRangeHighlighter(
        sourceInterval.a,
        sourceInterval.b,
        InputPanel.TOKEN_INFO_LAYER, // layer
        attr,
        HighlighterTargetArea.EXACT_RANGE
                                   );

    if ( hintText.contains("<") ) {
        hintText = hintText.replaceAll("<", "&lt;");
    }

    // HINT
    caretModel.moveToOffset(offset); // info tooltip only shows at cursor :(
    HintManager.getInstance().showInformationHint(editor, hintText);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号