void (final @NotNull AnActionEvent e) { if (myLagging) { myLagging = false; myAlarm.cancelAllRequests(); } else { myLagging = true; for (int i = 0; i < 100; i++) { new Runnable() { @Override public void run() { DebugUtil.sleep(5); ProgressManager.getInstance().runProcessWithProgressAsynchronously(new Task.Backgroundable(null, "lagging") { @Override public void run(@NotNull ProgressIndicator indicator) { DebugUtil.sleep(1); } }, new EmptyProgressIndicator()); if (myLagging) { myAlarm.addRequest(this, 1); } } }.run(); } } }