Re: [Pydev-code] How to refresh the interpreter
Brought to you by:
fabioz
From: Fabio Z. <fa...@es...> - 2009-11-05 22:57:57
|
> I'm changing the INTERPRETER_PATH_NEW preference with the preference store of the pydev plugin. How can I send a refresh command to the pydev plugin to make sure it is updated? > > See the sample below... > > > Note: sometimes, pydev automatically detected my preference change and automatically refresh the plugin, but sometimes it doesn't. Is there a particular reason? > > Thanks > > Vincent > > > /** > * String template used to define the interpreter value > */ > private static final String INTERPRETER_PATH_NEW_TEMPLATE = > "Version$versionExecutable:" + pathTag + "\\python.exe|" + > "$path\\DLLs|" + > "$path\\lib|" + > "$path\\lib\\lib-tk|" + > "$path|" + > "$path\\lib\\site-packages|" + > "$path\\lib\\site-packages\\win32|" + > "$path\\lib\\site-packages\\win32\\lib|" + > "$path\\lib\\site-packages\\Pythonwin@$|" + > "OpenGL|__builtin__|__main__|_codecs|_hotshot|_locale|_weakref|array|audioop|binascii|cPickle|cStringIO|cmath|email|errno|exceptions|gc|imageop|imp|marshal|math|md5|msvcrt|new|nt|operator|os|pcre|regex|rgbimg|rotor|sha|signal|strop|struct|sys|thread|time|wx|wxPython|xreadlines|xxsubtype&&&&&"; > > > private void setPydevInterpreter(File pythonRootDirExecFile, String version) { > > String pythonPath = pythonRootDirExecFile.getAbsolutePath(); > > // Calculate interpreter value > String interpreterValue = INTERPRETER_PATH_NEW_TEMPLATE; > > // replace version > interpreterValue = interpreterValue.replace("$version", version); > > // replace python path > interpreterValue = interpreterValue.replace("$path", pythonPath); > > // Set INTERPRETER_PATH_NEW preference > pydevPlugin.getPreferenceStore().setValue(INTERPRETER_PATH_NEW, interpreterValue); > > // Refresh pydev plugin > // How can I force the refresh of the plugin > > } > Hi Vincent. The actual way to create an interpreter would be something as: IInterpreterManager iMan = PydevPlugin.getPythonInterpreterManager(true); IInterpreterInfo interpreterInfo = ... (create your interpreter info here) iMan.addInterpreterInfo(interpreterInfo); iMan.restorePythopathForAllInterpreters(monitor); iMan.setPersistedString(iMan.getStringToPersist(new IInterpreterInfo[]{interpreterInfo})); iMan.saveInterpretersInfoModulesManager(); Cheers, Fabio |