mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
some speed optimizations
This commit is contained in:
@@ -24,6 +24,7 @@ import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.xml.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
@@ -89,6 +90,9 @@ public abstract class AntDomElement implements DomElement {
|
||||
|
||||
public final Iterator<AntDomElement> getAntChildrenIterator() {
|
||||
final List<DomElement> children = DomUtil.getDefinedChildren(this, true, false);
|
||||
if (children.size() == 0) {
|
||||
return Collections.<AntDomElement>emptyList().iterator();
|
||||
}
|
||||
final Iterator<DomElement> it = children.iterator();
|
||||
return new Iterator<AntDomElement>() {
|
||||
private DomElement myUnprocessedElement;
|
||||
|
||||
@@ -144,6 +144,22 @@ public class AntDomPropertyReference extends PsiPolyVariantReferenceBase<PsiElem
|
||||
return super.handleElementRename(newElementName);
|
||||
}
|
||||
|
||||
public boolean isReferenceTo(PsiElement element) {
|
||||
// optimization to exclude obvious variants
|
||||
final DomElement domElement = AntDomReferenceBase.toDomElement(element);
|
||||
if (domElement instanceof AntDomProperty) {
|
||||
final AntDomProperty prop = (AntDomProperty)domElement;
|
||||
final String propName = prop.getName().getRawText();
|
||||
if (propName != null && prop.getPrefix().getRawText() == null && prop.getEnvironment().getRawText() == null) {
|
||||
// if only 'name' attrib is specified
|
||||
if (!propName.equalsIgnoreCase(getCanonicalText())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.isReferenceTo(element);
|
||||
}
|
||||
|
||||
private static class MyResolveResult implements ResolveResult {
|
||||
|
||||
private final PsiElement myElement;
|
||||
|
||||
Reference in New Issue
Block a user