void () { boolean shouldPaintBusyIcon = myBusy && shouldShowBusyIconIfNeeded(); if (shouldPaintBusyIcon) { if (myBusyIcon == null) { myBusyIcon = new AsyncProcessIcon(toString()); myBusyIcon.setOpaque(false); myBusyIcon.setPaintPassiveIcon(false); myBusyIcon.setToolTipText(IdeBundle.message("tooltip.text.update.is.in.progress.click.to.cancel")); add(myBusyIcon); myBusyIcon.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (!UIUtil.isActionClick(e)) return; AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(Tree.this); if (builder != null) { builder.cancelUpdate(); } } }); } myBusyIcon.resume(); myBusyIcon.setVisible(true); updateBusyIconLocation(); } if (!shouldPaintBusyIcon && myBusyIcon != null) { myBusyIcon.suspend(); myBusyIcon.setVisible(false); SwingUtilities.invokeLater(() -> { if (myBusyIcon != null) { repaint(); } }); } }