Exemple #1
0
 /**
  * Can be called to refresh internal info (or after changing the path in the preferences).
  *
  * @throws CoreException
  */
 public void rebuildPath() {
   clearCaches(true);
   // Note: pythonPathNature.getOnlyProjectPythonPathStr(true); cannot be called at this moment
   // as it may trigger a refresh, which may trigger a build and could ask for
   // PythonNature.getPythonNature (which
   // could be the method that ended up calling rebuildPath in the first place, so, it'd deadlock).
   this.rebuildJob.cancel();
   this.rebuildJob.schedule(20L);
 }
Exemple #2
0
 /**
  * Can be called to refresh internal info (or after changing the path in the preferences).
  *
  * @throws CoreException
  */
 public void rebuildPath() throws CoreException {
   clearCaches();
   String paths = this.pythonPathNature.getOnlyProjectPythonPathStr(true);
   synchronized (this.setParamsLock) {
     this.rebuildJob.cancel();
     this.rebuildJob.setParams(paths);
     this.rebuildJob.schedule(20L);
   }
 }
Exemple #3
0
  /**
   * @param version: the project version given the constants PYTHON_VERSION_XX and JYTHON_VERSION_XX
   *     in IPythonNature. If null, nothing is done for the version.
   * @param interpreter the interpreter to be set if null, nothing is done to the interpreter.
   * @throws CoreException
   */
  public void setVersion(String version, String interpreter) throws CoreException {
    clearCaches(false);

    if (version != null) {
      this.versionPropertyCache = version;
    }

    if (interpreter != null) {
      this.interpreterPropertyCache = interpreter;
    }

    if (project != null) {
      boolean notify = false;
      if (version != null) {
        IPythonNatureStore store = getStore();
        QualifiedName pythonProjectVersionQualifiedName = getPythonProjectVersionQualifiedName();
        String current = store.getPropertyFromXml(pythonProjectVersionQualifiedName);

        if (current == null || !current.equals(version)) {
          store.setPropertyToXml(pythonProjectVersionQualifiedName, version, true);
          notify = true;
        }
      }
      if (interpreter != null) {
        IPythonNatureStore store = getStore();
        QualifiedName pythonProjectInterpreterQualifiedName =
            getPythonProjectInterpreterQualifiedName();
        String current = store.getPropertyFromXml(pythonProjectInterpreterQualifiedName);

        if (current == null || !current.equals(interpreter)) {
          store.setPropertyToXml(pythonProjectInterpreterQualifiedName, interpreter, true);
          notify = true;
        }
      }
      if (notify) {
        PythonNatureListenersManager.notifyPythonPathRebuilt(project, this);
      }
    }
  }