boolean (final DataContext context, final long executionId) { T tool = findCorrespondingTool(); if (tool != null && !tool.isEnabled()) { return true; } if (tool == null) { return false; } final Semaphore targetDone = new Semaphore(); final Ref<Boolean> result = new Ref<>(false); targetDone.down(); try { ApplicationManager.getApplication().invokeAndWait(() -> ToolAction.runTool(myToolActionId, context, null, executionId, new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { result.set(event.getExitCode() == 0); targetDone.up(); } @Override public void processNotStarted() { result.set(false); targetDone.up(); } }), ModalityState.defaultModalityState()); } catch (Exception e) { LOG.error(e); return false; } targetDone.waitFor(); return result.get(); }