use of org.jetbrains.idea.maven.dom.converters.MavenSmartConverter in project intellij-community by JetBrains.
the class MavenSmartCompletionContributor method getVariants.
@NotNull
private static Collection<?> getVariants(CompletionParameters parameters) {
if (!MavenDomUtil.isMavenFile(parameters.getOriginalFile()))
return Collections.emptyList();
SmartList<?> result = new SmartList<>();
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) {
Collection variants = ((MavenSmartConverter) converter).getSmartVariants(reference.getConvertContext());
if (converter instanceof ResolvingConverter) {
addVariants((ResolvingConverter) converter, variants, result);
} else {
result.addAll(variants);
}
} else if (converter instanceof ResolvingConverter) {
//noinspection unchecked
ResolvingConverter resolvingConverter = (ResolvingConverter) converter;
Collection variants = resolvingConverter.getVariants(reference.getConvertContext());
addVariants(resolvingConverter, variants, result);
}
} else {
//noinspection unchecked
Collections.addAll((Collection) result, each.getVariants());
}
}
return result;
}
Aggregations