Promise<Object> (@NotNull PlaybackContext context) { ActionCallback actionCallback = new ActionCallbackProfilerStopper(); ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(() -> { @NotNull Project project = context.getProject(); FileEditor fileEditor = FileEditorManager.getInstance(project).getSelectedEditor(); if (fileEditor != null) { Span span = PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME).startSpan(); try (Scope ignored = span.makeCurrent()) { final FileStructurePopup popup = createPopup(project, fileEditor); if (popup != null) { Span spanShow = PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME + "#Show").startSpan(); Span spanFill = PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME + "#Fill").startSpan(); popup.showWithResult().onProcessed(path -> { actionCallback.setDone(); spanFill.end(); span.end(); }); spanShow.end(); } else { span.setStatus(StatusCode.ERROR, "File structure popup is null"); actionCallback.reject("File structure popup is null"); } } } else { actionCallback.reject("File editor is null"); } })); return Promises.toPromise(actionCallback); }