@Override
  public boolean isValid() {
    PsiElement parent = getParent();
    while (parent != null && parent.getClass() == this.getClass()) {
      parent = parent.getParent();
    }
    return parent != null && parent.isValid();
  }
@Override
  public boolean isValid()