Search in sources :

Example 1 with AntBuildFileImpl

use of com.intellij.lang.ant.config.impl.AntBuildFileImpl in project intellij-community by JetBrains.

the class AntDomProject method getClassLoader.

@NotNull
public final ClassLoader getClassLoader() {
    ClassLoader loader = myClassLoader;
    if (loader == null) {
        final XmlTag tag = getXmlTag();
        final PsiFile containingFile = tag.getContainingFile();
        final AntBuildFileImpl buildFile = (AntBuildFileImpl) AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
        if (buildFile != null) {
            loader = buildFile.getClassLoader();
        } else {
            AntInstallation antInstallation = getAntInstallation();
            loader = antInstallation.getClassLoader();
        }
        myClassLoader = loader;
    }
    return loader;
}
Also used : AntBuildFileImpl(com.intellij.lang.ant.config.impl.AntBuildFileImpl) PsiFile(com.intellij.psi.PsiFile) AntInstallation(com.intellij.lang.ant.config.impl.AntInstallation) XmlTag(com.intellij.psi.xml.XmlTag) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with AntBuildFileImpl

use of com.intellij.lang.ant.config.impl.AntBuildFileImpl in project intellij-community by JetBrains.

the class AntDomProject method getProperties.

private Map<String, String> getProperties() {
    Map<String, String> properties = myProperties;
    if (properties == null) {
        final ReflectedProject reflected = ReflectedProject.getProject(getClassLoader());
        Map<String, String> externals = Collections.emptyMap();
        final PsiFile containingFile = getXmlTag().getContainingFile();
        if (containingFile != null) {
            final AntBuildFileImpl buildFile = (AntBuildFileImpl) AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
            if (buildFile != null) {
                externals = buildFile.getExternalProperties();
            }
        }
        myProperties = (properties = loadPredefinedProperties(reflected.getProperties(), externals));
    }
    return properties;
}
Also used : ReflectedProject(com.intellij.lang.ant.ReflectedProject) AntBuildFileImpl(com.intellij.lang.ant.config.impl.AntBuildFileImpl) PsiFile(com.intellij.psi.PsiFile)

Example 3 with AntBuildFileImpl

use of com.intellij.lang.ant.config.impl.AntBuildFileImpl in project intellij-community by JetBrains.

the class AntDomProject method getTargetJdk.

@Nullable
public final Sdk getTargetJdk() {
    final XmlTag tag = getXmlTag();
    final PsiFile containingFile = tag.getContainingFile();
    final AntBuildFileImpl buildFile = (AntBuildFileImpl) AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
    if (buildFile != null) {
        String jdkName = AntBuildFileImpl.CUSTOM_JDK_NAME.get(buildFile.getAllOptions());
        if (StringUtil.isEmptyOrSpaces(jdkName)) {
            jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(buildFile.getAllOptions());
        }
        if (!StringUtil.isEmptyOrSpaces(jdkName)) {
            return ProjectJdkTable.getInstance().findJdk(jdkName);
        }
    }
    return ProjectRootManager.getInstance(tag.getProject()).getProjectSdk();
}
Also used : AntBuildFileImpl(com.intellij.lang.ant.config.impl.AntBuildFileImpl) PsiFile(com.intellij.psi.PsiFile) XmlTag(com.intellij.psi.xml.XmlTag) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

AntBuildFileImpl (com.intellij.lang.ant.config.impl.AntBuildFileImpl)3 PsiFile (com.intellij.psi.PsiFile)3 XmlTag (com.intellij.psi.xml.XmlTag)2 ReflectedProject (com.intellij.lang.ant.ReflectedProject)1 AntInstallation (com.intellij.lang.ant.config.impl.AntInstallation)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1