Search in sources :

Example 1 with AbstractInterpreterManager

use of org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager in project Pydev by fabioz.

the class ConfigureInterpreterJob method runInUIThread.

@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
    Set<AbstractInterpreterManager> current = interpreters;
    interpreters = new HashSet<AbstractInterpreterManager>();
    for (AbstractInterpreterManager m : current) {
        try {
            m.getDefaultInterpreterInfo(false);
            // Maybe it got configured at some other point...
            continue;
        } catch (NotConfiguredInterpreterException e) {
            int ret = PyDialogHelpers.openQuestionConfigureInterpreter(m);
            if (ret != PyDialogHelpers.INTERPRETER_CANCEL_CONFIG) {
                if (ret == InterpreterConfigHelpers.CONFIG_MANUAL) {
                    PreferencesUtil.createPreferenceDialogOn(null, m.getPreferencesPageId(), null, null).open();
                } else if (ret == InterpreterConfigHelpers.CONFIG_ADV_AUTO || ret == InterpreterConfigHelpers.CONFIG_AUTO) {
                    InterpreterType interpreterType;
                    switch(m.getInterpreterType()) {
                        case IPythonNature.INTERPRETER_TYPE_JYTHON:
                            interpreterType = InterpreterType.JYTHON;
                            break;
                        case IPythonNature.INTERPRETER_TYPE_IRONPYTHON:
                            interpreterType = InterpreterType.IRONPYTHON;
                            break;
                        default:
                            interpreterType = InterpreterType.PYTHON;
                    }
                    boolean advanced = ret == InterpreterConfigHelpers.CONFIG_ADV_AUTO;
                    AutoConfigMaker a = new AutoConfigMaker(interpreterType, advanced, null, null);
                    a.autoConfigSingleApply(null);
                } else {
                    Log.log("Unexpected option: " + ret);
                }
            }
        }
    }
    return Status.OK_STATUS;
}
Also used : InterpreterType(org.python.pydev.ast.interpreter_managers.IInterpreterProviderFactory.InterpreterType) AutoConfigMaker(org.python.pydev.ui.pythonpathconf.AutoConfigMaker) AbstractInterpreterManager(org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager) NotConfiguredInterpreterException(org.python.pydev.core.NotConfiguredInterpreterException)

Example 2 with AbstractInterpreterManager

use of org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager in project Pydev by fabioz.

the class JythonCodeCompletionTestsBase method setInterpreterManager.

@Override
protected void setInterpreterManager(String path) {
    AbstractInterpreterManager interpreterManager = new JythonInterpreterManager(this.getPreferences());
    InterpreterInfo info;
    info = (InterpreterInfo) interpreterManager.createInterpreterInfo(TestDependent.JYTHON_JAR_LOCATION, new NullProgressMonitor(), false);
    if (!info.executableOrJar.equals(TestDependent.JYTHON_JAR_LOCATION)) {
        throw new RuntimeException("expected same");
    }
    if (path != null) {
        info = new InterpreterInfo(info.getVersion(), TestDependent.JYTHON_JAR_LOCATION, PythonPathHelper.parsePythonPathFromStr(path, new ArrayList<String>()));
    }
    interpreterManager.setInfos(new IInterpreterInfo[] { info }, null, null);
    InterpreterManagersAPI.setJythonInterpreterManager(interpreterManager);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) AbstractInterpreterManager(org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager) InterpreterInfo(org.python.pydev.ast.interpreter_managers.InterpreterInfo) IInterpreterInfo(org.python.pydev.core.IInterpreterInfo) JythonInterpreterManager(org.python.pydev.ast.interpreter_managers.JythonInterpreterManager)

Aggregations

AbstractInterpreterManager (org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 InterpreterType (org.python.pydev.ast.interpreter_managers.IInterpreterProviderFactory.InterpreterType)1 InterpreterInfo (org.python.pydev.ast.interpreter_managers.InterpreterInfo)1 JythonInterpreterManager (org.python.pydev.ast.interpreter_managers.JythonInterpreterManager)1 IInterpreterInfo (org.python.pydev.core.IInterpreterInfo)1 NotConfiguredInterpreterException (org.python.pydev.core.NotConfiguredInterpreterException)1 AutoConfigMaker (org.python.pydev.ui.pythonpathconf.AutoConfigMaker)1