@Override
  @Nullable
  public PsiJavaDocumentedElement getContainer(final PsiElement context) {
    if (context == null || !BaseIntentionAction.canModify(context)) {
      return null;
    }
    final PsiFile containingFile = context.getContainingFile();
    if (containingFile == null) {
      // for PsiDirectory
      return null;
    }
    if (!containingFile.getLanguage().isKindOf(JavaLanguage.INSTANCE) || context instanceof PsiFile) {
      return null;
    }
    PsiElement container = context;
    while (container instanceof PsiAnonymousClass || !(container instanceof PsiJavaDocumentedElement) || container instanceof PsiTypeParameter) {
      container = PsiTreeUtil.getParentOfType(container, PsiJavaDocumentedElement.class);
      if (container == null) return null;
    }
    return container instanceof SyntheticElement || container instanceof PsiImplicitClass ? null : (PsiJavaDocumentedElement)container;
  }
@Override
  @Nullable
  public PsiJavaDocumentedElement getContainer(final PsiElement context)