public void testSourceLocator() throws Exception {
final Boolean[] called = new Boolean[] { false };
final IPath madeUpPath = mod1.getLocation().append("inexistent");
PySourceLocatorBase locator = new PySourceLocatorBase() {
@Override
protected IEditorInput selectFilesystemFileForPath(IPath path) {
called[0] = true;
assertEquals(path, madeUpPath);
return PydevFileEditorInput.create(new File(path.removeLastSegments(1).toOSString()), true);
}
};
IEditorInput editorInput = locator.createEditorInput(madeUpPath);
assertTrue(editorInput != null);
assertTrue(called[0]);
called[0] = false;
editorInput = locator.createEditorInput(madeUpPath);
assertTrue(!called[0]);
assertTrue(editorInput != null);
PySourceLocatorPrefs.setIgnorePathTranslation(madeUpPath);
editorInput = locator.createEditorInput(madeUpPath);
assertTrue(!called[0]);
assertTrue(editorInput == null);
}