private Tuple<String, String> getVersionAndError() throws CoreException { if (project != null) { if (versionPropertyCache == null) { String storeVersion = getStore().getPropertyFromXml(getPythonProjectVersionQualifiedName()); if (storeVersion == null) { // there is no such property set (let's set it to the default) setVersion(getDefaultVersion(), null); // will set the versionPropertyCache too } else { // now, before returning and setting in the cache, let's make sure it's a valid version. if (!IPythonNature.Versions.ALL_VERSIONS_ANY_FLAVOR.contains(storeVersion)) { Log.log("The stored version is invalid (" + storeVersion + "). Setting default."); setVersion(getDefaultVersion(), null); // will set the versionPropertyCache too } else { // Ok, it's correct. versionPropertyCache = storeVersion; } } } } else { String msg = "Trying to get version without project set. Returning default."; Log.log(msg); return new Tuple<String, String>(getDefaultVersion(), msg); } if (versionPropertyCache == null) { String msg = "The cached version is null. Returning default."; Log.log(msg); return new Tuple<String, String>(getDefaultVersion(), msg); } else if (!IPythonNature.Versions.ALL_VERSIONS_ANY_FLAVOR.contains(versionPropertyCache)) { String msg = "The cached version (" + versionPropertyCache + ") is invalid. Returning default."; Log.log(msg); return new Tuple<String, String>(getDefaultVersion(), msg); } return new Tuple<String, String>(versionPropertyCache, null); }
/** * @return The name of the interpreter that should be used for the nature this project is * associated to. * <p>Note that this is the name that's visible to the user (and not the actual path of the * executable). * <p>It can be null if the project is still not set! */ public String getProjectInterpreterName() throws CoreException { if (project != null) { if (interpreterPropertyCache == null) { String storeInterpreter = getStore().getPropertyFromXml(getPythonProjectInterpreterQualifiedName()); if (storeInterpreter == null) { // there is no such property set (let's set it to the default) setVersion( null, IPythonNature.DEFAULT_INTERPRETER); // will set the interpreterPropertyCache too } else { interpreterPropertyCache = storeInterpreter; } } } return interpreterPropertyCache; }