private static String getNameForElement(@NotNull PsiElement element, boolean qualified, boolean ignorePsiClassOwner) {
    if (element instanceof PsiClass){
      return getNameForClass((PsiClass)element, qualified);
    }
    else if (element instanceof PsiMethod){
      PsiMethod method = (PsiMethod)element;
      String methodName = method.getName();
      return JavaPsiBundle.message("method.context.display", methodName, getContextName(method, qualified, false));
    }
    else if (element instanceof PsiClassOwner && ignorePsiClassOwner) {
      return null;
    }
    else if (element instanceof PsiFile){
      return ((PsiFile)element).getName();
    }
    else if (element instanceof PsiField) {
      return ((PsiField)element).getName() + " in " + getContextName(element, qualified, false);
    }
    else{
      return null;
    }
  }
private static String getNameForElement(@NotNull PsiElement element, boolean qualified, boolean ignorePsiClassOwner)