当前位置: 首页>>代码示例>>Java>>正文


Java GradleProjectSettings.getDistributionType方法代码示例

本文整理汇总了Java中org.jetbrains.plugins.gradle.settings.GradleProjectSettings.getDistributionType方法的典型用法代码示例。如果您正苦于以下问题:Java GradleProjectSettings.getDistributionType方法的具体用法?Java GradleProjectSettings.getDistributionType怎么用?Java GradleProjectSettings.getDistributionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.plugins.gradle.settings.GradleProjectSettings的用法示例。


在下文中一共展示了GradleProjectSettings.getDistributionType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canSync

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@NotNull
static PreSyncCheckResult canSync(@NotNull Project project) {
  VirtualFile baseDir = project.getBaseDir();
  if (baseDir == null) {
    // Unlikely to happen because it would mean this is the default project.
    return PreSyncCheckResult.success();
  }

  if (isAndroidStudio()) {
    // We only check proxy settings for Studio, because Studio does not pass the IDE's proxy settings to Gradle.
    // See https://code.google.com/p/android/issues/detail?id=169743
    checkHttpProxySettings(project);
  }

  ProjectSyncMessages syncMessages = ProjectSyncMessages.getInstance(project);
  syncMessages.removeMessages(PROJECT_SYNCING_ERROR_GROUP);

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    attemptToUseEmbeddedGradle(project);
  }

  GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
  File wrapperPropertiesFile = findWrapperPropertiesFile(project);

  DistributionType distributionType = gradleSettings != null ? gradleSettings.getDistributionType() : null;
  boolean usingWrapper = (distributionType == null || distributionType == DEFAULT_WRAPPED) && wrapperPropertiesFile != null;
  if (usingWrapper && gradleSettings != null) {
    // Do this just to ensure that the right distribution type is set. If this is not set, build.gradle editor will not have code
    // completion (see BuildClasspathModuleGradleDataService, line 119).
    gradleSettings.setDistributionType(DEFAULT_WRAPPED);
  }
  else if (!ApplicationManager.getApplication().isUnitTestMode()) {
    if (wrapperPropertiesFile == null && gradleSettings != null) {
      createWrapperIfNecessary(project, gradleSettings, distributionType);
    }
  }

  return PreSyncCheckResult.success();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:PreSyncChecks.java

