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

项目:intellij-ce-playground    文件:AbstractDomChildrenDescriptor.java   
@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) {
  if (context == null) return XmlAttributeDescriptor.EMPTY;

  DomElement domElement = myManager.getDomElement(context);
  if (domElement == null) return XmlAttributeDescriptor.EMPTY;

  final List<? extends DomAttributeChildDescription> descriptions = domElement.getGenericInfo().getAttributeChildrenDescriptions();
  List<XmlAttributeDescriptor> descriptors = new ArrayList<XmlAttributeDescriptor>();

  for (DomAttributeChildDescription description : descriptions) {
    descriptors.add(new DomAttributeXmlDescriptor(description, myManager.getProject()));
  }
  List<? extends CustomDomChildrenDescription> customs = domElement.getGenericInfo().getCustomNameChildrenDescription();
  for (CustomDomChildrenDescription custom : customs) {
    CustomDomChildrenDescription.AttributeDescriptor descriptor = custom.getCustomAttributeDescriptor();
    if (descriptor != null) {
      for (EvaluatedXmlName variant : descriptor.getCompletionVariants(domElement)) {
        AttributeChildDescriptionImpl childDescription = new AttributeChildDescriptionImpl(variant.getXmlName(), String.class);
        descriptors.add(new DomAttributeXmlDescriptor(childDescription, myManager.getProject()));
      }
    }
  }
  return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
}
项目:intellij-ce-playground    文件:DomSemContributor.java   
@Nullable
private static <T extends DomChildrenDescription> T findChildrenDescription(List<T> descriptions, XmlTag tag, DomInvocationHandler parent) {
  final String localName = tag.getLocalName();
  String namespace = null;
  final String qName = tag.getName();

  final XmlFile file = parent.getFile();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0, size = descriptions.size(); i < size; i++) {
    final T description = descriptions.get(i);
    final XmlName xmlName = description.getXmlName();

    if (localName.equals(xmlName.getLocalName()) || qName.equals(xmlName.getLocalName())) {
      final EvaluatedXmlName evaluatedXmlName = parent.createEvaluatedXmlName(xmlName);
      if (DomImplUtil.isNameSuitable(evaluatedXmlName,
                                     localName,
                                     qName,
                                     namespace == null ? namespace = tag.getNamespace() : namespace,
                                     file)) {
        return description;
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:DomRootInvocationHandler.java   
public DomRootInvocationHandler(final Class aClass,
                                final RootDomParentStrategy strategy,
                                @NotNull final DomFileElementImpl fileElement,
                                @NotNull final EvaluatedXmlName tagName,
                                @Nullable ElementStub stub
) {
  super(aClass, strategy, tagName, new AbstractDomChildDescriptionImpl(aClass) {
    @Override
    @NotNull
    public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
      throw new UnsupportedOperationException();
    }

    @Override
    public int compareTo(final AbstractDomChildDescriptionImpl o) {
      throw new UnsupportedOperationException();
    }
  }, fileElement.getManager(), true, stub);
  myParent = fileElement;
}
项目:tools-idea    文件:AbstractDomChildrenDescriptor.java   
public XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) {
  if (context == null) return XmlAttributeDescriptor.EMPTY;

  DomElement domElement = myManager.getDomElement(context);
  if (domElement == null) return XmlAttributeDescriptor.EMPTY;

  final List<? extends DomAttributeChildDescription> descriptions = domElement.getGenericInfo().getAttributeChildrenDescriptions();
  List<XmlAttributeDescriptor> descriptors = new ArrayList<XmlAttributeDescriptor>();

  for (DomAttributeChildDescription description : descriptions) {
    descriptors.add(new DomAttributeXmlDescriptor(description, myManager.getProject()));
  }
  List<? extends CustomDomChildrenDescription> customs = domElement.getGenericInfo().getCustomNameChildrenDescription();
  for (CustomDomChildrenDescription custom : customs) {
    CustomDomChildrenDescription.AttributeDescriptor descriptor = custom.getCustomAttributeDescriptor();
    if (descriptor != null) {
      for (EvaluatedXmlName variant : descriptor.getCompletionVariants(domElement)) {
        AttributeChildDescriptionImpl childDescription = new AttributeChildDescriptionImpl(variant.getXmlName(), String.class);
        descriptors.add(new DomAttributeXmlDescriptor(childDescription, myManager.getProject()));
      }
    }
  }
  return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
}
项目:tools-idea    文件:DomSemContributor.java   
@Nullable
private static <T extends DomChildrenDescription> T findChildrenDescription(List<T> descriptions, XmlTag tag, DomInvocationHandler parent) {
  final String localName = tag.getLocalName();
  String namespace = null;
  final String qName = tag.getName();

  final XmlFile file = parent.getFile();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0, size = descriptions.size(); i < size; i++) {
    final T description = descriptions.get(i);
    final XmlName xmlName = description.getXmlName();

    if (localName.equals(xmlName.getLocalName()) || qName.equals(xmlName.getLocalName())) {
      final EvaluatedXmlName evaluatedXmlName = parent.createEvaluatedXmlName(xmlName);
      if (DomImplUtil.isNameSuitable(evaluatedXmlName,
                                     localName,
                                     qName,
                                     namespace == null ? namespace = tag.getNamespace() : namespace,
                                     file)) {
        return description;
      }
    }
  }
  return null;
}
项目:tools-idea    文件:DomRootInvocationHandler.java   
public DomRootInvocationHandler(final Class aClass,
                                final RootDomParentStrategy strategy,
                                @NotNull final DomFileElementImpl fileElement,
                                @NotNull final EvaluatedXmlName tagName,
                                @Nullable ElementStub stub
) {
  super(aClass, strategy, tagName, new AbstractDomChildDescriptionImpl(aClass) {
    @NotNull
    public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
      throw new UnsupportedOperationException();
    }

    public int compareTo(final AbstractDomChildDescriptionImpl o) {
      throw new UnsupportedOperationException();
    }
  }, fileElement.getManager(), true, stub);
  myParent = fileElement;
}
项目:consulo-apache-ant    文件:AntDomExtender.java   
public Set<EvaluatedXmlName> getCompletionVariants(@NotNull DomElement parent) {
  if (!(parent instanceof AntDomElement)) {
    return Collections.emptySet();
  }
  final AntDomElement element = (AntDomElement)parent;
  final AntDomProject antDomProject = element.getAntProject();
  if (antDomProject == null) {
    return Collections.emptySet();
  }
  final CustomAntElementsRegistry registry = CustomAntElementsRegistry.getInstance(antDomProject);
  final Set<EvaluatedXmlName> result = new HashSet<EvaluatedXmlName>();
  for (XmlName variant : registry.getCompletionVariants(element)) {
    final String ns = variant.getNamespaceKey();
    result.add(new DummyEvaluatedXmlName(variant, ns != null? ns : ""));
  }
  return result;
}
项目:consulo-xml    文件:AbstractDomChildrenDescriptor.java   
public XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) {
  if (context == null) return XmlAttributeDescriptor.EMPTY;

  DomElement domElement = myManager.getDomElement(context);
  if (domElement == null) return XmlAttributeDescriptor.EMPTY;

  final List<? extends DomAttributeChildDescription> descriptions = domElement.getGenericInfo().getAttributeChildrenDescriptions();
  List<XmlAttributeDescriptor> descriptors = new ArrayList<XmlAttributeDescriptor>();

  for (DomAttributeChildDescription description : descriptions) {
    descriptors.add(new DomAttributeXmlDescriptor(description, myManager.getProject()));
  }
  List<? extends CustomDomChildrenDescription> customs = domElement.getGenericInfo().getCustomNameChildrenDescription();
  for (CustomDomChildrenDescription custom : customs) {
    CustomDomChildrenDescription.AttributeDescriptor descriptor = custom.getCustomAttributeDescriptor();
    if (descriptor != null) {
      for (EvaluatedXmlName variant : descriptor.getCompletionVariants(domElement)) {
        AttributeChildDescriptionImpl childDescription = new AttributeChildDescriptionImpl(variant.getXmlName(), String.class);
        descriptors.add(new DomAttributeXmlDescriptor(childDescription, myManager.getProject()));
      }
    }
  }
  return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
}
项目:consulo-xml    文件:DomSemContributor.java   
@Nullable
private static <T extends DomChildrenDescription> T findChildrenDescription(List<T> descriptions, XmlTag tag, DomInvocationHandler parent) {
  final String localName = tag.getLocalName();
  String namespace = null;
  final String qName = tag.getName();

  final XmlFile file = parent.getFile();

  //noinspection ForLoopReplaceableByForEach
  for (int i = 0, size = descriptions.size(); i < size; i++) {
    final T description = descriptions.get(i);
    final XmlName xmlName = description.getXmlName();

    if (localName.equals(xmlName.getLocalName()) || qName.equals(xmlName.getLocalName())) {
      final EvaluatedXmlName evaluatedXmlName = parent.createEvaluatedXmlName(xmlName);
      if (DomImplUtil.isNameSuitable(evaluatedXmlName,
                                     localName,
                                     qName,
                                     namespace == null ? namespace = tag.getNamespace() : namespace,
                                     file)) {
        return description;
      }
    }
  }
  return null;
}
项目:consulo-xml    文件:DomRootInvocationHandler.java   
public DomRootInvocationHandler(final Class aClass,
                                final RootDomParentStrategy strategy,
                                @NotNull final DomFileElementImpl fileElement,
                                @NotNull final EvaluatedXmlName tagName,
                                @Nullable ElementStub stub
) {
  super(aClass, strategy, tagName, new AbstractDomChildDescriptionImpl(aClass) {
    @NotNull
    public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
      throw new UnsupportedOperationException();
    }

    public int compareTo(final AbstractDomChildDescriptionImpl o) {
      throw new UnsupportedOperationException();
    }
  }, fileElement.getManager(), true, stub);
  myParent = fileElement;
}
项目:intellij-ce-playground    文件:IndexedElementInvocationHandler.java   
public IndexedElementInvocationHandler(final EvaluatedXmlName tagName,
                                       final FixedChildDescriptionImpl description,
                                       final int index,
                                       final DomParentStrategy strategy,
                                       final DomManagerImpl manager,
                                       @Nullable ElementStub stub) {
  super(description.getType(), strategy, tagName, description, manager, strategy.isPhysical(), stub);
  myIndex = index;
}
项目:intellij-ce-playground    文件:AttributeChildInvocationHandler.java   
protected AttributeChildInvocationHandler(final EvaluatedXmlName attributeName,
                                          final AttributeChildDescriptionImpl description,
                                          final DomManagerImpl manager,
                                          final DomParentStrategy strategy,
                                          @Nullable AttributeStub stub) {
  super(description.getType(), strategy, attributeName, description, manager, false, stub);
}
项目:tools-idea    文件:IndexedElementInvocationHandler.java   
public IndexedElementInvocationHandler(final EvaluatedXmlName tagName,
                                       final FixedChildDescriptionImpl description,
                                       final int index,
                                       final DomParentStrategy strategy,
                                       final DomManagerImpl manager,
                                       @Nullable ElementStub stub) {
  super(description.getType(), strategy, tagName, description, manager, strategy.getXmlElement() != null, stub);
  myIndex = index;
}
项目:tools-idea    文件:CollectionElementInvocationHandler.java   
public CollectionElementInvocationHandler(@NotNull EvaluatedXmlName tagName,
                                          AbstractDomChildDescriptionImpl childDescription,
                                          DomManagerImpl manager,
                                          ElementStub stub) {
  super(childDescription.getType(), new StubParentStrategy(stub), tagName, childDescription, manager, true, stub);

}
项目:tools-idea    文件:AttributeChildInvocationHandler.java   
protected AttributeChildInvocationHandler(final EvaluatedXmlName attributeName,
                                          final AttributeChildDescriptionImpl description,
                                          final DomManagerImpl manager,
                                          final DomParentStrategy strategy,
                                          @Nullable AttributeStub stub) {
  super(description.getType(), strategy, attributeName, description, manager, false, stub);
}
项目:consulo-xml    文件:IndexedElementInvocationHandler.java   
public IndexedElementInvocationHandler(final EvaluatedXmlName tagName,
                                       final FixedChildDescriptionImpl description,
                                       final int index,
                                       final DomParentStrategy strategy,
                                       final DomManagerImpl manager,
                                       @Nullable ElementStub stub) {
  super(description.getType(), strategy, tagName, description, manager, strategy.getXmlElement() != null, stub);
  myIndex = index;
}
项目:consulo-xml    文件:CollectionElementInvocationHandler.java   
public CollectionElementInvocationHandler(@NotNull EvaluatedXmlName tagName,
                                          AbstractDomChildDescriptionImpl childDescription,
                                          DomManagerImpl manager,
                                          ElementStub stub) {
  super(childDescription.getType(), new StubParentStrategy(stub), tagName, childDescription, manager, true, stub);

}
项目:consulo-xml    文件:AttributeChildInvocationHandler.java   
protected AttributeChildInvocationHandler(final EvaluatedXmlName attributeName,
                                          final AttributeChildDescriptionImpl description,
                                          final DomManagerImpl manager,
                                          final DomParentStrategy strategy,
                                          @Nullable AttributeStub stub) {
  super(description.getType(), strategy, attributeName, description, manager, false, stub);
}
项目:intellij-ce-playground    文件:CollectionElementInvocationHandler.java   
public CollectionElementInvocationHandler(@NotNull EvaluatedXmlName tagName,
                                          AbstractDomChildDescriptionImpl childDescription,
                                          DomManagerImpl manager,
                                          ElementStub stub) {
  super(childDescription.getType(), new StubParentStrategy(stub), tagName, childDescription, manager, true, stub);
}
项目:intellij-ce-playground    文件:CustomDomChildrenDescription.java   
public Set<EvaluatedXmlName> getCompletionVariants(@NotNull DomElement parent) {
  return Collections.emptySet();
}
项目:intellij-ce-playground    文件:CustomDomChildrenDescription.java   
@Nullable
public PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
  return null;
}
项目:tools-idea    文件:AddToCompositeCollectionInvocation.java   
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
  Set<XmlTag> set = ContainerUtil.newTroveSet();
  for (final CollectionChildDescriptionImpl qname : myQnames) {
    set.addAll(qname.getTagsGetter().fun(handler));
  }

  final XmlTag tag = handler.ensureTagExists();
  int index = args != null && args.length == 1 ? (Integer)args[0] : Integer.MAX_VALUE;

  XmlTag lastTag = null;
  int i = 0;
  final XmlTag[] tags = tag.getSubTags();
  for (final XmlTag subTag : tags) {
    if (i == index) break;
    if (set.contains(subTag)) {
      lastTag = subTag;
      i++;
    }
  }
  final DomManagerImpl manager = handler.getManager();
  final boolean b = manager.setChanging(true);
  try {
    final EvaluatedXmlName evaluatedXmlName = handler.createEvaluatedXmlName(myMainDescription.getXmlName());
    final XmlTag emptyTag = handler.createChildTag(evaluatedXmlName);
    final XmlTag newTag;
    if (lastTag == null) {
      if (tags.length == 0) {
        newTag = (XmlTag)tag.add(emptyTag);
      }
      else {
        newTag = (XmlTag)tag.addBefore(emptyTag, tags[0]);
      }
    }
    else {
      newTag = (XmlTag)tag.addAfter(emptyTag, lastTag);
    }

    return new CollectionElementInvocationHandler(myType, newTag, myMainDescription, handler, null).getProxy();
  }
  finally {
    manager.setChanging(b);
  }
}
项目:tools-idea    文件:CustomDomChildrenDescription.java   
public Set<EvaluatedXmlName> getCompletionVariants(@NotNull DomElement parent) {
  return Collections.emptySet();
}
项目:tools-idea    文件:CustomDomChildrenDescription.java   
@Nullable
public PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
  return null;
}
项目:consulo-apache-ant    文件:AntDomExtender.java   
@Nullable
public PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
  final XmlName xmlName = name.getXmlName();
  return doFindDeclaration(parent, xmlName);
}
项目:consulo-xml    文件:AddToCompositeCollectionInvocation.java   
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
  Set<XmlTag> set = ContainerUtil.newTroveSet();
  for (final CollectionChildDescriptionImpl qname : myQnames) {
    set.addAll(qname.getTagsGetter().fun(handler));
  }

  final XmlTag tag = handler.ensureTagExists();
  int index = args != null && args.length == 1 ? (Integer)args[0] : Integer.MAX_VALUE;

  XmlTag lastTag = null;
  int i = 0;
  final XmlTag[] tags = tag.getSubTags();
  for (final XmlTag subTag : tags) {
    if (i == index) break;
    if (set.contains(subTag)) {
      lastTag = subTag;
      i++;
    }
  }
  final DomManagerImpl manager = handler.getManager();
  final boolean b = manager.setChanging(true);
  try {
    final EvaluatedXmlName evaluatedXmlName = handler.createEvaluatedXmlName(myMainDescription.getXmlName());
    final XmlTag emptyTag = handler.createChildTag(evaluatedXmlName);
    final XmlTag newTag;
    if (lastTag == null) {
      if (tags.length == 0) {
        newTag = (XmlTag)tag.add(emptyTag);
      }
      else {
        newTag = (XmlTag)tag.addBefore(emptyTag, tags[0]);
      }
    }
    else {
      newTag = (XmlTag)tag.addAfter(emptyTag, lastTag);
    }

    return new CollectionElementInvocationHandler(myType, newTag, myMainDescription, handler, null).getProxy();
  }
  finally {
    manager.setChanging(b);
  }
}
项目:consulo-xml    文件:CustomDomChildrenDescription.java   
public Set<EvaluatedXmlName> getCompletionVariants(@NotNull DomElement parent) {
  return Collections.emptySet();
}
项目:consulo-xml    文件:CustomDomChildrenDescription.java   
@Nullable
public PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
  return null;
}
项目:intellij-ce-playground    文件:AbstractCollectionChildDescription.java   
EvaluatedXmlName createEvaluatedXmlName(DomInvocationHandler parent, XmlTag childTag);
项目:tools-idea    文件:AbstractCollectionChildDescription.java   
EvaluatedXmlName createEvaluatedXmlName(DomInvocationHandler parent, XmlTag childTag);
项目:consulo-xml    文件:AbstractCollectionChildDescription.java   
EvaluatedXmlName createEvaluatedXmlName(DomInvocationHandler parent, XmlTag childTag);