This commit is contained in:
Alexey Kudravtsev
2014-12-08 14:05:22 +03:00
parent 7c837c1c29
commit c2cfe069df
2 changed files with 5 additions and 7 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.openapi.editor.ex;
import com.intellij.openapi.editor.event.DocumentListener;
import org.jetbrains.annotations.NotNull;
import java.util.Comparator;
@@ -40,8 +41,7 @@ public interface PrioritizedDocumentListener extends DocumentListener {
return getPriority(o1) - getPriority(o2);
}
private int getPriority(Object o) {
assert o != null;
private int getPriority(@NotNull Object o) {
if (o instanceof PrioritizedDocumentListener) return ((PrioritizedDocumentListener)o).getPriority();
return Integer.MAX_VALUE;
}
@@ -58,7 +58,7 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
private final Collection<TextRange> myWriteAccessRanges = Collections.synchronizedList(new ArrayList<TextRange>());
private final int myCaretOffset;
protected IdentifierHighlighterPass(final Project project, final PsiFile file, final Editor editor) {
protected IdentifierHighlighterPass(@NotNull Project project, @NotNull PsiFile file, @NotNull Editor editor) {
super(project, editor.getDocument(), false);
myFile = file;
myEditor = editor;
@@ -91,9 +91,7 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
if (!PsiDocumentManager.getInstance(myProject).isUncommited(myEditor.getDocument())) {
// when document is committed, try to check injected stuff - it's fast
Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(myEditor, myFile, myCaretOffset);
if (injectedEditor != null) {
myTarget = TargetElementUtilBase.getInstance().findTargetElement(injectedEditor, flags, injectedEditor.getCaretModel().getOffset());
}
myTarget = TargetElementUtilBase.getInstance().findTargetElement(injectedEditor, flags, injectedEditor.getCaretModel().getOffset());
}
}