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

项目:intellij-ce-playground    文件:StyleItemConverter.java   
@Nullable
private static ResolvingConverter findConverterForAttribute(String nsPrefix,
                                                            String localName,
                                                            @NotNull AndroidFacet facet,
                                                            @NotNull GenericDomValue element) {
  ResourceManager manager = facet.getResourceManager("android".equals(nsPrefix)
                                                     ? AndroidUtils.SYSTEM_RESOURCE_PACKAGE
                                                     : null, element.getXmlElement());
  if (manager != null) {
    AttributeDefinitions attrDefs = manager.getAttributeDefinitions();
    if (attrDefs != null) {
      AttributeDefinition attr = attrDefs.getAttrDefByName(localName);
      if (attr != null) {
        return AndroidDomUtil.getConverter(attr);
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:CompositeConverter.java   
@Override
@NotNull
public Collection<String> getVariants(ConvertContext context) {
  List<String> variants = new ArrayList<String>();
  for (ResolvingConverter<String> converter : converters) {
    variants.addAll(converter.getVariants(context));
  }
  return variants;
}
项目:intellij-ce-playground    文件:MavenSmartCompletionContributor.java   
private static <T> void addVariants(ResolvingConverter<T> converter, Collection<T> variants, Collection result) {
  for (T variant : variants) {
    LookupElement lookupElement = converter.createLookupElement(variant);
    if (lookupElement != null) {
      result.add(lookupElement);
    }
    else {
      result.add(variant);
    }
  }
}
项目: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;
}
项目:intellij-ce-playground    文件:FlagConverter.java   
public FlagConverter(@Nullable ResolvingConverter<String> additionalConverter, @NotNull String... values) {
  super("|");
  this.additionalConverter = additionalConverter;
  Collections.addAll(myValues, values);
}
项目:intellij-ce-playground    文件:CompositeConverter.java   
public void addConverter(@NotNull ResolvingConverter<String> converter) {
  converters.add(converter);
}
项目:intellij-ce-playground    文件:CompositeConverter.java   
@NotNull
public List<ResolvingConverter<String>> getConverters() {
  return converters;
}