EA-29860 fix NPE

This commit is contained in:
Eugene Kudelevsky
2011-09-22 20:39:48 +04:00
parent 3902a3dcaf
commit bb00588104
2 changed files with 6 additions and 4 deletions
@@ -60,12 +60,12 @@ public class XmlTagTreeHighlightingPass extends TextEditorHighlightingPass {
.createTextAttributesKey("TAG_TREE_HIGHLIGHTING_KEY"));
private final XmlFile myFile;
private final Editor myEditor;
private final EditorEx myEditor;
private final BreadcrumbsInfoProvider myInfoProvider;
private final List<Pair<TextRange, TextRange>> myPairsToHighlight = new ArrayList<Pair<TextRange, TextRange>>();
public XmlTagTreeHighlightingPass(@NotNull XmlFile file, @NotNull Editor editor) {
public XmlTagTreeHighlightingPass(@NotNull XmlFile file, @NotNull EditorEx editor) {
super(file.getProject(), editor.getDocument(), true);
myFile = file;
myEditor = editor;
@@ -257,7 +257,7 @@ public class XmlTagTreeHighlightingPass extends TextEditorHighlightingPass {
}
private Color[] toColorsForEditor(Color[] baseColors) {
final Color tagBackground = myEditor instanceof EditorEx ? ((EditorEx)myEditor).getBackgroundColor() : null;
final Color tagBackground = myEditor.getBackgroundColor();
if (tagBackground == null) {
return baseColors;
@@ -21,6 +21,7 @@ import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
@@ -40,8 +41,9 @@ public class XmlTagTreeHighlightingPassFactory extends AbstractProjectComponent
if (editor.isOneLineMode()) return null;
if (!XmlTagTreeHighlightingUtil.isTagTreeHighlightingActive(file)) return null;
if (!(editor instanceof EditorEx)) return null;
return new XmlTagTreeHighlightingPass((XmlFile)file, editor);
return new XmlTagTreeHighlightingPass((XmlFile)file, (EditorEx)editor);
}
}