void (@NotNull DataContext dataContext, boolean requestFocus, boolean onAutoUpdate) { if (CommonDataKeys.PROJECT.getData(dataContext) != myProject) { return; } final Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (editor == null) { PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element != null) { doUpdateComponent(element, onAutoUpdate); } return; } PsiDocumentManager.getInstance(myProject).performLaterWhenAllCommitted(() -> { if (editor.isDisposed()) { return; } PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, myProject); Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file); PsiFile injectedFile = PsiUtilBase.getPsiFileInEditor(injectedEditor, myProject); if (injectedFile != null) { doUpdateComponent(injectedEditor, injectedFile, requestFocus, onAutoUpdate); } else if (file != null) { doUpdateComponent(editor, file, requestFocus, onAutoUpdate); } }); }