Java 类com.intellij.util.xml.DomElementVisitor 实例源码

项目:intellij-ce-playground    文件:VisitorDescription.java   
public VisitorDescription(final Class<? extends DomElementVisitor> visitorClass) {
  myVisitorClass = visitorClass;
  for (final Method method : ReflectionUtil.getClassPublicMethods(visitorClass)) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes.length != 1) {
      continue;
    }
    final Class<?> domClass = parameterTypes[0];
    if (!ReflectionUtil.isAssignable(DomElement.class, domClass)) {
      continue;
    }
    final String methodName = method.getName();
    if (VISIT.equals(methodName) || methodName.startsWith(VISIT) /*&& domClass.getSimpleName().equals(methodName.substring(VISIT.length()))*/) {
      method.setAccessible(true);
      myMethods.put(domClass, method);
    }
  }
}
项目:tools-idea    文件:DomElementsProblemsHolderImpl.java   
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
  if (map != null) {
    return map;
  }

  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
  if (domElement == myElement) {
    for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
      mergeMaps(problems, listMap);
    }
  } else {
    mergeMaps(problems, myCachedErrors.get(domElement));
    if (DomUtil.hasXml(domElement)) {
      domElement.acceptChildren(new DomElementVisitor() {
        public void visitDomElement(DomElement element) {
          mergeMaps(problems, getProblemsMap(element));
        }
      });
    }
  }

  myCachedChildrenErrors.put(domElement, problems);
  return problems;
}
项目:tools-idea    文件:VisitorDescription.java   
public VisitorDescription(final Class<? extends DomElementVisitor> visitorClass) {
  myVisitorClass = visitorClass;
  for (final Method method : ReflectionCache.getMethods(visitorClass)) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes.length != 1) {
      continue;
    }
    final Class<?> domClass = parameterTypes[0];
    if (!ReflectionCache.isAssignable(DomElement.class, domClass)) {
      continue;
    }
    final String methodName = method.getName();
    if (VISIT.equals(methodName) || methodName.startsWith(VISIT) /*&& domClass.getSimpleName().equals(methodName.substring(VISIT.length()))*/) {
      method.setAccessible(true);
      myMethods.put(domClass, method);
    }
  }
}
项目:consulo-xml    文件:DomElementsProblemsHolderImpl.java   
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
  if (map != null) {
    return map;
  }

  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
  if (domElement == myElement) {
    for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
      mergeMaps(problems, listMap);
    }
  } else {
    mergeMaps(problems, myCachedErrors.get(domElement));
    if (DomUtil.hasXml(domElement)) {
      domElement.acceptChildren(new DomElementVisitor() {
        public void visitDomElement(DomElement element) {
          mergeMaps(problems, getProblemsMap(element));
        }
      });
    }
  }

  myCachedChildrenErrors.put(domElement, problems);
  return problems;
}
项目:consulo-xml    文件:VisitorDescription.java   
public VisitorDescription(final Class<? extends DomElementVisitor> visitorClass) {
  myVisitorClass = visitorClass;
  for (final Method method : ReflectionUtil.getClassPublicMethods(visitorClass)) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes.length != 1) {
      continue;
    }
    final Class<?> domClass = parameterTypes[0];
    if (!ReflectionUtil.isAssignable(DomElement.class, domClass)) {
      continue;
    }
    final String methodName = method.getName();
    if (VISIT.equals(methodName) || methodName.startsWith(VISIT) /*&& domClass.getSimpleName().equals(methodName.substring(VISIT.length()))*/) {
      method.setAccessible(true);
      myMethods.put(domClass, method);
    }
  }
}
项目:intellij-ce-playground    文件:DomElementsProblemsHolderImpl.java   
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
  if (map != null) {
    return map;
  }

  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
  if (domElement == myElement) {
    for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
      mergeMaps(problems, listMap);
    }
  } else {
    mergeMaps(problems, myCachedErrors.get(domElement));
    if (DomUtil.hasXml(domElement)) {
      domElement.acceptChildren(new DomElementVisitor() {
        @Override
        public void visitDomElement(DomElement element) {
          mergeMaps(problems, getProblemsMap(element));
        }
      });
    }
  }

  myCachedChildrenErrors.put(domElement, problems);
  return problems;
}
项目:intellij-ce-playground    文件:DomElementPattern.java   
@Override
protected DomElement[] getChildren(@NotNull final DomElement domElement) {
  final List<DomElement> children = new ArrayList<DomElement>();
  domElement.acceptChildren(new DomElementVisitor() {
    @Override
    public void visitDomElement(final DomElement element) {
      children.add(element);
    }
  });
  return children.toArray(new DomElement[children.size()]);
}
项目:intellij-ce-playground    文件:RngDomElementBase.java   
@Override
public void acceptChildren(final Visitor visitor) {
  acceptChildren(new DomElementVisitor() {
    @Override
    public void visitDomElement(DomElement element) {
      if (element instanceof CommonElement) {
        ((CommonElement)element).accept(visitor);
      }
    }
  });
}
项目:tools-idea    文件:DomElementPattern.java   
protected DomElement[] getChildren(@NotNull final DomElement domElement) {
  final List<DomElement> children = new ArrayList<DomElement>();
  domElement.acceptChildren(new DomElementVisitor() {
    public void visitDomElement(final DomElement element) {
      children.add(element);
    }
  });
  return children.toArray(new DomElement[children.size()]);
}
项目:tools-idea    文件:RngDomElementBase.java   
public void acceptChildren(final Visitor visitor) {
  acceptChildren(new DomElementVisitor() {
    public void visitDomElement(DomElement element) {
      if (element instanceof CommonElement) {
        ((CommonElement)element).accept(visitor);
      }
    }
  });
}
项目:consulo-xml    文件:DomElementPattern.java   
protected DomElement[] getChildren(@NotNull final DomElement domElement) {
  final List<DomElement> children = new ArrayList<DomElement>();
  domElement.acceptChildren(new DomElementVisitor() {
    public void visitDomElement(final DomElement element) {
      children.add(element);
    }
  });
  return children.toArray(new DomElement[children.size()]);
}
项目:consulo-xml    文件:RngDomElementBase.java   
@Override
public void acceptChildren(final Visitor visitor) {
  acceptChildren(new DomElementVisitor() {
    @Override
    public void visitDomElement(DomElement element) {
      if (element instanceof CommonElement) {
        ((CommonElement)element).accept(visitor);
      }
    }
  });
}
项目:intellij-ce-playground    文件:VisitorDescription.java   
public void acceptElement(DomElementVisitor visitor, DomElement element) {
  final Method method = myMethods.get(element.getClass());
  assert method != null : myVisitorClass + " can't accept element of type " + element.getClass();
  DomReflectionUtil.invokeMethod(method, visitor, element);
}
项目:intellij-ce-playground    文件:AttributeChildInvocationHandler.java   
@Override
public void acceptChildren(DomElementVisitor visitor) {
}
项目:intellij-ce-playground    文件:DomApplicationComponent.java   
@Override
@NotNull
protected VisitorDescription create(final Class<? extends DomElementVisitor> key) {
  return new VisitorDescription(key);
}
项目:intellij-ce-playground    文件:DomApplicationComponent.java   
public final VisitorDescription getVisitorDescription(Class<? extends DomElementVisitor> aClass) {
  return myVisitorDescriptions.get(aClass);
}
项目:tools-idea    文件:VisitorDescription.java   
public void acceptElement(DomElementVisitor visitor, DomElement element) {
  final Method method = myMethods.get(element.getClass());
  assert method != null : myVisitorClass + " can't accept element of type " + element.getClass();
  DomReflectionUtil.invokeMethod(method, visitor, element);
}
项目:tools-idea    文件:AttributeChildInvocationHandler.java   
public void acceptChildren(DomElementVisitor visitor) {
}
项目:tools-idea    文件:DomApplicationComponent.java   
@NotNull
protected VisitorDescription create(final Class<? extends DomElementVisitor> key) {
  return new VisitorDescription(key);
}
项目:tools-idea    文件:DomApplicationComponent.java   
public final VisitorDescription getVisitorDescription(Class<? extends DomElementVisitor> aClass) {
  return myVisitorDescriptions.get(aClass);
}
项目:consulo-xml    文件:VisitorDescription.java   
public void acceptElement(DomElementVisitor visitor, DomElement element) {
  final Method method = myMethods.get(element.getClass());
  assert method != null : myVisitorClass + " can't accept element of type " + element.getClass();
  DomReflectionUtil.invokeMethod(method, visitor, element);
}
项目:consulo-xml    文件:AttributeChildInvocationHandler.java   
public void acceptChildren(DomElementVisitor visitor) {
}
项目:consulo-xml    文件:DomApplicationComponent.java   
@NotNull
protected VisitorDescription create(final Class<? extends DomElementVisitor> key)
{
    return new VisitorDescription(key);
}
项目:consulo-xml    文件:DomApplicationComponent.java   
public final VisitorDescription getVisitorDescription(Class<? extends DomElementVisitor> aClass)
{
    return myVisitorDescriptions.get(aClass);
}