Esempio n. 1
0
    protected String resolve(TemplateContext context) {
      String path = null;

      try {
        ISourceModule module = getSourceModule(context);
        IInterpreterInstall install =
            ScriptRuntime.getInterpreterInstall(module.getScriptProject());

        path = install.getRawInstallLocation().toOSString();
      } catch (CoreException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
      }

      return path;
    }
  /**
   * Determines if the present setup is the default location s for this InterpreterEnvironment
   *
   * @return true if the current set of locations are the defaults, false otherwise
   */
  protected boolean isDefaultLocations() {
    EnvironmentVariable[] EnvironmentVariables =
        fEnvironmentVariablesContentProvider.getVariables();
    IInterpreterInstall install = getInterpreterInstall();

    if (install == null || EnvironmentVariables == null) {
      return true;
    }
    IFileHandle installLocation = install.getInstallLocation();
    if (installLocation != null) {
      EnvironmentVariable[] def = new EnvironmentVariable[0];
      if (def.length == EnvironmentVariables.length) {
        for (int i = 0; i < def.length; i++) {
          if (!def[i].equals(EnvironmentVariables[i])) {
            return false;
          }
        }
        return true;
      }
    }
    return false;
  }
 /** Saves settings in the given working copy */
 public void performApply(IInterpreterInstall install) {
   EnvironmentVariable[] libs = fEnvironmentVariablesContentProvider.getVariables();
   install.setEnvironmentVariables(libs);
 }