@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 (jdkName == null || jdkName.length() == 0) { jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(buildFile.getAllOptions()); } if (jdkName != null && jdkName.length() > 0) { return ProjectJdkTable.getInstance().findJdk(jdkName); } } return ProjectRootManager.getInstance(tag.getProject()).getProjectSdk(); }
@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 (jdkName == null || jdkName.length() == 0) { jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(buildFile.getAllOptions()); } if (jdkName != null && jdkName.length() > 0) { return SdkTable.getInstance().findSdk(jdkName); } } return AntJavaSdkUtil.getBundleSdk(); }
private void runAntTarget(CompileContext compileContext, final Artifact artifact) { if (myExtensionProperties.myEnabled) { final Project project = compileContext.getProject(); final AntBuildTarget target = findTarget(AntConfiguration.getInstance(project)); if (target != null) { final DataContext dataContext = SimpleDataContext.getProjectContext(project); List<BuildFileProperty> properties = getAllProperties(artifact); final boolean success = AntConfigurationImpl.executeTargetSynchronously(dataContext, target, properties); if (!success) { compileContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build artifact '" + artifact.getName() + "': ant target '" + target.getDisplayName() + "' failed with error", null, -1, -1); } } } }
@Override public void reset(AbstractProperty.AbstractPropertyContainer options) { String autoselectJdk = AntConfigurationImpl.DEFAULT_JDK_NAME.get(options); myJDKsController.setRenderer(new AntUIUtil.JavaSdkdkRenderer(true, autoselectJdk)); super.reset(options); myJDKsController.resetList(null); myProjectDefaultAnt = AntConfigurationImpl.DEFAULT_ANT.get(options); updateDefaultAnt(); }
@Override public void apply(AbstractProperty.AbstractPropertyContainer options) { AntConfigurationImpl.DEFAULT_ANT.set(options, myProjectDefaultAnt); super.apply(options); }