public int [] findOrigin() throws InterruptedException, BadLocationException { return delegate.findOrigin(); }
private int [] defaultFindOrigin(MatcherContext context) throws InterruptedException, BadLocationException { defaultMatcher = BracesMatcherSupport.defaultMatcher(context, -1, -1); return defaultMatcher.findOrigin(); }
private static int matchChar(Document document, int offset, int limit, char matching) throws BadLocationException { boolean backward = limit < offset; int lookahead = backward ? offset - limit : limit - offset; if (backward) { // check the character at the left from the caret Segment text = new Segment(); document.getText(offset - lookahead, lookahead, text); for (int i = lookahead - 1; i >= 0; i--) { if (MatcherContext.isTaskCanceled()) { return -1; } if (matching == text.array[text.offset + i]) { return offset - (lookahead - i); } } } else { // check the character at the right from the caret Segment text = new Segment(); document.getText(offset, lookahead, text); for (int i = 0; i < lookahead; i++) { if (MatcherContext.isTaskCanceled()) { return -1; } if (matching == text.array[text.offset + i]) { return offset + i; } } } return -1; }
public int [] findOrigin() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); ((AbstractDocument) context.getDocument()).readUnlock();
@Override public int[] findOrigin() throws BadLocationException, InterruptedException { ((AbstractDocument) context.getDocument()).readLock(); try { int [] origin = BracesMatcherSupport.findChar( context.getDocument(), context.getSearchOffset(), context.getLimitOffset(), PAIRS ); backward = origin[2] < 0; TokenHierarchy<Document> th = TokenHierarchy.get(context.getDocument()); sequences = th.embeddedTokenSequences(originOffset, backward); if (!sequences.isEmpty()) { ((AbstractDocument) context.getDocument()).readUnlock();
public int[] findOrigin() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { Language language = null; TokenHierarchy<Document> th = TokenHierarchy.get(context.getDocument()); int caretOffset = context.getSearchOffset(); boolean searchBack = context.isSearchingBackward(); List<TokenSequence<?>> sequences = th.embeddedTokenSequences(caretOffset, searchBack); seqEnd = context.getDocument().getLength(); while(moveTheSequence(seq, searchBack, context.getLimitOffset())) { tokenText = seq.token().text().toString(); trimedTokenText = tokenText.trim(); ((AbstractDocument) context.getDocument()).readUnlock();
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(); }
@Override public int[] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { TokenSequence<?> seq = getTokenSequence(); int offset = BracesMatcherSupport.matchChar( context.getDocument(), backward ? originOffset : originOffset + 1, backward ? seq.offset() : seq.offset() + seq.token().length(), ((AbstractDocument) context.getDocument()).readUnlock();
public int[] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { return defaultMatcher.findMatches(); ((AbstractDocument) context.getDocument()).readUnlock();
public int [] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); ((AbstractDocument) context.getDocument()).readUnlock();
public int[] findOrigin() throws BadLocationException, InterruptedException { ((AbstractDocument) context.getDocument()).readLock(); try { int [] origin = BracesMatcherSupport.findChar( context.getDocument(), context.getSearchOffset(), context.getLimitOffset(), PAIRS ); backward = origin[2] < 0; TokenHierarchy<Document> th = TokenHierarchy.get(context.getDocument()); sequences = th.embeddedTokenSequences(originOffset, backward); if (!sequences.isEmpty()) { ((AbstractDocument) context.getDocument()).readUnlock();
public int[] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { TokenSequence<?> seq = getTokenSequence(); if (seq.moveNext()) { if (seq.token().id() == FortranTokenId.STRING_LITERAL) { int offset = BracesMatcherSupport.matchChar( context.getDocument(), backward ? originOffset : originOffset + 1, backward ? seq.offset() : seq.offset() + seq.token().length(), ((AbstractDocument) context.getDocument()).readUnlock();
@Override public int [] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); ((AbstractDocument) context.getDocument()).readUnlock();
public int [] findMatches() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); ((AbstractDocument) context.getDocument()).readUnlock();
@Override public int [] findOrigin() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); ((AbstractDocument) context.getDocument()).readUnlock();
public int [] findOrigin() throws InterruptedException, BadLocationException { ((AbstractDocument) context.getDocument()).readLock(); try { BaseDocument doc = (BaseDocument) context.getDocument(); int offset = context.getSearchOffset(); TokenSequence<?extends RubyTokenId> ts = LexUtilities.getRubyTokenSequence(doc, offset); ((AbstractDocument) context.getDocument()).readUnlock();