private static boolean isAvailable(@NotNull DataContext dataContext) {
    PsiFile file = dataContext.getData(CommonDataKeys.PSI_FILE);
    if (file instanceof PsiCompiledElement) {
      return false;
    }
    Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
    if (editor == null) {
      return isEnabledOnDataContext(dataContext)
             || RenameElementAction.isRenameEnabledOnElements(getPsiElementArray(dataContext));
    }
    else {
      return file != null
             && isEnabledOnDataContext(dataContext)
             && findRefactoringTargetInEditor(dataContext, language -> true) != null;
    }
  }
private static boolean isAvailable(@NotNull DataContext dataContext)