本文整理了Java中org.netbeans.editor.Utilities.getFirstNonWhiteBwd()
方法的一些代码示例,展示了Utilities.getFirstNonWhiteBwd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.getFirstNonWhiteBwd()
方法的具体详情如下:
包路径:org.netbeans.editor.Utilities
类名称:Utilities
方法名:getFirstNonWhiteBwd
[英]Get first non-white character in document in backward direction. The character right before the character at position offset will be searched as first.
[中]向后获取文档中的第一个非白色字符。将首先搜索位置偏移处字符前面的字符。
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
/** Get first non-white character in document in backward direction.
* The character right before the character at position offset will
* be searched as first.
* @param doc document to operate on
* @param offset position in document where to start searching
* @return position of the first non-white character or -1
*/
public static int getFirstNonWhiteBwd(BaseDocument doc, int offset)
throws BadLocationException {
return getFirstNonWhiteBwd(doc, offset, 0);
}
代码示例来源:origin: net.java.abeille/abeille
/**
* Get first non-white character in document in backward direction. The
* character right before the character at position offset will be searched
* as first.
*
* @param doc
* document to operate on
* @param offset
* position in document where to start searching
* @return position of the first non-white character or -1
*/
public static int getFirstNonWhiteBwd(BaseDocument doc, int offset) throws BadLocationException {
return getFirstNonWhiteBwd(doc, offset, 0);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public static int getFirstNonWhiteRow(BaseDocument doc, int offset, boolean downDir)
throws BadLocationException {
if (isRowWhite(doc, offset)) {
if (downDir) { // search down for non-white line
offset = getFirstNonWhiteFwd(doc, offset);
} else { // search up for non-white line
offset = getFirstNonWhiteBwd(doc, offset);
}
}
return offset;
}
代码示例来源:origin: net.java.abeille/abeille
public static int getFirstNonWhiteRow(BaseDocument doc, int offset, boolean downDir) throws BadLocationException {
if (isRowWhite(doc, offset)) {
if (downDir) { // search down for non-white line
offset = getFirstNonWhiteFwd(doc, offset);
}
else { // search up for non-white line
offset = getFirstNonWhiteBwd(doc, offset);
}
}
return offset;
}
代码示例来源:origin: net.java.abeille/abeille
/**
* Get the last non-white character on the line. The document.isWhitespace()
* is used to test whether the particular character is white space or not.
*
* @param doc
* document to operate on
* @param offset
* position in document anywhere on the line
* @return position of the last non-white char on the line or -1 if there's
* no non-white character on that line.
*/
public static int getRowLastNonWhite(BaseDocument doc, int offset) throws BadLocationException {
return getFirstNonWhiteBwd(doc, doc.op.getEOL(offset), doc.op.getBOL(offset));
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
/** Get the last non-white character on the line.
* The document.isWhitespace() is used to test whether the particular
* character is white space or not.
* @param doc document to operate on
* @param offset position in document anywhere on the line
* @return position of the last non-white char on the line or -1
* if there's no non-white character on that line.
*/
public static int getRowLastNonWhite(BaseDocument doc, int offset)
throws BadLocationException {
checkOffsetValid(doc, offset);
Element lineElement = doc.getParagraphElement(offset);
return getFirstNonWhiteBwd(doc,
lineElement.getEndOffset() - 1,
lineElement.getStartOffset()
);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private int tryCountLines(Block block) throws BadLocationException {
int searchOffset = block.getStartOffset() + 1;
int firstNonWhiteFwd = Utilities.getFirstNonWhiteFwd(baseDocument, searchOffset);
int startLineOffset = Utilities.getLineOffset(baseDocument, firstNonWhiteFwd == -1 ? searchOffset : firstNonWhiteFwd);
int endLineOffset = Utilities.getLineOffset(baseDocument, Utilities.getFirstNonWhiteBwd(baseDocument, block.getEndOffset()));
return countLinesBetweenLineOffsets(startLineOffset, endLineOffset);
}
代码示例来源:origin: net.java.abeille/abeille
int startPos = Utilities.getFirstNonWhiteBwd(doc, dotPos, rsPos);
startPos = (startPos >= 0) ? (startPos + 1) : rsPos;
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
int startPos = Utilities.getFirstNonWhiteBwd(doc, dotPos, rsPos);
startPos = (startPos >= 0) ? (startPos + 1) : rsPos;
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
to = Utilities.getFirstNonWhiteBwd(doc, Utilities.getRowEnd(doc, to)) + 1;
lineSelection = true;
} catch (BadLocationException ex) {
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public int processTextBatch(BaseDocument doc, int startPos, int endPos,
boolean lastBatch) {
try {
int[] blks = getCommentBlocks(endPos, startPos);
FinderFactory.CharArrayBwdFinder cmdFinder
= new FinderFactory.CharArrayBwdFinder(COMMAND_SEPARATOR_CHARS);
int lastSeparatorOffset = findOutsideBlocks(cmdFinder, startPos, endPos, blks);
if (lastSeparatorOffset<1) return lastSeparatorOffset;
TokenID separatorID = getTokenID(lastSeparatorOffset);
if (separatorID.getNumericID() == JavaTokenContext.RBRACE_ID) {
int matchingBrkPos[] = findMatchingBlock(lastSeparatorOffset, true);
if (matchingBrkPos != null){
int prev = Utilities.getFirstNonWhiteBwd(getDocument(), matchingBrkPos[0]);
if (getTokenID(prev).getNumericID() == JavaTokenContext.RBRACKET_ID){
return getLastCommandSeparator(prev);
}
}
}
if (separatorID.getNumericID() != JavaTokenContext.LBRACE_ID &&
separatorID.getNumericID() != JavaTokenContext.RBRACE_ID &&
separatorID.getNumericID() != JavaTokenContext.SEMICOLON_ID){
lastSeparatorOffset = processTextBatch(doc, lastSeparatorOffset, 0, lastBatch);
}
return lastSeparatorOffset;
} catch (BadLocationException e) {
e.printStackTrace();
return -1;
}
}
};
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
int neOffset = Utilities.getFirstNonWhiteBwd(doc, caretOffset - 1);
Indentation result = Indentation.NONE;
if (neOffset != -1) {
内容来源于网络,如有侵权,请联系作者删除!