RunProfileState (@NotNull final RunContentDescriptor descriptor) { final ExecutionEnvironment action = findRestartAction(descriptor); if (action == null) { return null; } final Ref<RunProfileState> stateRef = new Ref<>(); ApplicationManager.getApplication().invokeAndWait(() -> { try { stateRef.set(action.getState()); } catch (final ExecutionException e) { throw new IllegalStateException("Error obtaining execution state", e); } }, ModalityState.nonModal()); return stateRef.get(); }