delay actions update

This commit is contained in:
Dennis Ushakov
2018-11-22 12:10:56 +03:00
parent fead9d671b
commit c5baff9917
@@ -99,11 +99,6 @@ public class ContextMenuImpl extends JPanel implements Disposable {
}
private void toggleContextToolbar(final boolean show) {
myActionToolbar.updateActionsImmediately();
if (((Container)myActionToolbar).getComponentCount() == 0) {
return;
}
if (myShow != show) {
myShow = show;
restartTimer();
@@ -122,6 +117,12 @@ public class ContextMenuImpl extends JPanel implements Disposable {
if (myTimer != null && myTimer.isRunning()) myTimer.stop();
myActionToolbar.updateActionsImmediately();
if (((Container)myActionToolbar).getComponentCount() == 0) {
myShow = false;
return;
}
myTimer = UIUtil.createNamedTimer("Restart context menu now", 50, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -146,8 +147,6 @@ public class ContextMenuImpl extends JPanel implements Disposable {
scheduleHide();
}
repaint();
}
else {
if (!myVisible) {
@@ -162,9 +161,8 @@ public class ContextMenuImpl extends JPanel implements Disposable {
myLayeredPane.remove(ContextMenuImpl.this);
myLayeredPane.repaint();
}
repaint();
}
repaint();
}
});