public static Token getToken(Buffer buffer, int caret, DefaultTokenHandler tokens) { int offset = caret; offset -= buffer.getLineStartOffset(buffer.getLineOfOffset(caret)); if(offset != 0) offset--; Token token = TextUtilities.getTokenAtOffset(tokens.getTokens(), offset); return token;
public static Token getToken(Buffer buffer, int caret) { DefaultTokenHandler tokens = getTokens(buffer, caret); return getToken(buffer, caret, tokens);
    public static Token getToken(Buffer buffer, int caret, DefaultTokenHandler tokens) {        int offset = caret;        offset -= buffer.getLineStartOffset(buffer.getLineOfOffset(caret));        if(offset != 0)            offset--;        Token token = TextUtilities.getTokenAtOffset(tokens.getTokens(), offset);        return token;    }