void (ProgressIndicator indicator) { indicator.setIndeterminate(true); //noinspection DialogTitleCapitalization indicator.setText("In Event Dispatch thread"); for (int i = 0; i < 1000; i++) { TimeoutUtil.sleep(5); ApplicationManager.getApplication().assertWriteAccessAllowed(); indicator.checkCanceled(); } }