Exemple #1
0
 public void showHint(LightweightHint hint) {
   final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
   Point p = HintManagerImpl.getHintPosition(hint, myEditor, myPosition, HintManager.ABOVE);
   hintManager.showEditorHint(
       hint,
       myEditor,
       p,
       HintManager.HIDE_BY_ANY_KEY
           | HintManager.HIDE_BY_TEXT_CHANGE
           | HintManager.HIDE_BY_SCROLLING,
       0,
       false,
       HintManagerImpl.createHintHint(myEditor, p, hint, HintManager.ABOVE)
           .setContentActive(false));
 }
    private void showHint(Info info) {
      if (myDisposed) return;
      Component internalComponent = myEditor.getContentComponent();
      if (myHighlighter != null) {
        if (!info.isSimilarTo(myHighlighter.getStoredInfo())) {
          disposeHighlighter();
        } else {
          // highlighter already set
          internalComponent.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          return;
        }
      }

      if (info.isValid(myEditor.getDocument())) {
        myHighlighter = installHighlighterSet(info, myEditor);

        String text = info.getInfo();

        if (text == null) return;

        JComponent label = HintUtil.createInformationLabel(text);
        final LightweightHint hint = new LightweightHint(label);
        final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
        Point p = HintManagerImpl.getHintPosition(hint, myEditor, myPosition, HintManager.ABOVE);
        hintManager.showEditorHint(
            hint,
            myEditor,
            p,
            HintManager.HIDE_BY_ANY_KEY
                | HintManager.HIDE_BY_TEXT_CHANGE
                | HintManager.HIDE_BY_SCROLLING,
            0,
            false,
            HintManagerImpl.createHintHint(myEditor, p, hint, HintManager.ABOVE)
                .setContentActive(false));
      }
    }