private JavaSourceDocument getDocument(SourceLineAnnotation source) {
try {
SourceFile sourceFile = frame.getProject().getSourceFinder().findSourceFile(source);
String fullFileName = sourceFile.getFullFileName();
SoftReference<JavaSourceDocument> resultReference = map.get(fullFileName);
JavaSourceDocument result = null;
if (resultReference != null) {
result = resultReference.get();
}
if (result != null) {
return result;
}
try {
InputStream in = sourceFile.getInputStream();
result = new JavaSourceDocument(source.getClassName(), SourceCharset.bufferedReader(in), sourceFile);
} catch (Exception e) {
result = JavaSourceDocument.UNKNOWNSOURCE;
Debug.println(e); // e.printStackTrace();
}
map.put(fullFileName, new SoftReference<JavaSourceDocument>(result));