Bug 26314 Goto Matching Bracket bug with selection
20021113 1. In this code action.setChecked(elements[i].equals(fHierarchyView.getInputElement())); select the last bracket with a selection of length 1. 2. press ctrl + shift + P 3. wrong bracket is matched
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
} else {
			
			setStatusLineErrorMessage(null);
			
		}
	}
	/**
	 * Jumps to the matching bracket.
	 */
	public void gotoMatchingBracket() {
		if (fBracketMatcher == null)
			fBracketMatcher= new JavaPairMatcher(new char[] { '{', '}', '(', ')', '[', ']' });
		ISourceViewer sourceViewer= getSourceViewer();
		IDocument document= sourceViewer.getDocument();
		if (document == null)
			return;
		
		ISelectionProvider provider= getSelectionProvider();
		ITextSelection selection= (ITextSelection) provider.getSelection();
		int selectionLength= Math.abs(selection.getLength());
		if (selectionLength > 1) {
			setStatusLineErrorMessage(JavaEditorMessages.getString("GotoMatchingBracket.error.invalidSelection"));			
			sourceViewer.getTextWidget().getDisplay().beep();
			return;
		}
		IRegion region= fBracketMatcher.match(document, selection.getOffset());
		if (region == null) {
			setStatusLineErrorMessage(JavaEditorMessages.getString("GotoMatchingBracket.error.noMatchingBracket"));			
			sourceViewer.getTextWidget().getDisplay().beep();
			return;