}
}
- //private static void stripWarningsCoveredByErrors(final Project project, IntervalTree<HighlightInfo> highlights, MarkupModel markup) {
- // final SeverityRegistrar severityRegistrar = SeverityRegistrar.getInstance(project);
- //
- // final Set<HighlightInfo> currentErrors = new THashSet<HighlightInfo>();
- // final Set<HighlightInfo> covered = new THashSet<HighlightInfo>();
- //
- //
- // final PriorityQueue<HighlightInfo> ends = new PriorityQueue<HighlightInfo>(1, new Comparator<HighlightInfo>() {
- // public int compare(HighlightInfo o1, HighlightInfo o2) {
- // return o1.getActualEndOffset() - o2.getActualEndOffset();
- // }
- // });
- // highlights.process(new Processor<HighlightInfo>() {
- // public boolean process(HighlightInfo info) {
- // int startOffset = info.getActualStartOffset();
- //
- // for (HighlightInfo nearestEnd = ends.peek(); nearestEnd != null && nearestEnd.getActualEndOffset() <= startOffset; nearestEnd = ends.peek()) {
- // currentErrors.remove(nearestEnd);
- // Interval t = ends.poll();
- // assert t == nearestEnd;
- // }
- //
- // boolean isError = severityRegistrar.compare(HighlightSeverity.ERROR, info.getSeverity()) <= 0;
- // if (isError) {
- // currentErrors.add(info);
- // }
- // else {
- // if (info.getSeverity().myVal > 0) {
- // // warning, check for everlaps
- // for (HighlightInfo error : currentErrors) {
- // if (isCoveredBy(info, error)) {
- // covered.add(info);
- // }
- // }
- // }
- // }
- // ends.add(info);
- //
- // return true;
- // }
- // });
- //
- // for (HighlightInfo warning : covered) {
- // highlights.remove(warning);
- //
- // RangeHighlighter highlighter = warning.highlighter;
- // if (highlighter != null) {
- // markup.removeHighlighter(highlighter);
- // }
- // }
- //}
-
static boolean isCoveredBy(HighlightInfo info, HighlightInfo coveredBy) {
return coveredBy.startOffset <= info.startOffset && info.endOffset <= coveredBy.endOffset && info.getGutterIconRenderer() == null;
}
import java.awt.*;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
public class TrafficLightRenderer implements ErrorStripeRenderer {
public static class DaemonCodeAnalyzerStatus {
public boolean errorAnalyzingFinished; // all passes done
- public final List<ProgressableTextEditorHighlightingPass> passStati = new ArrayList<ProgressableTextEditorHighlightingPass>();
+ public List<ProgressableTextEditorHighlightingPass> passStati = Collections.emptyList();
public String[/*rootsNumber*/] noHighlightingRoots;
public String[/*rootsNumber*/] noInspectionRoots;
public int[] errorCount = ArrayUtil.EMPTY_INT_ARRAY;
+ public boolean enabled = true;
public int rootsNumber;
public String toString() {
status.rootsNumber = roots.length;
fillDaemonCodeAnalyzerErrorsStatus(status, fillErrorsCount, severityRegistrar);
List<TextEditorHighlightingPass> passes = myDaemonCodeAnalyzer.getPassesToShowProgressFor(myDocument);
+ status.passStati = passes.isEmpty() ? Collections.<ProgressableTextEditorHighlightingPass>emptyList() :
+ new ArrayList<ProgressableTextEditorHighlightingPass>(passes.size());
for (TextEditorHighlightingPass tepass : passes) {
if (!(tepass instanceof ProgressableTextEditorHighlightingPass)) continue;
ProgressableTextEditorHighlightingPass pass = (ProgressableTextEditorHighlightingPass)tepass;
status.passStati.add(pass);
}
status.errorAnalyzingFinished = myDaemonCodeAnalyzer.isAllAnalysisFinished(myFile);
+ status.enabled = myDaemonCodeAnalyzer.isUpdateByTimerEnabled();
return status;
}
if (status == null) {
return NO_ICON;
}
- if (status.noHighlightingRoots != null && status.noHighlightingRoots.length == status.rootsNumber) {
+ if (!status.enabled || status.noHighlightingRoots != null && status.noHighlightingRoots.length == status.rootsNumber) {
return NO_ANALYSIS_ICON;
}
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.DaemonBundle;
-import com.intellij.codeInsight.hint.LineTooltipRenderer;
import com.intellij.ide.PowerSaveMode;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.editor.Editor;
fakeStatusLargeEnough.errorCount = new int[]{1,1,1,1};
Project project = trafficLightRenderer.getProject();
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
+ fakeStatusLargeEnough.passStati = new ArrayList<ProgressableTextEditorHighlightingPass>();
for (int i=0; i<3;i++) {
fakeStatusLargeEnough.passStati.add(new ProgressableTextEditorHighlightingPass(project, null, DaemonBundle.message("pass.wolf"), psiFile, false) {
@Override
statistics.setText("");
return;
}
+ if (!status.enabled) {
+ statusLabel.setText("Code analysis has been suspended.");
+ passStatuses.setVisible(false);
+ statistics.setText("");
+ return;
+ }
if (status.noHighlightingRoots != null && status.noHighlightingRoots.length == status.rootsNumber) {
statusLabel.setText(DaemonBundle.message("analysis.hasnot.been.run"));
passStatuses.setVisible(false);