Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2013-01-21 14:22:53 +0000
committerDani Megert2013-01-21 14:22:53 +0000
commit37fc661b8f9314c53d23aa84ca144fd52d6b9dfe (patch)
tree9bbab89c8a869a27a02b6c31fbe754c4c36a6e7a
parent04e4e8f2ecebb2ac30f47f98f07693715c2c6686 (diff)
downloadeclipse.platform.text-37fc661b8f9314c53d23aa84ca144fd52d6b9dfe.tar.gz
eclipse.platform.text-37fc661b8f9314c53d23aa84ca144fd52d6b9dfe.tar.xz
eclipse.platform.text-37fc661b8f9314c53d23aa84ca144fd52d6b9dfe.zip
Fixed bug 391905: [painting] Editor highlights empty space as bracketv20130121-142253
match
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java44
1 files changed, 4 insertions, 40 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
index 666cc3012b2..d65e70a8680 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPaintPositionManager;
import org.eclipse.jface.text.IPainter;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextInputListener;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.Position;
@@ -83,13 +82,6 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
private boolean fCharacterPresentAtCaretLocation;
/**
- * The document this painter is associated with, or <code>null</code>.
- *
- * @since 3.8
- */
- private IDocument fDocument;
-
- /**
* The previous selection, used to determine the need for computing enclosing brackets.
*
* @since 3.8
@@ -104,13 +96,6 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
private int fPreviousLengthOfDocument;
/**
- * Whether the input document has been replaced or not.
- *
- * @since 3.8
- */
- private boolean fDocumentChanged;
-
- /**
* The text viewer change listener.
*
* @since 3.8
@@ -129,7 +114,6 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
fSourceViewer= sourceViewer;
fMatcher= matcher;
fTextWidget= sourceViewer.getTextWidget();
- fDocument= fSourceViewer.getDocument();
}
/**
@@ -323,7 +307,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
*/
public void paint(int reason) {
- IDocument document= fDocument;
+ IDocument document= fSourceViewer.getDocument();
if (document == null) {
deactivate(false);
return;
@@ -343,7 +327,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
boolean lengthChanged= length != fPreviousLengthOfDocument;
fPreviousLengthOfDocument= length;
- if (reason != IPainter.CONFIGURATION && !fDocumentChanged && !lengthChanged && selection.equals(fPreviousSelection)) {
+ if (reason != IPainter.CONFIGURATION && fSourceViewer.getDocument() == document && !lengthChanged && selection.equals(fPreviousSelection)) {
return;
}
@@ -352,7 +336,6 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
return;
}
- fDocumentChanged= false;
if (reason != IPainter.CONFIGURATION && !lengthChanged && fPreviousSelection != null && reason != IPainter.INTERNAL) {
if (!matcher.isRecomputationOfEnclosingPairRequired(document, selection, fPreviousSelection)) {
if (fCharacterPresentAtCaretLocation && !fHighlightCharacterAtCaretLocation) {
@@ -441,11 +424,9 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
if (install) {
fTextListener= new TextListener();
- fSourceViewer.addTextInputListener(fTextListener);
fSourceViewer.addTextListener(fTextListener);
} else {
if (fTextListener != null) {
- fSourceViewer.removeTextInputListener(fTextListener);
fSourceViewer.removeTextListener(fTextListener);
fTextListener= null;
}
@@ -458,24 +439,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
*
* @since 3.8
*/
- private class TextListener implements ITextListener, ITextInputListener {
-
- /**
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- fDocument= null;
- }
-
- /**
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- fDocument= newInput;
- fDocumentChanged= true;
- }
+ private class TextListener implements ITextListener {
/**
* @see org.eclipse.jface.text.ITextListener#textChanged(org.eclipse.jface.text.TextEvent)

Back to the top