use of com.intellij.psi.search.PsiElementProcessor in project intellij-community by JetBrains.
the class XmlHighlightingTest method testXsiSchemaLocation3.
public void testXsiSchemaLocation3() throws Exception {
configureByFile(getFullRelativeTestName(".xsd"), null);
doDoTest(true, false);
final List<XmlTag> tags = new ArrayList<>();
XmlUtil.processXmlElements(((XmlFile) myFile).getDocument(), new PsiElementProcessor() {
@Override
public boolean execute(@NotNull final PsiElement element) {
if (element instanceof XmlTag && ((XmlTag) element).getName().equals("xs:include")) {
tags.add((XmlTag) element);
}
return true;
}
}, true);
assertEquals("Should be three tags", 3, tags.size());
String location = "xslt-1_0.xsd";
checkOneTagForSchemaAttribute(tags.get(2), "schemaLocation", location);
}
use of com.intellij.psi.search.PsiElementProcessor in project intellij-plugins by JetBrains.
the class AngularJSMessageFormatExpression method getExtensionTypeElement.
public PsiElement getExtensionTypeElement() {
final Ref<PsiElement> ref = new Ref<>();
PsiTreeUtil.processElements(this, new PsiElementProcessor() {
@Override
public boolean execute(@NotNull PsiElement element) {
final boolean isExpressionName = element.getNode().getElementType() == AngularJSElementTypes.MESSAGE_FORMAT_EXPRESSION_NAME;
ref.set(element);
return !isExpressionName;
}
});
if (ref.isNull()) {
LOG.error("AngularJS message format expression does not have name");
return null;
} else {
return ref.get();
}
}
Aggregations