public PsiElement resolveInner() { final String name = getCanonicalRepresentationText(); if (name == null) return null; final AntElement element = getElement(); final AntConfigurationBase antConfig = AntConfigurationBase.getInstance(element.getProject()); AntTarget result = null; if (element instanceof AntAntImpl) { final PsiFile psiFile = ((AntAntImpl) element).getCalledAntFile(); if (psiFile != null) { AntFile antFile = AntSupport.getAntFile(psiFile); if (antFile != null) { final AntFile context = null /*antConfig.getEffectiveContextFile(antFile)*/; assert context != null; final AntProject project = context.getAntProject(); if (project != null) { result = resolveTargetImpl(name, project); } } } } if (result == null) { final AntFile context = null /*antConfig.getEffectiveContextFile(element.getAntFile())*/; assert context != null; result = resolveTargetImpl(name, context.getAntProject()); } return result; }
@NotNull public Object[] getVariants() { final AntElement element = getElement(); if (element instanceof AntAntImpl) { final PsiFile psiFile = ((AntAntImpl) element).getCalledAntFile(); if (psiFile != null) { AntFile antFile; if (psiFile instanceof AntFile) { antFile = (AntFile) psiFile; } else { antFile = AntSupport.getAntFile(psiFile); } final AntProject project = (antFile == null) ? null : antFile.getAntProject(); if (project != null) { return project.getTargets(); } } } List<AntTarget> result = new ArrayList<AntTarget>(); final AntProject project = element.getAntProject(); final AntTarget[] targets = project.getTargets(); for (final AntTarget target : targets) { if (target != element) { result.add(target); } } ContainerUtil.addAll(result, project.getImportedTargets()); return result.toArray(); }