예제 #1
0
  /**
   * Call this to set a custom gradle executor. We'll enable all fields appropriately and setup the
   * foundation settings. We'll also fire off a refresh.
   *
   * @param file the file to use as a custom executor. Null not to use one.
   */
  private void setCustomGradleExecutor(File file) {
    String storagePath;
    boolean isUsingCustom = false;
    if (file == null) {
      isUsingCustom = false;
      storagePath = null;
    } else {
      isUsingCustom = true;
      storagePath = file.getAbsolutePath();
    }

    // set the executor in the foundation
    if (gradlePluginLord.setCustomGradleExecutor(file)) {
      // refresh the tasks only if we actually changed the executor
      gradlePluginLord.addRefreshRequestToQueue();
    }

    // set the UI values
    useCustomGradleExecutorCheckBox.setSelected(isUsingCustom);
    customGradleExecutorField.setText(storagePath);

    // enable the UI appropriately.
    browseForCustomGradleExecutorButton.setEnabled(isUsingCustom);
    customGradleExecutorField.setEnabled(isUsingCustom);

    // store the settings
    settingsNode.setValueOfChild(CUSTOM_GRADLE_EXECUTOR, storagePath);
  }