This commit is contained in:
Alexey Kudravtsev
2015-09-11 14:36:01 +03:00
parent 2358fa76ea
commit 4de9fc5efc
5 changed files with 14 additions and 9 deletions
@@ -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<Boolean> HAS_ERROR_ELEMENT = Key.create("HAS_ERROR_ELEMENT");
protected static final Condition<PsiFile> SHOULD_HIGHIGHT_FILTER = new Condition<PsiFile>() {
static final Condition<PsiFile> SHOULD_HIGHIGHT_FILTER = new Condition<PsiFile>() {
@Override
public boolean value(PsiFile file) {
return HighlightingLevelManager.getInstance(file.getProject()).shouldHighlight(file);
@@ -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<TextRange, RangeHighlighter> 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<RangeHighlighter> collection = incinerator.get(range);
@@ -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);
@@ -110,7 +110,7 @@ public class LineMarkerInfo<T extends PsiElement> {
return elementRef.get();
}
public void setNavigateAction(AnAction navigateAction) {
void setNavigateAction(@NotNull AnAction navigateAction) {
myNavigateAction = navigateAction;
}
@@ -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.<OrderEnumerationHandler>emptyList() : customHandlers;
myCustomHandlers = customHandlers == null ? Collections.<OrderEnumerationHandler>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<Module> processor);
private class OrderEntryProcessor<R> implements Processor<OrderEntry> {
private static class OrderEntryProcessor<R> implements Processor<OrderEntry> {
private R myValue;
private final RootPolicy<R> myPolicy;
public OrderEntryProcessor(RootPolicy<R> policy, R initialValue) {
private OrderEntryProcessor(RootPolicy<R> policy, R initialValue) {
myPolicy = policy;
myValue = initialValue;
}