void (Project project) { DumbService.getInstance(project).smartInvokeLater(() -> myAlarm.addRequest(() -> { if (DumbService.isDumb(project)) { runScriptAfterDumb(project); } else { ProfilersController.getInstance(); if (Profiler.isAnyProfilingStarted()) { try { ProfilersController.getInstance().getCurrentProfilerHandler().stopProfiling(new ArrayList<>()); ProfilersController.getInstance().setStoppedByScript(true); } catch (Exception e) { new ActionCallbackProfilerStopper().setRejected(); } ApplicationManager.getApplication().invokeLater(() -> new FinishScriptDialog(project).show()); } } }, TIMEOUT)); }