annotate stacktrace: turned off by default. check before async start

This commit is contained in:
irengrig
2011-08-08 23:00:48 +04:00
parent 48feeb3f4f
commit d7ec75e65e
5 changed files with 21 additions and 4 deletions
@@ -54,10 +54,12 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
private final Project myProject;
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.contentAnnotation.VcsContentAnnotationExceptionFilter");
private final GlobalSearchScope myScope;
private final VcsContentAnnotationSettings mySettings;
public VcsContentAnnotationExceptionFilter(GlobalSearchScope scope) {
myScope = scope;
myProject = scope.getProject();
mySettings = VcsContentAnnotationSettings.getInstance(myProject);
}
private static class MyAdditionalHighlight extends AdditionalHighlight {
@@ -81,6 +83,11 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
}
}
@Override
public boolean shouldRunHeavy() {
return mySettings.isShow();
}
@Override
public void applyHeavyFilter(final Document copiedFragment,
int startOffset,
@@ -51,6 +51,14 @@ public class CompositeFilter implements Filter, FilterMixin {
return null;
}
@Override
public boolean shouldRunHeavy() {
for (Filter filter : myFilters) {
if (filter instanceof FilterMixin && ((FilterMixin)filter).shouldRunHeavy()) return true;
}
return false;
}
@Override
public void applyHeavyFilter(Document copiedFragment,
int startOffset,
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.Nullable;
* Time: 4:50 PM
*/
public interface FilterMixin {
boolean shouldRunHeavy();
@Nullable
void applyHeavyFilter(Document copiedFragment, int startOffset, int startLineNumber, Consumer<AdditionalHighlight> consumer);
@@ -823,7 +823,7 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data
myHyperlinks.highlightHyperlinks(myCustomFilter, myPredefinedMessageFilter, line1, endLine);
}
if (myPredefinedMessageFilter.isAnyHeavy()) {
if (myPredefinedMessageFilter.isAnyHeavy() && myPredefinedMessageFilter.shouldRunHeavy()) {
final int startLine = Math.max(0, line1);
final Document document = getEditor().getDocument();
@@ -837,6 +837,7 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data
myHeavyAlarm.addRequest(new Runnable() {
@Override
public void run() {
if (! myPredefinedMessageFilter.shouldRunHeavy()) return;
myPredefinedMessageFilter.applyHeavyFilter(documentCopy, startOffset, startLine, new Consumer<FilterMixin.AdditionalHighlight>() {
@Override
public void consume(final FilterMixin.AdditionalHighlight additionalHighlight) {
@@ -45,7 +45,7 @@ public class VcsContentAnnotationSettings implements PersistentStateComponent<Vc
}
public static class State {
public boolean myShow = true;
public boolean myShow1 = false;
public long myLimit;
}
@@ -72,10 +72,10 @@ public class VcsContentAnnotationSettings implements PersistentStateComponent<Vc
}
public boolean isShow() {
return myState.myShow;
return myState.myShow1;
}
public void setShow(final boolean value) {
myState.myShow = value;
myState.myShow1 = value;
}
}