From bf3cea4ed528ac5bca88ee9d736eb41704701eea Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 18 Sep 2013 12:40:07 +0400 Subject: [PATCH] made fields final --- .../daemon/impl/HighlightingSessionImpl.java | 63 ++++++++++--------- ...rogressableTextEditorHighlightingPass.java | 13 ++-- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightingSessionImpl.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightingSessionImpl.java index cb7c14da4240..fe0c3f8b3db6 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightingSessionImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightingSessionImpl.java @@ -41,20 +41,23 @@ public class HighlightingSessionImpl implements HighlightingSession { @NotNull private final ProgressIndicator myProgressIndicator; private final EditorColorsScheme myEditorColorsScheme; private final int myPassId; + @NotNull private final TextRange myRestrictRange; private final Project myProject; private final Document myDocument; - private Map myRanges2markersCache; + private final Map myRanges2markersCache = new THashMap(); public HighlightingSessionImpl(@NotNull PsiFile psiFile, @Nullable Editor editor, @NotNull ProgressIndicator progressIndicator, EditorColorsScheme editorColorsScheme, - int passId) { + int passId, + @NotNull TextRange restrictRange) { myPsiFile = psiFile; myEditor = editor; myProgressIndicator = progressIndicator; myEditorColorsScheme = editorColorsScheme; myPassId = passId; + myRestrictRange = restrictRange; myProject = psiFile.getProject(); myDocument = PsiDocumentManager.getInstance(myProject).getDocument(psiFile); } @@ -97,36 +100,34 @@ public class HighlightingSessionImpl implements HighlightingSession { return myPassId; } - private TransferToEDTQueue myAddHighlighterInEDTQueue; - private TransferToEDTQueue myDisposeHighlighterInEDTQueue; - void init(@NotNull final TextRange restrictRange) { - myRanges2markersCache = new THashMap(); - Condition stopCondition = new Condition() { - @Override - public boolean value(Object o) { - return myProject.isDisposed() || getProgressIndicator().isCanceled(); - } - }; - myAddHighlighterInEDTQueue = new TransferToEDTQueue("Apply highlighting results", new Processor() { - @Override - public boolean process(HighlightInfo info) { - final EditorColorsScheme colorsScheme = getColorsScheme(); - UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, getPsiFile(), restrictRange.getStartOffset(), - restrictRange.getEndOffset(), - info, colorsScheme, Pass.UPDATE_ALL, myRanges2markersCache); + private final TransferToEDTQueue myAddHighlighterInEDTQueue = new TransferToEDTQueue("Apply highlighting results", new Processor() { + @Override + public boolean process(HighlightInfo info) { + final EditorColorsScheme colorsScheme = getColorsScheme(); + UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, getPsiFile(), myRestrictRange.getStartOffset(), + myRestrictRange.getEndOffset(), + info, colorsScheme, Pass.UPDATE_ALL, myRanges2markersCache); - return true; - } - }, stopCondition, 200); - - myDisposeHighlighterInEDTQueue = new TransferToEDTQueue("Dispose abandoned highlighter", new Processor() { - @Override - public boolean process(@NotNull RangeHighlighterEx highlighter) { - highlighter.dispose(); - return true; - } - }, stopCondition, 200); - } + return true; + } + }, new Condition() { + @Override + public boolean value(Object o) { + return myProject.isDisposed() || getProgressIndicator().isCanceled(); + } + }, 200); + private final TransferToEDTQueue myDisposeHighlighterInEDTQueue = new TransferToEDTQueue("Dispose abandoned highlighter", new Processor() { + @Override + public boolean process(@NotNull RangeHighlighterEx highlighter) { + highlighter.dispose(); + return true; + } + }, new Condition() { + @Override + public boolean value(Object o) { + return myProject.isDisposed() || getProgressIndicator().isCanceled(); + } + }, 200); void queueHighlightInfo(@NotNull HighlightInfo info) { myAddHighlighterInEDTQueue.offer(info); diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ProgressableTextEditorHighlightingPass.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ProgressableTextEditorHighlightingPass.java index 4719ecbbced5..f5a264403c78 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ProgressableTextEditorHighlightingPass.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ProgressableTextEditorHighlightingPass.java @@ -62,14 +62,13 @@ public abstract class ProgressableTextEditorHighlightingPass extends TextEditorH @NotNull private HighlightingSession sessionCreated(@NotNull TextRange restrictRange, - @NotNull PsiFile file, - @Nullable Editor editor, - @NotNull ProgressIndicator progress, - EditorColorsScheme scheme, - int passId) { - HighlightingSessionImpl impl = new HighlightingSessionImpl(file, editor, progress, scheme, passId); + @NotNull PsiFile file, + @Nullable Editor editor, + @NotNull ProgressIndicator progress, + EditorColorsScheme scheme, + int passId) { + HighlightingSessionImpl impl = new HighlightingSessionImpl(file, editor, progress, scheme, passId, restrictRange); myHighlightingSession = impl; - impl.init(restrictRange); return impl; }