use of com.intellij.psi.impl.source.xml.TagNameReference 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;
}
use of com.intellij.psi.impl.source.xml.TagNameReference in project intellij-community by JetBrains.
the class XmlTagRenameDialog method completeVariable.
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);
}
}
Aggregations