Package com.python.pydev.analysis.actions

Examples of com.python.pydev.analysis.actions.AdditionalInfoAndIInfo


                        try {
                            additionalInfo = AdditionalProjectInterpreterInfo.getAdditionalInfoForProject(nature);
                        } catch (Exception e) {
                            return null; //don't even report the error (this could happen if a saved option doesn't exist anymore)
                        }
                        return new AdditionalInfoAndIInfo(additionalInfo, info);
                    }
                }

            } else if (keys.contains(TAG_MANAGER_INTERPRETER_TYPE) && keys.contains(TAG_MANAGER_INTERPRETER)) {
                Integer interpreterType = memento.getInteger(TAG_MANAGER_INTERPRETER_TYPE);
                if (interpreterType != null) {
                    switch (interpreterType) {
                        case IInterpreterManager.INTERPRETER_TYPE_PYTHON:
                            manager = PydevPlugin.getPythonInterpreterManager();
                            break;

                        case IInterpreterManager.INTERPRETER_TYPE_JYTHON:
                            manager = PydevPlugin.getJythonInterpreterManager();
                            break;

                        case IInterpreterManager.INTERPRETER_TYPE_IRONPYTHON:
                            manager = PydevPlugin.getIronpythonInterpreterManager();
                            break;
                    }

                }

            } else if (keys.contains(TAG_MANAGER_IS_PYTHON) && keys.contains(TAG_MANAGER_INTERPRETER)) {
                //Kept for backward compatibility
                Boolean isTagPython = memento.getBoolean(TAG_MANAGER_IS_PYTHON);
                if (isTagPython != null) {
                    if (isTagPython) {
                        manager = PydevPlugin.getPythonInterpreterManager();
                    } else {
                        manager = PydevPlugin.getJythonInterpreterManager();

                    }
                }
            }

            //If it gets here, it MUST contain the TAG_MANAGER_INTERPRETER
            if (manager != null) {
                String interpreter = memento.getString(TAG_MANAGER_INTERPRETER);

                AbstractAdditionalTokensInfo additionalInfo;
                try {
                    additionalInfo = AdditionalSystemInterpreterInfo.getAdditionalSystemInfo(manager, interpreter);
                } catch (Exception e) {
                    return null; //don't even report the error (this could happen if a saved option doesn't exist anymore)
                }
                if (additionalInfo != null) {
                    return new AdditionalInfoAndIInfo(additionalInfo, info);
                }
            }
        } catch (Throwable e) {
            //Don't fail because we weren't able to restore some info, just log and return null (which clients should expect).
            Log.log(e);
View Full Code Here


import junit.framework.TestCase;

public class InfoFactoryTest extends TestCase {

    public void testInfoFactory() throws Exception {
        InfoFactory infoFactory = new InfoFactory(new AdditionalInfoAndIInfo(null, null));
        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document document = documentBuilder.newDocument();
        Element root = document.createElement("root");
        IMemento memento = new XMLMemento(document, root);
        infoFactory.saveState(memento);

        assertNull(infoFactory.createElement(memento));

        ClassInfo info = new ClassInfo(null, null, null);
        infoFactory = new InfoFactory(new AdditionalInfoAndIInfo(null, info));
        infoFactory.saveState(memento);
        assertNull(infoFactory.createElement(memento));
    }
View Full Code Here

TOP

Related Classes of com.python.pydev.analysis.actions.AdditionalInfoAndIInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.