本文整理汇总了Java中org.jetbrains.plugins.gradle.settings.GradleProjectSettings.getGradleHome方法的典型用法代码示例。如果您正苦于以下问题:Java GradleProjectSettings.getGradleHome方法的具体用法?Java GradleProjectSettings.getGradleHome怎么用?Java GradleProjectSettings.getGradleHome使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.plugins.gradle.settings.GradleProjectSettings
的用法示例。
在下文中一共展示了GradleProjectSettings.getGradleHome方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getManuallyDefinedGradleHome
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
/**
* Allows to ask for user-defined path to gradle.
*
* @param project target project to use (if any)
* @return path to the gradle distribution (if the one is explicitly configured)
*/
@Nullable
public File getManuallyDefinedGradleHome(@Nullable Project project, @NotNull String linkedProjectPath) {
if (project == null) {
return null;
}
GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedProjectPath);
if (settings == null) {
return null;
}
String path = settings.getGradleHome();
if (path == null) {
return null;
}
File candidate = new File(path);
return isGradleSdkHome(candidate) ? candidate : null;
}
示例2: getGradleVersion
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Nullable
public static FullRevision getGradleVersion(@NotNull Project project) {
String gradleVersion = getGradleVersionUsed(project);
if (isNotEmpty(gradleVersion)) {
// The version of Gradle used is retrieved one of the Gradle models. If that fails, we try to deduce it from the project's Gradle
// settings.
FullRevision revision = parseRevision(removeTimestampFromGradleVersion(gradleVersion));
if (revision != null) {
return revision;
}
}
GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
if (gradleSettings != null) {
DistributionType distributionType = gradleSettings.getDistributionType();
if (distributionType == DEFAULT_WRAPPED) {
File wrapperPropertiesFile = findWrapperPropertiesFile(project);
if (wrapperPropertiesFile != null) {
try {
String wrapperVersion = getGradleWrapperVersion(wrapperPropertiesFile);
if (wrapperVersion != null) {
return parseRevision(removeTimestampFromGradleVersion(wrapperVersion));
}
}
catch (IOException e) {
LOG.info("Failed to read Gradle version in wrapper", e);
}
}
}
else if (distributionType == LOCAL) {
String gradleHome = gradleSettings.getGradleHome();
if (isNotEmpty(gradleHome)) {
File gradleHomePath = new File(gradleHome);
return getGradleVersion(gradleHomePath);
}
}
}
return null;
}
示例3: reset
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
public void reset(Project project, GradleProjectSettings settings, boolean isDefaultModuleCreation) {
String gradleHome = settings.getGradleHome();
if (myGradleHomePathField != null) {
myGradleHomePathField.setText(gradleHome == null ? "" : gradleHome);
myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
}
resetGradleJdkComboBox(project, settings);
resetWrapperControls(settings.getExternalProjectPath(), settings, isDefaultModuleCreation);
if (myUseLocalDistributionButton != null && !myUseLocalDistributionButton.isSelected()) {
myGradleHomePathField.setEnabled(false);
return;
}
if (StringUtil.isEmpty(gradleHome)) {
myGradleHomeSettingType = LocationSettingType.UNKNOWN;
deduceGradleHomeIfPossible();
}
else {
myGradleHomeSettingType = myInstallationManager.isGradleSdkHome(new File(gradleHome)) ?
LocationSettingType.EXPLICIT_CORRECT :
LocationSettingType.EXPLICIT_INCORRECT;
myAlarm.cancelAllRequests();
if (myGradleHomeSettingType == LocationSettingType.EXPLICIT_INCORRECT &&
settings.getDistributionType() == DistributionType.LOCAL) {
new DelayedBalloonInfo(MessageType.ERROR, myGradleHomeSettingType, 0).run();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:IdeaGradleProjectSettingsControlBuilder.java