Search in sources :

Example 1 with AutoConfigMaker

use of org.python.pydev.ui.pythonpathconf.AutoConfigMaker 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)

Aggregations

AbstractInterpreterManager (org.python.pydev.ast.interpreter_managers.AbstractInterpreterManager)1 InterpreterType (org.python.pydev.ast.interpreter_managers.IInterpreterProviderFactory.InterpreterType)1 NotConfiguredInterpreterException (org.python.pydev.core.NotConfiguredInterpreterException)1 AutoConfigMaker (org.python.pydev.ui.pythonpathconf.AutoConfigMaker)1