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

项目:intellij-ce-playground    文件:TagNameReferenceCompletionProvider.java   
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull final CompletionResultSet result) {
  LegacyCompletionContributor.processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
    @Override
    public void consume(PsiReference reference, CompletionResultSet set) {
      if (reference instanceof TagNameReference) {
        collectCompletionVariants((TagNameReference)reference, set);
      }
      else if (reference instanceof SchemaPrefixReference) {
        TagNameReference tagNameReference = ((SchemaPrefixReference)reference).getTagNameReference();
        if (tagNameReference != null && !tagNameReference.isStartTagFlag()) {
          set.consume(createClosingTagLookupElement((XmlTag)tagNameReference.getElement(), true, tagNameReference.getNameElement()));
        }
      }
    }
  });
}
项目:tools-idea    文件:TagNameReferenceCompletionProvider.java   
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull final CompletionResultSet result) {
  LegacyCompletionContributor.processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
    @Override
    public void consume(PsiReference reference, CompletionResultSet set) {
      if (reference instanceof TagNameReference) {
        collectCompletionVariants((TagNameReference)reference, set);
      }
      else if (reference instanceof SchemaPrefixReference) {
        TagNameReference tagNameReference = ((SchemaPrefixReference)reference).getTagNameReference();
        if (tagNameReference != null && !tagNameReference.isStartTagFlag()) {
          set.consume(createClosingTagLookupElement((XmlTag)tagNameReference.getElement(), true, tagNameReference.getNameElement()));
        }
      }
    }
  });
}
项目:consulo-xml    文件:TagNameReferenceCompletionProvider.java   
@Override
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet result)
{
    LegacyCompletionContributor.processReferences(parameters, result, (reference, set) ->
    {
        if(reference instanceof TagNameReference)
        {
            collectCompletionVariants((TagNameReference) reference, set);
        }
        else if(reference instanceof SchemaPrefixReference)
        {
            TagNameReference tagNameReference = ((SchemaPrefixReference) reference).getTagNameReference();
            if(tagNameReference != null && !tagNameReference.isStartTagFlag())
            {
                set.consume(createClosingTagLookupElement((XmlTag) tagNameReference.getElement(), true, tagNameReference.getNameElement()));
            }
        }
    });
}
项目:consulo-xml    文件:TagNameReferenceCompletionProvider.java   
public static void collectCompletionVariants(TagNameReference tagNameReference, Consumer<LookupElement> consumer)
{
    PsiElement element = tagNameReference.getElement();
    if(element instanceof XmlTag)
    {
        if(!tagNameReference.isStartTagFlag())
        {
            consumer.consume(createClosingTagLookupElement((XmlTag) element, false, tagNameReference.getNameElement()));
        }
        else
        {
            XmlTag tag = (XmlTag) element;
            for(LookupElement variant : getTagNameVariants(tag, tag.getNamespacePrefix()))
            {
                consumer.consume(variant);
            }
        }
    }
}
项目:mule-intellij-plugins    文件:FlowRenameDialog.java   
private void completeVariable(Editor editor) {
    String prefix = this.myNameSuggestionsField.getEnteredName();
    PsiReference reference = this.myTag.getReference();
    if(reference instanceof TagNameReference) {
        LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(this.myTag, this.myTag.getNamespacePrefix());
        editor.getCaretModel().moveToOffset(prefix.length());
        editor.getSelectionModel().removeSelection();
        LookupManager.getInstance(this.getProject()).showLookup(editor, lookupItems, prefix);
    }

}
项目:intellij-ce-playground    文件:TagNameReferenceCompletionProvider.java   
public static void collectCompletionVariants(TagNameReference tagNameReference,
                                             Consumer<LookupElement> consumer) {
  PsiElement element = tagNameReference.getElement();
  if (element instanceof XmlTag) {
    if (!tagNameReference.isStartTagFlag()) {
      consumer.consume(createClosingTagLookupElement((XmlTag)element, false, tagNameReference.getNameElement()));
    }
    else {
      XmlTag tag = (XmlTag) element;
      for(LookupElement variant: getTagNameVariants(tag, tag.getNamespacePrefix())) {
        consumer.consume(variant);
      }
    }
  }
}
项目:intellij-ce-playground    文件:XmlTagRenameDialog.java   
private void completeVariable(final Editor editor) {
  String prefix = myNameSuggestionsField.getEnteredName();

  final PsiReference reference = myTag.getReference();
  if (reference instanceof TagNameReference) {
    LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(myTag, myTag.getNamespacePrefix());
    editor.getCaretModel().moveToOffset(prefix.length());
    editor.getSelectionModel().removeSelection();
    LookupManager.getInstance(getProject()).showLookup(editor, lookupItems, prefix);
  }
}
项目:intellij-ce-playground    文件:AndroidXmlExtension.java   
@Nullable
@Override
public TagNameReference createTagNameReference(ASTNode nameElement, boolean startTagFlag) {
  return AndroidXmlReferenceProvider.areReferencesProvidedByReferenceProvider(nameElement)
         ? null
         : new AndroidClassTagNameReference(nameElement, startTagFlag);
}
项目:tools-idea    文件:TagNameReferenceCompletionProvider.java   
public static void collectCompletionVariants(TagNameReference tagNameReference,
                                             Consumer<LookupElement> consumer) {
  PsiElement element = tagNameReference.getElement();
  if (element instanceof XmlTag) {
    if (!tagNameReference.isStartTagFlag()) {
      consumer.consume(createClosingTagLookupElement((XmlTag)element, false, tagNameReference.getNameElement()));
    }
    else {
      XmlTag tag = (XmlTag) element;
      for(LookupElement variant: getTagNameVariants(tag, tag.getNamespacePrefix())) {
        consumer.consume(variant);
      }
    }
  }
}
项目:tools-idea    文件:XmlTagRenameDialog.java   
private void completeVariable(final Editor editor) {
  String prefix = myNameSuggestionsField.getEnteredName();

  final PsiReference reference = myTag.getReference();
  if (reference instanceof TagNameReference) {
    LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(myTag, myTag.getNamespacePrefix());
    editor.getCaretModel().moveToOffset(prefix.length());
    editor.getSelectionModel().removeSelection();
    LookupManager.getInstance(getProject()).showLookup(editor, lookupItems, prefix);
  }
}
项目:tools-idea    文件:MavenSmartCompletionContributor.java   
@NotNull
private static Collection<?> getVariants(CompletionParameters parameters) {
  if (!MavenDomUtil.isMavenFile(parameters.getOriginalFile())) return Collections.emptyList();

  SmartList<?> result = new SmartList<Object>();

  for (PsiReference each : getReferences(parameters)) {
    if (each instanceof TagNameReference) continue;

    if (each instanceof GenericDomValueReference) {
      GenericDomValueReference reference = (GenericDomValueReference)each;

      Converter converter = reference.getConverter();

      if (converter instanceof MavenSmartConverter) {
        result.addAll(((MavenSmartConverter)converter).getSmartVariants(reference.getConvertContext()));
      }
      else if (converter instanceof ResolvingConverter) {
        //noinspection unchecked
        result.addAll(((ResolvingConverter)converter).getVariants(reference.getConvertContext()));
      }
    }
    else {
      //noinspection unchecked
      Collections.addAll((Collection)result, each.getVariants());
    }
  }
  return result;
}
项目:consulo-xml    文件:XmlTagRenameDialog.java   
private void completeVariable(final Editor editor)
{
    String prefix = myNameSuggestionsField.getEnteredName();

    final PsiReference reference = myTag.getReference();
    if(reference instanceof TagNameReference)
    {
        LookupElement[] lookupItems = TagNameReferenceCompletionProvider.getTagNameVariants(myTag, myTag.getNamespacePrefix());
        editor.getCaretModel().moveToOffset(prefix.length());
        editor.getSelectionModel().removeSelection();
        LookupManager.getInstance(getProject()).showLookup(editor, lookupItems, prefix);
    }
}
项目:intellij-bpmn-editor    文件:BPMNFileExtension.java   
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
    return new BPMNTagNameReference(nameElement, startTagFlag);
}
项目:intellij-ce-playground    文件:XmlExtension.java   
@Nullable
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
  return new TagNameReference(nameElement, startTagFlag);
}
项目:intellij-ce-playground    文件:AntUnresolvedRefsFixProvider.java   
public void registerFixes(@NotNull PsiReference ref, @NotNull QuickFixActionRegistrar registrar) {
  if (ref instanceof TagNameReference || ref instanceof AntDomReference) {
    registrar.register(new AntChangeContextFix());
  }
}
项目:intellij-ce-playground    文件:JavaFxXmlExtension.java   
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
  return new JavaFxTagNameReference(nameElement, startTagFlag);
}
项目:tools-idea    文件:XmlExtension.java   
@Nullable
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
  return new TagNameReference(nameElement, startTagFlag);
}
项目:tools-idea    文件:AntUnresolvedRefsFixProvider.java   
public void registerFixes(PsiReference ref, QuickFixActionRegistrar registrar) {
  if (ref instanceof TagNameReference || ref instanceof AntDomReference) {
    registrar.register(new AntChangeContextFix());
  }
}
项目:tools-idea    文件:JavaFxXmlExtension.java   
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
  return new JavaFxTagNameReference(nameElement, startTagFlag);
}
项目:consulo-javafx    文件:JavaFxXmlExtension.java   
@Override
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) {
  return new JavaFxTagNameReference(nameElement, startTagFlag);
}
项目:consulo-apache-ant    文件:AntUnresolvedRefsFixProvider.java   
public void registerFixes(PsiReference ref, QuickFixActionRegistrar registrar) {
  if (ref instanceof TagNameReference || ref instanceof AntDomReference) {
    registrar.register(new AntChangeContextFix());
  }
}
项目:consulo-xml    文件:XmlExtension.java   
@Nullable
public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag)
{
    return new TagNameReference(nameElement, startTagFlag);
}