cache classes and files in console exception filter

This commit is contained in:
peter
2014-02-04 15:27:16 +01:00
parent 0898580c85
commit 906efb7909
5 changed files with 116 additions and 55 deletions
@@ -39,16 +39,17 @@ import java.util.Map;
* @author gregsh
*/
public class ExceptionExFilterFactory implements ExceptionFilterFactory {
@NotNull
@Override
public Filter create(GlobalSearchScope searchScope) {
public Filter create(@NotNull GlobalSearchScope searchScope) {
return new MyFilter(searchScope);
}
private static class MyFilter implements Filter, FilterMixin {
private final GlobalSearchScope myScope;
private final ExceptionInfoCache myCache;
public MyFilter(@NotNull final GlobalSearchScope scope) {
myScope = scope;
myCache = new ExceptionInfoCache(scope);
}
public Result applyFilter(final String line, final int textEndOffset) {
@@ -68,7 +69,7 @@ public class ExceptionExFilterFactory implements ExceptionFilterFactory {
Map<String, Trinity<TextRange, TextRange, TextRange>> visited = new THashMap<String, Trinity<TextRange, TextRange, TextRange>>();
final Trinity<TextRange, TextRange, TextRange> emptyInfo = Trinity.create(null, null, null);
final ExceptionWorker worker = new ExceptionWorker(myScope.getProject(), myScope);
final ExceptionWorker worker = new ExceptionWorker(myCache);
for (int i = 0; i < copiedFragment.getLineCount(); i++) {
final int lineStartOffset = copiedFragment.getLineStartOffset(i);
final int lineEndOffset = copiedFragment.getLineEndOffset(i);
@@ -20,14 +20,14 @@ import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
public class ExceptionFilter implements Filter, DumbAware {
private final GlobalSearchScope myScope;
private final ExceptionInfoCache myCache;
public ExceptionFilter(@NotNull final GlobalSearchScope scope) {
myScope = scope;
myCache = new ExceptionInfoCache(scope);
}
public Result applyFilter(final String line, final int textEndOffset) {
ExceptionWorker worker = new ExceptionWorker(myScope.getProject(), myScope);
ExceptionWorker worker = new ExceptionWorker(myCache);
worker.execute(line, textEndOffset);
return worker.getResult();
}