this.document = document;
//It's important that the interpreter is created in the Thread and not outside the thread (otherwise
//it may be that the output ends up being shared, which is not what we want.)
boolean useConsole = AnalysisPreferencesPage.useConsole();
IPythonInterpreter interpreter = JythonPlugin.newPythonInterpreter(useConsole, false);
if (!useConsole) {
interpreter.setErr(NullOutputStream.singleton);
interpreter.setOut(NullOutputStream.singleton);
}
String file = StringUtils.replaceAllSlashes(module.getFile().getAbsolutePath());
interpreter.set("visitor", this);
List<String> splitInLines = StringUtils.splitInLines(document.get());
interpreter.set("lines", splitInLines);
PyObject tempPep8 = pep8;
if (tempPep8 != null) {
interpreter.set("pep8", tempPep8);
} else {
interpreter.set("pep8", Py.None);
}
String formatted = com.aptana.shared_core.string.StringUtils.format(EXECUTE_PEP8, file, args.toString(),
StringUtils.replaceAllSlashes(pep8Loc.getParentFile().getAbsolutePath()), //put the parent dir of pep8.py in the pythonpath.
file);
interpreter.exec(formatted);
if (pep8 == null) {
synchronized (lock) {
if (pep8 == null) {
pep8 = interpreter.get("pep8");
}
}
}
} catch (Exception e) {