use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class AntResolveTest method testFailProperty1.
public void testFailProperty1() throws Exception {
PsiReference ref = configure();
PsiElement elem = ref.resolve();
assertTrue(elem == null);
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class AntResolveTest method testPropertyInMacrodefParam.
public void testPropertyInMacrodefParam() throws Exception {
PsiReference ref = configure();
final PsiElement result = ref.resolve();
assertTrue(result instanceof PomTargetPsiElement);
final PsiElement naviElem = ((DomTarget) ((PomTargetPsiElement) result).getTarget()).getNavigationElement();
final DomElement domElement = DomUtil.getDomElement(naviElem);
assertNotNull(domElement);
assertNotNull(domElement.getParentOfType(AntDomMacrodefAttribute.class, false));
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class AntResolveTest method testFailProperty.
public void testFailProperty() throws Exception {
PsiReference ref = configure();
PsiElement elem = ref.resolve();
assertTrue(elem == null);
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class AntResolveTest method testIndirectRefid.
public void testIndirectRefid() throws Exception {
PsiReference ref = configure();
assertNotNull(ref.resolve());
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class AntDomTargetDependsListConverter method createReferences.
@NotNull
public PsiReference[] createReferences(GenericDomValue<TargetResolver.Result> value, PsiElement element, ConvertContext context) {
final XmlElement xmlElement = value.getXmlElement();
if (!(xmlElement instanceof XmlAttribute)) {
return PsiReference.EMPTY_ARRAY;
}
final XmlAttributeValue valueElement = ((XmlAttribute) xmlElement).getValueElement();
if (valueElement == null) {
return PsiReference.EMPTY_ARRAY;
}
final String refsString = value.getStringValue();
if (refsString == null) {
return PsiReference.EMPTY_ARRAY;
}
final List<PsiReference> refs = new ArrayList<>();
final AntDomTargetReference.ReferenceGroup group = new AntDomTargetReference.ReferenceGroup();
final TextRange wholeStringRange = ElementManipulators.getValueTextRange(valueElement);
final StringTokenizer tokenizer = new StringTokenizer(refsString, ",", false);
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
int tokenStartOffset = tokenizer.getCurrentPosition() - token.length();
final String ref = token.trim();
if (ref.length() != token.length()) {
for (int idx = 0; idx < token.length(); idx++) {
if (Character.isWhitespace(token.charAt(idx))) {
tokenStartOffset++;
} else {
break;
}
}
}
refs.add(new AntDomTargetReference(element, TextRange.from(wholeStringRange.getStartOffset() + tokenStartOffset, ref.length()), group));
}
return refs.toArray(new PsiReference[refs.size()]);
}
Aggregations