@Override
  public PsiElement add(@NotNull PsiElement element) throws IncorrectOperationException {
    if (element instanceof PsiClass) {
      String name = ((PsiClass)element).getName();
      if (name != null) {
        PsiClass newClass = JavaDirectoryService.getInstance().createClass(this, name);
        return newClass.replace(element);
      }
      else {
        LOG.error("not implemented");
        return null;
      }
    }
    else {
      return super.add(element);
    }
  }
@Override
  public PsiElement add(@NotNull PsiElement element)