void (Task task) { OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task); try { dialog.createTask(); } finally { dialog.close(DialogWrapper.OK_EXIT_CODE); } UIUtil.dispatchAllInvocationEvents(); }