use of com.intellij.lang.ant.config.impl.AntInstallation in project intellij-community by JetBrains.
the class AntUIUtil method customizeReference.
public static void customizeReference(AntReference antReference, SimpleColoredComponent component, GlobalAntConfiguration configuration) {
AntInstallation antInstallation = antReference.find(configuration);
if (antInstallation != null)
customizeAnt(antInstallation.getProperties(), component);
else {
component.setIcon(PlatformIcons.INVALID_ENTRY_ICON);
component.append(antReference.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES);
}
}
use of com.intellij.lang.ant.config.impl.AntInstallation in project intellij-community by JetBrains.
the class AntDomDocumentationProvider method getHelpFile.
@Nullable
private static VirtualFile getHelpFile(final PsiElement element) {
final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
if (xmlTag == null) {
return null;
}
final AntDomElement antElement = AntSupport.getAntDomElement(xmlTag);
if (antElement == null) {
return null;
}
final AntDomProject antProject = antElement.getAntProject();
if (antProject == null) {
return null;
}
final AntInstallation installation = antProject.getAntInstallation();
if (installation == null) {
// not configured properly and bundled installation missing
return null;
}
final String antHomeDir = AntInstallation.HOME_DIR.get(installation.getProperties());
if (antHomeDir == null) {
return null;
}
@NonNls String path = antHomeDir + "/docs/manual";
String url;
if (new File(path).exists()) {
url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path));
} else {
path = antHomeDir + "/docs.zip";
if (new File(path).exists()) {
url = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path) + JarFileSystem.JAR_SEPARATOR + "docs/manual");
} else {
return null;
}
}
final VirtualFile documentationRoot = VirtualFileManager.getInstance().findFileByUrl(url);
if (documentationRoot == null) {
return null;
}
return getHelpFile(antElement, documentationRoot);
}
use of com.intellij.lang.ant.config.impl.AntInstallation 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;
}
use of com.intellij.lang.ant.config.impl.AntInstallation in project intellij-community by JetBrains.
the class AntSetPanel method apply.
void apply() {
for (AntInstallation ant : myForm.getRemovedAnts()) {
myAntConfiguration.removeConfiguration(ant);
}
final Map<AntReference, AntInstallation> currentAnts = myAntConfiguration.getConfiguredAnts();
for (AntInstallation installation : currentAnts.values()) {
installation.updateClasspath();
}
for (AntInstallation ant : myForm.getAddedAnts()) {
myAntConfiguration.addConfiguration(ant);
}
myForm.applyModifications();
}
use of com.intellij.lang.ant.config.impl.AntInstallation in project intellij-community by JetBrains.
the class AntDomProject method loadPredefinedProperties.
@SuppressWarnings({ "UseOfObsoleteCollectionType" })
private Map<String, String> loadPredefinedProperties(final Hashtable properties, final Map<String, String> externalProps) {
final Map<String, String> destination = new HashMap<>();
if (properties != null) {
final Enumeration props = properties.keys();
while (props.hasMoreElements()) {
final String name = (String) props.nextElement();
final String value = (String) properties.get(name);
appendProperty(destination, name, value);
}
}
//}
if (externalProps != null) {
for (final String name : externalProps.keySet()) {
final String value = externalProps.get(name);
appendProperty(destination, name, value);
}
}
String basedir = getProjectBasedirPath();
if (basedir == null) {
basedir = ".";
}
if (!FileUtil.isAbsolute(basedir)) {
final String containigFileDir = getContainingFileDir();
if (containigFileDir != null) {
try {
basedir = new File(containigFileDir, basedir).getCanonicalPath();
} catch (IOException ignored) {
}
}
}
appendProperty(destination, "basedir", FileUtil.toSystemIndependentName(basedir));
final AntInstallation installation = getAntInstallation();
final String homeDir = installation.getHomeDir();
if (homeDir != null) {
appendProperty(destination, "ant.home", FileUtil.toSystemIndependentName(homeDir));
}
appendProperty(destination, "ant.version", installation.getVersion());
final String projectName = getName().getRawText();
appendProperty(destination, "ant.project.name", (projectName == null) ? "" : projectName);
final Sdk jdkToRunWith = getTargetJdk();
final String version = jdkToRunWith != null ? jdkToRunWith.getVersionString() : null;
appendProperty(destination, "ant.java.version", version != null ? version : SystemInfo.JAVA_VERSION);
final VirtualFile containingFile = getXmlTag().getContainingFile().getOriginalFile().getVirtualFile();
if (containingFile != null) {
final String antFilePath = containingFile.getPath();
appendProperty(destination, "ant.file", antFilePath);
if (projectName != null) {
appendProperty(destination, "ant.file." + projectName, antFilePath);
appendProperty(destination, "ant.file.type." + projectName, "file");
}
}
return destination;
}
Aggregations