[Pydev-cvs] org.python.pydev/src/org/python/pydev/ui/pythonpathconf InterpreterPreferencesPage.java,
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-05-25 13:48:31
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/pythonpathconf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13371/src/org/python/pydev/ui/pythonpathconf Modified Files: InterpreterPreferencesPage.java InterpreterInfo.java Log Message: tests running... Index: InterpreterInfo.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InterpreterInfo.java 24 May 2005 19:11:33 -0000 1.4 --- InterpreterInfo.java 25 May 2005 13:48:22 -0000 1.5 *************** *** 17,21 **** import org.eclipse.core.runtime.IProgressMonitor; - import org.eclipse.core.runtime.NullProgressMonitor; import org.python.pydev.editor.codecompletion.revisited.PythonPathHelper; import org.python.pydev.editor.codecompletion.revisited.SystemModulesManager; --- 17,20 ---- *************** *** 24,45 **** public class InterpreterInfo implements Serializable{ - public String executable; - public java.util.List libs = new ArrayList(); //folders - public java.util.List dllLibs = new ArrayList(); //.pyd, .dll, etc. - public Set forcedLibs = new HashSet(); //__builtin__, os, math - public SystemModulesManager modulesManager = new SystemModulesManager(); ! public InterpreterInfo(String exe, Collection c, Collection dlls){ ! this(exe, c); ! dllLibs.addAll(dlls); ! } ! public InterpreterInfo(String exe, Collection c){ this.executable = exe; ! libs.addAll(c); } ! public InterpreterInfo(String exe, List libs, List dlls, List forced) { ! this(exe, libs, dlls); forcedLibs.addAll(forced); } --- 23,51 ---- public class InterpreterInfo implements Serializable{ ! //these are transient, they can be gotten for persistence on toString and fromString ! //(it is needed because some of these info is gotten in a python shell and restored here). ! public transient String executable; ! public transient java.util.List libs = new ArrayList(); //folders ! public transient java.util.List dllLibs = new ArrayList(); //.pyd, .dll, etc. ! public transient Set forcedLibs = new HashSet(); //__builtin__, os, math ! /** ! * module management for the system is always binded to an interpreter (binded in this class) ! */ ! public SystemModulesManager modulesManager = new SystemModulesManager(forcedLibs); ! ! public InterpreterInfo(String exe, Collection libs0){ this.executable = exe; ! libs.addAll(libs0); } ! public InterpreterInfo(String exe, Collection libs0, Collection dlls){ ! this(exe, libs0); ! dllLibs.addAll(dlls); ! } ! ! public InterpreterInfo(String exe, List libs0, List dlls, List forced) { ! this(exe, libs0, dlls); forcedLibs.addAll(forced); } *************** *** 201,214 **** /** * @param path */ ! public void restorePythonpath(String path) { ! modulesManager.changePythonPath(path, null, new NullProgressMonitor()); } /** * @param path */ ! public void restorePythonpath() { StringBuffer buffer = new StringBuffer(); for (Iterator iter = libs.iterator(); iter.hasNext();) { --- 207,224 ---- /** + * Restores the path given non-standard libraries * @param path */ ! public void restorePythonpath(String path, IProgressMonitor monitor) { ! //no managers involved here... ! modulesManager.setBuiltins(forcedLibs); ! modulesManager.changePythonPath(path, null, monitor, new ArrayList()); } /** + * Restores the path with the discovered libs * @param path */ ! public void restorePythonpath(IProgressMonitor monitor) { StringBuffer buffer = new StringBuffer(); for (Iterator iter = libs.iterator(); iter.hasNext();) { *************** *** 217,221 **** buffer.append("|"); } ! modulesManager.changePythonPath(buffer.toString(), null, new NullProgressMonitor()); } } \ No newline at end of file --- 227,231 ---- buffer.append("|"); } ! restorePythonpath(buffer.toString(), monitor); } } \ No newline at end of file Index: InterpreterPreferencesPage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterPreferencesPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InterpreterPreferencesPage.java 24 May 2005 19:11:33 -0000 1.1 --- InterpreterPreferencesPage.java 25 May 2005 13:48:22 -0000 1.2 *************** *** 6,10 **** package org.python.pydev.ui.pythonpathconf; ! import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.swt.widgets.Composite; --- 6,14 ---- package org.python.pydev.ui.pythonpathconf; ! import java.lang.reflect.InvocationTargetException; ! ! import org.eclipse.core.runtime.IProgressMonitor; ! import org.eclipse.jface.dialogs.ProgressMonitorDialog; ! import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.swt.widgets.Composite; *************** *** 74,83 **** /** ! * */ private void restoreModules() { ! IInterpreterManager iMan = PydevPlugin.getInterpreterManager(); ! String interpreter = iMan.getDefaultInterpreter(); ! iMan.getInterpreterInfo(interpreter, new NullProgressMonitor()); } --- 78,102 ---- /** ! * Restores the modules. */ private void restoreModules() { ! ProgressMonitorDialog monitorDialog = new ProgressMonitorDialog(this.getShell()); ! ! monitorDialog.setBlockOnOpen(false); ! try { ! IRunnableWithProgress operation = new IRunnableWithProgress(){ ! ! public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { ! IInterpreterManager iMan = PydevPlugin.getInterpreterManager(); ! InterpreterInfo info = iMan.getDefaultInterpreterInfo(monitor); ! info.restorePythonpath(monitor); ! }}; ! ! monitorDialog.run(true, true, operation); ! ! }catch (Exception e) { ! PydevPlugin.log(e); ! } ! } |