@Nullable
  private static PsiElement getPsiElement(DataContext dataContext, Project project, @Nullable Editor editor) {
    PsiElement psiElement;
    if (editor == null) {
      psiElement = dataContext.getData(CommonDataKeys.PSI_ELEMENT);
    }
    else {
      final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
      final Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file);
      psiElement = findElementInFile(PsiUtilBase.getPsiFileInEditor(injectedEditor, project), injectedEditor);

      if (file != null && psiElement == null) {
        psiElement = findElementInFile(file, editor);
      }
    }

    return psiElement;
  }
@Nullable
  private static PsiElement getPsiElement(DataContext dataContext, Project project, @Nullable Editor editor)