Hint
Hi,
I was wondering if I could get a hint on how to use com.intellij.ui.Hint? ;)
Ciao,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001
Please sign in to leave a comment.
You may.
final Object tooltipObject = rangehighlighter.getErrorStripeTooltip();
if (tooltipObject != null) {
final Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getPoint(),
editor.getComponent().getRootPane().getLayeredPane());
JLabel jLabel = new JLabel(tooltipObject.toString());
p.x -= jLabel.getPreferredSize().width + 20;
jLabel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(Color.black),
BorderFactory.createEmptyBorder(0, 5, 0, 5)));
jLabel.setForeground(Color.black);
jLabel.setBackground(new Color(255, 255, 240));
jLabel.setOpaque(true);
hint = new LightweightHint(jLabel);
hint.show(editor.getComponent().getRootPane().getLayeredPane(), p.x, p.y);
}
TIA,
Dmitry
Hmm... okay, I'm using a JTooltip instead of a JLabel merely because it
has the correct colours and border (is there an IDEA component that I
should be using instead?) but the problem I'm seeing is that the hint
never goes away (Escape does nothing). I suppose I need to do that
myself but I'm wondering what would be the best way to do that without
interfering with normal keyboard operation.
Is there a utility class in IDEA that will calculate the correct
location for a tooltip to appear next to a particular PsiElement?
What's the purpose of the HintListener?
Perhaps I should explain what I'm trying to do: I'm trying to create
something like the Parameter Info tooltip for showing i18n message text
from a resource bundle next to the log statement using that resource. It
would be really nice if I could also do argument highlighting like
Parameter Info.
Thanks,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001