From 4de9fc5efcc25fa1f15c901fa423e9b278e7e7f7 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 11 Sep 2015 14:31:04 +0300 Subject: [PATCH] cleanup --- .../daemon/impl/GeneralHighlightingPass.java | 2 +- .../codeInsight/daemon/impl/HighlightersRecycler.java | 7 ++++++- .../daemon/impl/HighlightingSessionImpl.java | 2 +- .../intellij/codeInsight/daemon/LineMarkerInfo.java | 2 +- .../openapi/roots/impl/OrderEnumeratorBase.java | 10 +++++----- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java index bc815fbed6e3..41b1d4ccdde4 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java @@ -66,7 +66,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass"); private static final String PRESENTABLE_NAME = DaemonBundle.message("pass.syntax"); private static final Key HAS_ERROR_ELEMENT = Key.create("HAS_ERROR_ELEMENT"); - protected static final Condition SHOULD_HIGHIGHT_FILTER = new Condition() { + static final Condition SHOULD_HIGHIGHT_FILTER = new Condition() { @Override public boolean value(PsiFile file) { return HighlightingLevelManager.getInstance(file.getProject()).shouldHighlight(file); diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightersRecycler.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightersRecycler.java index 20924c55615f..2d7dd43b0efa 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightersRecycler.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightersRecycler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,13 @@ import com.intellij.openapi.util.ProperTextRange; import com.intellij.openapi.util.TextRange; import com.intellij.util.containers.MultiMap; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; +// cache for highlighters not needed anymore. +// You call recycleHighlighter() to put unused highlighter into the cache +// and then call pickupHighlighterFromGarbageBin() (if there is a sudden need for fresh highlighter with specified offsets) to remove it from the cache to re-initialize and use. class HighlightersRecycler { private final MultiMap incinerator = MultiMap.createSmart(); @@ -32,6 +36,7 @@ class HighlightersRecycler { } } + @Nullable // null means no highlighter found in the cache RangeHighlighter pickupHighlighterFromGarbageBin(int startOffset, int endOffset, int layer){ TextRange range = new TextRange(startOffset, endOffset); Collection collection = incinerator.get(range); 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 94d69dab0a5f..892ed98e7fae 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 @@ -123,7 +123,7 @@ public class HighlightingSessionImpl implements HighlightingSession { @Override public boolean process(Info info) { final EditorColorsScheme colorsScheme = getColorsScheme(); - UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, getPsiFile(), info.myRestrictRange.getStartOffset(), + UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, getDocument(), getPsiFile(), info.myRestrictRange.getStartOffset(), info.myRestrictRange.getEndOffset(), info.myInfo, colorsScheme, info.myGroupId, myRanges2markersCache); diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerInfo.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerInfo.java index 2b2d176a9ab3..661508540fe8 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerInfo.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerInfo.java @@ -110,7 +110,7 @@ public class LineMarkerInfo { return elementRef.get(); } - public void setNavigateAction(AnAction navigateAction) { + void setNavigateAction(@NotNull AnAction navigateAction) { myNavigateAction = navigateAction; } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java index 8ecbed4a7e17..6804a12f6be5 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume customHandlers.add(handlerFactory.createHandler(module)); } } - this.myCustomHandlers = customHandlers == null ? Collections.emptyList() : customHandlers; + myCustomHandlers = customHandlers == null ? Collections.emptyList() : customHandlers; } @Override @@ -301,7 +301,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume final Module module = ((ModuleSourceOrderEntry)orderEntry).getRootModel().getModule(); return processor.process(module); } - else if (orderEntry instanceof ModuleOrderEntry && (!myRecursively || !shouldProcessRecursively())) { + if (orderEntry instanceof ModuleOrderEntry && (!myRecursively || !shouldProcessRecursively())) { final Module module = ((ModuleOrderEntry)orderEntry).getModule(); if (module != null) { return processor.process(module); @@ -414,11 +414,11 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume */ public abstract void processRootModules(@NotNull Processor processor); - private class OrderEntryProcessor implements Processor { + private static class OrderEntryProcessor implements Processor { private R myValue; private final RootPolicy myPolicy; - public OrderEntryProcessor(RootPolicy policy, R initialValue) { + private OrderEntryProcessor(RootPolicy policy, R initialValue) { myPolicy = policy; myValue = initialValue; }