Java 类com.intellij.psi.impl.source.xml.XmlAttributeReference 实例源码

项目:intellij-ce-playground    文件:XmlAttributeReferenceCompletionProvider.java   
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
  PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
  if (reference instanceof XmlAttributeReference) {
    addAttributeReferenceCompletionVariants((XmlAttributeReference)reference, result, null);
  }
}
项目:intellij-ce-playground    文件:XmlAttributeReferenceCompletionProvider.java   
public static void addAttributeReferenceCompletionVariants(XmlAttributeReference reference, CompletionResultSet result,
                                                           @Nullable InsertHandler<LookupElement> replacementInsertHandler) {
  final XmlTag declarationTag = reference.getElement().getParent();
  LOG.assertTrue(declarationTag.isValid());
  final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor();
  if (parentDescriptor != null) {
    final XmlAttribute[] attributes = declarationTag.getAttributes();
    XmlAttributeDescriptor[] descriptors = parentDescriptor.getAttributesDescriptors(declarationTag);

    descriptors = HtmlUtil.appendHtmlSpecificAttributeCompletions(declarationTag, descriptors, reference.getElement());

    addVariants(result, attributes, descriptors, reference.getElement(), replacementInsertHandler);
  }
}
项目:tools-idea    文件:XmlAttributeReferenceCompletionProvider.java   
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
  PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
  if (reference instanceof XmlAttributeReference) {
    addAttributeReferenceCompletionVariants((XmlAttributeReference)reference, result, null);
  }
}
项目:tools-idea    文件:XmlAttributeReferenceCompletionProvider.java   
public static void addAttributeReferenceCompletionVariants(XmlAttributeReference reference, CompletionResultSet result,
                                                           @Nullable InsertHandler<LookupElement> replacementInsertHandler) {
  final XmlTag declarationTag = reference.getElement().getParent();
  LOG.assertTrue(declarationTag.isValid());
  final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor();
  if (parentDescriptor != null) {
    final XmlAttribute[] attributes = declarationTag.getAttributes();
    XmlAttributeDescriptor[] descriptors = parentDescriptor.getAttributesDescriptors(declarationTag);

    descriptors = HtmlUtil.appendHtmlSpecificAttributeCompletions(declarationTag, descriptors, reference.getElement());

    addVariants(result, attributes, descriptors, reference.getElement(), replacementInsertHandler);
  }
}
项目:consulo-xml    文件:XmlAttributeReferenceCompletionProvider.java   
@Override
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result)
{
    PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
    if(reference instanceof XmlAttributeReference)
    {
        addAttributeReferenceCompletionVariants((XmlAttributeReference) reference, result, null);
    }
}
项目:consulo-xml    文件:XmlAttributeReferenceCompletionProvider.java   
public static void addAttributeReferenceCompletionVariants(XmlAttributeReference reference, CompletionResultSet result, @Nullable InsertHandler<LookupElement> replacementInsertHandler)
{
    final XmlTag declarationTag = reference.getElement().getParent();
    LOG.assertTrue(declarationTag.isValid());
    final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor();
    if(parentDescriptor != null)
    {
        final XmlAttribute[] attributes = declarationTag.getAttributes();
        XmlAttributeDescriptor[] descriptors = parentDescriptor.getAttributesDescriptors(declarationTag);

        descriptors = HtmlUtil.appendHtmlSpecificAttributeCompletions(declarationTag, descriptors, reference.getElement());

        addVariants(result, attributes, descriptors, reference.getElement(), replacementInsertHandler);
    }
}