use of org.python.pydev.shared_core.preferences.InMemoryEclipsePreferences in project Pydev by fabioz.
the class CodeFoldingSetterTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
DEBUG = false;
preferences = new InMemoryEclipsePreferences();
CodeFoldingSetter.setPreferences(preferences);
setAllOptions(false);
}
use of org.python.pydev.shared_core.preferences.InMemoryEclipsePreferences in project Pydev by fabioz.
the class PyParserEditorIntegrationTest method testChangeInput.
public void testChangeInput() throws Exception {
IEclipsePreferences preferences = new InMemoryEclipsePreferences();
PyParserManager pyParserManager = PyParserManager.getPyParserManager(preferences);
Document doc = new Document();
PydevFileEditorInputStub input1 = new PydevFileEditorInputStub();
PydevFileEditorInputStub input2 = new PydevFileEditorInputStub();
// create them with the same input
PyEditStub pyEdit1 = new PyEditStub(doc, input1);
PyEditStub pyEdit2 = new PyEditStub(doc, input2);
pyParserManager.attachParserTo(pyEdit1);
pyParserManager.attachParserTo(pyEdit2);
assertEquals(2, pyParserManager.getParsers().size());
pyEdit2.setInput(input1);
pyParserManager.attachParserTo(pyEdit2);
assertEquals(1, pyParserManager.getParsers().size());
// different input
pyEdit2.setInput(input2);
pyParserManager.attachParserTo(pyEdit2);
assertEquals(2, pyParserManager.getParsers().size());
pyParserManager.notifyEditorDisposed(pyEdit1);
pyParserManager.notifyEditorDisposed(pyEdit2);
assertEquals(0, pyParserManager.getParsers().size());
}
use of org.python.pydev.shared_core.preferences.InMemoryEclipsePreferences in project Pydev by fabioz.
the class PyParserEditorIntegrationTest method testIntegration.
public void testIntegration() throws Exception {
IEclipsePreferences preferences = new InMemoryEclipsePreferences();
PyParserManager pyParserManager = PyParserManager.getPyParserManager(preferences);
Document doc = new Document();
PyEditStub pyEdit = new PyEditStub(doc, new PydevFileEditorInputStub());
pyParserManager.attachParserTo(pyEdit);
checkParserChanged(pyEdit, 1);
doc.replace(0, 0, "\r\ntest");
checkParserChanged(pyEdit, 2);
pyParserManager.attachParserTo(pyEdit);
checkParserChanged(pyEdit, 3);
// after this change, only 1 reparse should be asked, as the editor and doc is the same
doc.replace(0, 0, "\r\ntest");
checkParserChanged(pyEdit, 4);
pyParserManager.notifyEditorDisposed(pyEdit);
// after this change, only 1 reparse should be asked, as the editor and doc is the same
doc.replace(0, 0, "\r\ntest");
waitABit();
assertEquals(4, pyEdit.parserChanged);
assertEquals(0, pyParserManager.getParsers().size());
}
use of org.python.pydev.shared_core.preferences.InMemoryEclipsePreferences in project Pydev by fabioz.
the class InterpreterManagerTest method testInterpreterManager.
public void testInterpreterManager() throws Exception {
Collection<String> pythonpath = new ArrayList<String>();
pythonpath.add(TestDependent.PYTHON2_LIB);
pythonpath.add(TestDependent.PYTHON2_SITE_PACKAGES);
IEclipsePreferences prefs = new InMemoryEclipsePreferences();
String interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON2_EXE, pythonpath).toString();
prefs.put(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);
PythonInterpreterManager manager = new PythonInterpreterManager(prefs);
checkSameInterpreterInfo(manager);
manager.clearCaches();
InterpreterInfo info = checkSameInterpreterInfo(manager);
pythonpath = new ArrayList<String>();
pythonpath.add(TestDependent.PYTHON2_LIB);
pythonpath.add(TestDependent.PYTHON2_SITE_PACKAGES);
pythonpath.add(additionalPythonpathEntry.toString());
interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON2_EXE, pythonpath).toString();
prefs.put(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);
info = checkSameInterpreterInfo(manager);
}
use of org.python.pydev.shared_core.preferences.InMemoryEclipsePreferences in project Pydev by fabioz.
the class ParameterCompletionTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CompiledModule.COMPILED_MODULES_ENABLED = false;
useOriginalRequestCompl = true;
participant = new CtxParticipant();
ExtensionHelper.testingParticipants = new HashMap<String, List<Object>>();
ArrayList<Object> participants = new ArrayList<Object>();
/*IPyDevCompletionParticipant*/
participants.add(participant);
ExtensionHelper.testingParticipants.put(ExtensionHelper.PYDEV_COMPLETION, participants);
codeCompletion = new PyCodeCompletion();
this.restorePythonPath(false);
final IEclipsePreferences prefs = new InMemoryEclipsePreferences();
PyCodeCompletionPreferences.getPreferencesForTests = () -> prefs;
prefs.putBoolean(PyCodeCompletionPreferences.MATCH_BY_SUBSTRING_IN_CODE_COMPLETION, false);
}
Aggregations