public int [] findMatches() throws InterruptedException, BadLocationException {
((AbstractDocument) context.getDocument()).readLock();
try {
BaseDocument doc = (BaseDocument) context.getDocument();
int offset = context.getSearchOffset();
char[] origin = doc.getChars(offset, 1);
if (isRhtmlStartTag(doc, offset, origin)) {
int limit = doc.getText().length();
int matching = matchChar(doc, offset, limit, '>');
while (matching != -1 && doc.getChars(matching - 1, 1)[0] == '=') {
matching = matchChar(doc, matching + 1, limit, '>');
}
return new int[] {matching, matching + 1};
} else if (isRhtmlEndTag(doc, offset, origin)) {
int limit = 0;
int matching = matchChar(doc, offset, limit, '<');
if (matching != -1) {
return new int[] {matching, matching + 1};
}
}
} finally {
((AbstractDocument) context.getDocument()).readUnlock();
}
return delegate.findMatches();
}