// call refresh to ensure the project interpreter is validated properly
refresh(project, commandLine);
String dotPydevProject = project.getFile(PYDEVPROJECT)
.getRawLocation().toOSString();
FileOffsets offsets = FileOffsets.compile(dotPydevProject);
String contents = IOUtils.toString(new FileInputStream(dotPydevProject));
Tuple<List<ProjectConfigError>, IInterpreterInfo> configErrorsAndInfo =
nature.getConfigErrorsAndInfo(project);
ArrayList<Error> errors = new ArrayList<Error>();
for (ProjectConfigError e : configErrorsAndInfo.o1){
String message = e.getLabel();
int line = 1;
int col = 1;
// attempt to locate the line the error occurs on.
for (Pattern pattern : new Pattern[]{NOT_FOUND, INVALID}){
Matcher matcher = pattern.matcher(message);
// extract the value that is triggering the error (path, interpreter
// name, etc.).
String value = null;
if (matcher.find()){
value = matcher.group(1).trim();
matcher = Pattern
.compile(">\\s*(\\Q" + value + "\\E)\\b", Pattern.MULTILINE)
.matcher(contents);
if(matcher.find()){
int[] position = offsets.offsetToLineColumn(matcher.start(1));
line = position[0];
col = position[1];
}
break;
}