mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-70943 Tooltip animations and buggy visibility are exceedingly frustrating
This commit is contained in:
@@ -197,7 +197,8 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
|
||||
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
|
||||
final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, new Object()) {
|
||||
String aText = String.valueOf(c.getToolTipText(me));
|
||||
final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, /*new Object()*/c, aText) {
|
||||
@Override
|
||||
protected boolean beforeShow() {
|
||||
myCurrentEvent = me;
|
||||
@@ -226,7 +227,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
public IdeTooltip show(final IdeTooltip tooltip, boolean now, final boolean animationEnabled) {
|
||||
myAlarm.cancelAllRequests();
|
||||
|
||||
hideCurrent(null, null, null);
|
||||
hideCurrent(null, tooltip, null, null);
|
||||
|
||||
myQueuedComponent = tooltip.getComponent();
|
||||
myQueuedTooltip = tooltip;
|
||||
@@ -239,7 +240,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
|
||||
if (myQueuedComponent != tooltip.getComponent() || !tooltip.getComponent().isShowing()) {
|
||||
hideCurrent(null, null, null, animationEnabled);
|
||||
hideCurrent(null, tooltip, null, null, animationEnabled);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,7 +248,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
show(tooltip, null, animationEnabled);
|
||||
}
|
||||
else {
|
||||
hideCurrent(null, null, null, animationEnabled);
|
||||
hideCurrent(null, tooltip, null, null, animationEnabled);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -389,11 +390,22 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
return myCurrentTooltip != null;
|
||||
}
|
||||
|
||||
public boolean hideCurrent(@Nullable MouseEvent me, @Nullable AnAction action, @Nullable AnActionEvent event) {
|
||||
return hideCurrent(me, action, event, myCurrentTipUi != null && myCurrentTipUi.isAnimationEnabled());
|
||||
public boolean hideCurrent(@Nullable MouseEvent me) {
|
||||
return hideCurrent(me, null, null, null);
|
||||
}
|
||||
|
||||
public boolean hideCurrent(@Nullable MouseEvent me, @Nullable AnAction action, @Nullable AnActionEvent event, final boolean animationEnabled) {
|
||||
private boolean hideCurrent(@Nullable MouseEvent me, @Nullable AnAction action, @Nullable AnActionEvent event) {
|
||||
return hideCurrent(me, null, action, event, myCurrentTipUi != null && myCurrentTipUi.isAnimationEnabled());
|
||||
}
|
||||
|
||||
private boolean hideCurrent(@Nullable MouseEvent me,
|
||||
@Nullable IdeTooltip tooltipToShow,
|
||||
@Nullable AnAction action,
|
||||
@Nullable AnActionEvent event) {
|
||||
return hideCurrent(me, tooltipToShow, action, event, myCurrentTipUi != null && myCurrentTipUi.isAnimationEnabled());
|
||||
}
|
||||
|
||||
private boolean hideCurrent(@Nullable MouseEvent me, @Nullable IdeTooltip tooltipToShow, @Nullable AnAction action, @Nullable AnActionEvent event, final boolean animationEnabled) {
|
||||
if (myCurrentTooltip != null && me != null && myCurrentTooltip.isInside(RelativePoint.fromScreen(me.getLocationOnScreen()))) {
|
||||
if (me.getButton() == MouseEvent.NOBUTTON || myCurrentTipUi == null || myCurrentTipUi.isBlockClicks()) {
|
||||
return false;
|
||||
@@ -415,8 +427,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
(me.getID() == MouseEvent.MOUSE_MOVED ||
|
||||
me.getID() == MouseEvent.MOUSE_EXITED ||
|
||||
me.getID() == MouseEvent.MOUSE_ENTERED);
|
||||
|
||||
if (!canAutoHide || myCurrentTooltip.isExplicitClose() && implicitMouseMove) {
|
||||
if (!canAutoHide || myCurrentTooltip.isExplicitClose() && implicitMouseMove || Comparing.equal(myCurrentTooltip, tooltipToShow)) {
|
||||
if (myHideRunnable != null) {
|
||||
myHideRunnable = null;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.MenuDragMouseEvent;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.AWTEventListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@@ -146,7 +148,7 @@ public class IdeGlassPaneImpl extends JPanel implements IdeGlassPaneEx, IdeEvent
|
||||
|
||||
if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
|
||||
if (ApplicationManager.getApplication() != null) {
|
||||
IdeTooltipManager.getInstance().hideCurrent((MouseEvent)e, null, null);
|
||||
IdeTooltipManager.getInstance().hideCurrent((MouseEvent)e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user