void (@NotNull AnActionEvent e) { ProgressWindow p = new ProgressWindow(true, new Random().nextBoolean(), e.getProject()); p.setTitle("Title"); p.setIndeterminate(false); p.setDelayInMillis(0); ApplicationManager.getApplication().executeOnPooledThread(() -> { try { p.start(); p.setText("Starting..."); for (double d = 0; d < 1; d += 1.0 / 80) { p.setFraction(d); Thread.sleep(100); p.checkCanceled(); p.setText2("Z: " + d); } } catch (InterruptedException ignore) { } finally { p.stop(); p.processFinish(); } }); }