Hints misbehaviour fix

This commit is contained in:
Vassiliy Kudryashov
2012-03-28 13:31:48 +04:00
parent acf653ddc0
commit d1c64a6ecf
3 changed files with 19 additions and 3 deletions
@@ -50,6 +50,8 @@ public class IdeTooltip extends ComparableObject.Impl {
private Ui myUi;
private boolean hint = false;
public IdeTooltip(Component component, Point point, JComponent tipComponent, Object... identity) {
super(identity);
@@ -232,6 +234,15 @@ public class IdeTooltip extends ComparableObject.Impl {
return myLayer;
}
public IdeTooltip setHint(boolean hint) {
this.hint = hint;
return this;
}
public boolean isHint() {
return hint;
}
public boolean isInside(RelativePoint target) {
return myUi != null && myUi.isInside(target);
}
@@ -143,7 +143,12 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
if (!myCurrentTipIsCentered) {
myX = me.getX();
myY = me.getY();
maybeShowFor(c, me);
if (c instanceof JComponent && ((JComponent)c).getToolTipText(me) == null && (myQueuedTooltip == null || !myQueuedTooltip.isHint())) {
hideCurrent(me, null, null);//There is no tooltip or hint here, let's proceed it as MOUSE_EXITED
}
else {
maybeShowFor(c, me);
}
}
}
}
@@ -166,8 +166,8 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
.setFont(hintHint.getTextFont())
.setCalloutShift(hintHint.getCalloutShift())
.setPositionChangeShift(hintHint.getPositionChangeX(), hintHint.getPositionChangeY())
.setExplicitClose(hintHint.isExplicitClose());
.setExplicitClose(hintHint.isExplicitClose())
.setHint(true);
myComponent.validate();
myCurrentIdeTooltip = IdeTooltipManager.getInstance().show(tooltip, hintHint.isShowImmediately());
} else {