summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Azad2012-02-08 04:54:29 (EST)
committerDani Megert2012-02-08 04:54:29 (EST)
commit345ebc8ae2e73a08ac5d390790bdb6d33f0d4f1a (patch)
tree4f5f19ce636bc3b9e798a47a233d857ed8bfda8f
parent38a9f9250543744fc04ae88b4dec86d9a2243b6b (diff)
downloadeclipse.jdt.ui-345ebc8ae2e73a08ac5d390790bdb6d33f0d4f1a.zip
eclipse.jdt.ui-345ebc8ae2e73a08ac5d390790bdb6d33f0d4f1a.tar.gz
eclipse.jdt.ui-345ebc8ae2e73a08ac5d390790bdb6d33f0d4f1a.tar.bz2
Fixed bug 9503: Brace and parenthesis matching is one-off
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java4
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaPairMatcher.java11
2 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
index de0d07b..94d847e 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -3667,7 +3667,7 @@ public abstract class JavaEditor extends AbstractDecoratedTextEditor implements
int anchor= fBracketMatcher.getAnchor();
// http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
- int targetOffset= (ICharacterPairMatcher.RIGHT == anchor) ? offset + 1: offset + length;
+ int targetOffset= (ICharacterPairMatcher.RIGHT == anchor) ? offset + 1 : offset + length - 1;
boolean visible= false;
if (sourceViewer instanceof ITextViewerExtension5) {
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaPairMatcher.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaPairMatcher.java
index 7e99ac5..602e2ed 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaPairMatcher.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaPairMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -34,7 +34,7 @@ public final class JavaPairMatcher extends DefaultCharacterPairMatcher implement
public JavaPairMatcher(char[] pairs) {
- super(pairs, IJavaPartitions.JAVA_PARTITIONING);
+ super(pairs, IJavaPartitions.JAVA_PARTITIONING, true);
}
/* @see ICharacterPairMatcher#match(IDocument, int) */
@@ -53,13 +53,14 @@ public final class JavaPairMatcher extends DefaultCharacterPairMatcher implement
private IRegion performMatch(IDocument document, int offset) throws BadLocationException {
if (offset < 0 || document == null) return null;
final char prevChar= document.getChar(Math.max(offset - 1, 0));
- if ((prevChar == '<' || prevChar == '>') && !fHighlightAngularBrackets)
+ final char currChar= document.getChar(offset);
+ if ((prevChar == '<' || currChar == '>') && !fHighlightAngularBrackets)
return null;
if (prevChar == '<' && isLessThanOperator(document, offset - 1))
return null;
final IRegion region= super.match(document, offset);
if (region == null) return region;
- if (prevChar == '>') {
+ if (currChar == '>') {
final int peer= region.getOffset();
if (isLessThanOperator(document, peer)) return null;
}
@@ -75,7 +76,7 @@ public final class JavaPairMatcher extends DefaultCharacterPairMatcher implement
* @param offset an offset within the document
* @return true if the character at the specified offset is not
* a type parameter start bracket
- * @throws BadLocationException
+ * @throws BadLocationException if offset is invalid in the document
*/
private boolean isLessThanOperator(IDocument document, int offset) throws BadLocationException {
if (offset < 0) return false;