public boolean processNestedElements(PsiScopeProcessor processor) { final AntIntrospector introspector = AntDomExtender.getIntrospector(myAntClass); if (introspector != null) { String expectedName = ResolveUtil.getNameHint(processor); final PsiType stringType = getParameterList().getParameters()[1].getType(); final PsiType closureType = getParameterList().getParameters()[2].getType(); for (String name : Collections.list(introspector.getNestedElements())) { if (expectedName == null || expectedName.equals(name)) { final AntBuilderMethod method = new AntBuilderMethod(myPlace, name, closureType, introspector.getElementType(name), stringType); if (!processor.execute(method, ResolveState.initial())) return false; } } } return true; }
@Nullable public static AntIntrospector getIntrospector(Class c) { try { return AntIntrospector.getInstance(c); } catch (Throwable ignored) { } return null; }
private List<AbstractIntrospector> getContexts() { if (myContexts != null) { return myContexts; } final List<AbstractIntrospector> parents = new ArrayList<AbstractIntrospector>(); final AntDomMacroDef macroDef = myElement.getParentOfType(AntDomMacroDef.class, true); if (macroDef != null) { final AntDomSequentialTask body = macroDef.getMacroBody(); if (body != null) { body.accept(new AntDomRecursiveVisitor() { public void visitAntDomCustomElement(AntDomCustomElement custom) { if (myElement.equals(custom.getDeclaringElement())) { final AntDomElement parent = custom.getParentOfType(AntDomElement.class, true); if (parent != null) { final Class type = parent.getChildDescription().getUserData(ELEMENT_IMPL_CLASS_KEY); if (type != null) { final AntIntrospector antIntrospector = AntIntrospector.getInstance(type); if (antIntrospector != null) { parents.add(new ClassIntrospectorAdapter(antIntrospector)); } } } } } }); } } return myContexts = parents; }
private ClassIntrospectorAdapter(AntIntrospector introspector) { this(introspector, null, null); }
public ClassIntrospectorAdapter(AntIntrospector introspector, Map<String, Class> coreTaskDefs, Map<String, Class> coreTypeDefs) { myIntrospector = introspector; myCoreTaskDefs = coreTaskDefs != null? coreTaskDefs : Collections.<String, Class>emptyMap(); myCoreTypeDefs = coreTypeDefs != null? coreTypeDefs : Collections.<String, Class>emptyMap(); }