示例2: handleError

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
@Override
public boolean handleError(@NotNull List<String> message,
                           @NotNull ExternalSystemException error,
                           @NotNull NotificationData notification,
                           @NotNull Project project) {
  String lastLine = message.get(message.size() - 1);

  if (OPEN_GRADLE_SETTINGS.equals(lastLine) || lastLine.contains(FIX_GRADLE_VERSION)) {
    List<NotificationHyperlink> hyperlinks = Lists.newArrayList();
    File wrapperPropertiesFile = GradleUtil.findWrapperPropertiesFile(project);
    if (wrapperPropertiesFile != null) {
      // It is very likely that we need to fix the model version as well. Do everything in one shot.
      NotificationHyperlink hyperlink = FixGradleVersionInWrapperHyperlink.createIfProjectUsesGradleWrapper(project);
      if (hyperlink != null) {
        hyperlinks.add(hyperlink);
      }
    }
    else {
      GradleProjectSettings gradleProjectSettings = GradleUtil.getGradleProjectSettings(project);
      if (gradleProjectSettings != null && gradleProjectSettings.getDistributionType() == DistributionType.LOCAL) {
        hyperlinks.add(new CreateGradleWrapperHyperlink());
      }
    }
    hyperlinks.add(new OpenGradleSettingsHyperlink());
    updateNotification(notification, project, error.getMessage(), hyperlinks);
    return true;
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:UnsupportedGradleVersionErrorHandler.java

示例3: isUsingWrapper

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
private static boolean isUsingWrapper(@NotNull Project project) {
  GradleProjectSettings gradleSettings = getGradleProjectSettings(project);
  File wrapperPropertiesFile = findWrapperPropertiesFile(project);

  DistributionType distributionType = gradleSettings != null ? gradleSettings.getDistributionType() : null;

  return (distributionType == null || distributionType == DistributionType.DEFAULT_WRAPPED) && wrapperPropertiesFile != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GradleDslMethodNotFoundErrorHandler.java

示例4: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:GradleUtil.java

示例5: 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

示例6: doGetGradleHome

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
/**
 * Tries to return file handle that points to the gradle installation home.
 *
 * @param project           target project (if any)
 * @param linkedProjectPath path to the target linked project config
 * @return file handle that points to the gradle installation home (if any)
 */
@Nullable
private File doGetGradleHome(@Nullable Project project, @NotNull String linkedProjectPath) {
  if (project == null) {
    return null;
  }
  GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedProjectPath);
  if (settings == null || settings.getDistributionType() == null) {
    return null;
  }
  return getGradleHome(settings.getDistributionType(), linkedProjectPath, settings.getGradleHome());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GradleInstallationManager.java

示例7: resetWrapperControls

import org.jetbrains.plugins.gradle.settings.GradleProjectSettings; //导入方法依赖的package包/类
private void resetWrapperControls(String linkedProjectPath, @NotNull GradleProjectSettings settings, boolean isDefaultModuleCreation) {
  if (StringUtil.isEmpty(linkedProjectPath) && !isDefaultModuleCreation) {
    if (myUseLocalDistributionButton != null) {
      myUseLocalDistributionButton.setSelected(true);
    }
    if (myGradleHomePathField != null) {
      myGradleHomePathField.setEnabled(true);
    }
    return;
  }

  final boolean isGradleDefaultWrapperFilesExist = GradleUtil.isGradleDefaultWrapperFilesExist(linkedProjectPath);
  if (myUseWrapperButton != null && (isGradleDefaultWrapperFilesExist || isDefaultModuleCreation)) {
    myUseWrapperButton.setEnabled(true);
    myUseWrapperButton.setSelected(true);
    if (myGradleHomePathField != null) {
      myGradleHomePathField.setEnabled(false);
    }
    myUseWrapperButton.setText(GradleBundle.message("gradle.settings.text.use.default_wrapper.configured"));
  }
  else {
    if (myUseWrapperButton != null) {
      myUseWrapperButton.setEnabled(false);
      myUseWrapperButton.setText(GradleBundle.message("gradle.settings.text.use.default_wrapper.not_configured"));
    }
    if (myUseLocalDistributionButton != null) {
      myUseLocalDistributionButton.setSelected(true);
    }
    if (myGradleHomePathField != null) {
      myGradleHomePathField.setEnabled(true);
    }
  }

  if (settings.getDistributionType() == null) {
    return;
  }

  switch (settings.getDistributionType()) {
    case LOCAL:
      if (myGradleHomePathField != null) {
        myGradleHomePathField.setEnabled(true);
      }
      if (myUseLocalDistributionButton != null) {
        myUseLocalDistributionButton.setSelected(true);
      }
      break;
    case DEFAULT_WRAPPED:
      if (isGradleDefaultWrapperFilesExist) {
        if (myGradleHomePathField != null) {
          myGradleHomePathField.setEnabled(false);
        }
        if (myUseWrapperButton != null) {
          myUseWrapperButton.setSelected(true);
          myUseWrapperButton.setEnabled(true);
        }
      }
      break;
    case WRAPPED:
      if (myGradleHomePathField != null) {
        myGradleHomePathField.setEnabled(false);
      }
      if (myUseWrapperWithVerificationButton != null) {
        myUseWrapperWithVerificationButton.setSelected(true);
      }
      break;
    case BUNDLED:
      if (myGradleHomePathField != null) {
        myGradleHomePathField.setEnabled(false);
      }
      if (myUseBundledDistributionButton != null) {
        myUseBundledDistributionButton.setSelected(true);
      }
      break;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:76,代码来源:IdeaGradleProjectSettingsControlBuilder.java


注:本文中的org.jetbrains.plugins.gradle.settings.GradleProjectSettings.getDistributionType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。