/** * Does the line contain some valid code besides of possible white space and * comments? */ public boolean isRowValid(int offset) throws BadLocationException { return Utilities.isRowWhite(getDocument(), offset); }
/** Does the line contain some valid code besides of possible white space * and comments? */ public boolean isRowValid(int offset) throws BadLocationException { return Utilities.isRowWhite(getDocument(), offset); }
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; }
private int countLinesBetweenLineOffsets(int startLineOffset, int endLineOffset) throws BadLocationException { int result = 0; for (int lineOffset = startLineOffset; lineOffset < endLineOffset; lineOffset++) { int rowStartFromLineOffset = Utilities.getRowStartFromLineOffset(baseDocument, lineOffset); if (!Utilities.isRowWhite(baseDocument, rowStartFromLineOffset) && !isJustCommentOnLine(rowStartFromLineOffset)) { result++; } } return result; }
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; }
/** Shift line either left or right */ public void shiftLine(BaseDocument doc, int dotPos, boolean right) throws BadLocationException { int ind = doc.getShiftWidth(); if (!right) { ind = -ind; } if (Utilities.isRowWhite(doc, dotPos)) { ind += Utilities.getVisualColumn(doc, dotPos); } else { ind += Utilities.getRowIndent(doc, dotPos); } ind = Math.max(ind, 0); changeRowIndent(doc, dotPos, ind); }
if (actualPrevIndent != prevIndent) { if (!(Utilities.isRowEmpty(doc, prevOffset) || Utilities.isRowWhite(doc, prevOffset))) { indent = actualPrevIndent + (indent - prevIndent); if (indent < 0) {
/** Shift line either left or right */ public void shiftLine(BaseDocument doc, int dotPos, boolean right) throws BadLocationException { int ind = doc.getShiftWidth(); if (!right) { ind = -ind; } if (Utilities.isRowWhite(doc, dotPos)) { ind += Utilities.getVisualColumn(doc, dotPos); } else { ind += Utilities.getRowIndent(doc, dotPos); } ind = Math.max(ind, 0); changeRowIndent(doc, dotPos, ind); }
if (actualPrevIndent != prevIndent) { if (!(Utilities.isRowEmpty(doc, prevOffset) || Utilities.isRowWhite(doc, prevOffset))) { indent = actualPrevIndent + (indent-prevIndent);
!Utilities.isRowWhite(baseDoc, offset)) { break; if (Utilities.isRowEmpty(baseDoc, offset) || Utilities.isRowWhite(baseDoc, offset)) { !Utilities.isRowWhite(baseDoc, offset)) { break;
if (!Utilities.isRowWhite(doc, afterPackageOffset)) { edits.replace(afterPackageOffset, 0, "\n", false, 0); } else { if (!Utilities.isRowWhite(doc, afterImportsOffset) && isLastImport(doc, fqName)) { edits.replace(afterImportsOffset, 0, "\n", false, 0);
) { int indent = Utilities.getRowIndent(doc, pos); if (Utilities.isRowWhite(doc, pos)) {
while (offset >= 0) { if (Utilities.isRowEmpty(doc, offset) || Utilities.isRowWhite(doc, offset)) { if (currentSectionOnly) { break; while (offset < length) { if (Utilities.isRowEmpty(doc, offset) || Utilities.isRowWhite(doc, offset)) { if (currentSectionOnly) { break;
for (int lineCnt = Utilities.getRowCount(doc, startPos, endPos); lineCnt > 0; lineCnt--) { int indent = Utilities.getRowIndent(doc, pos); if (Utilities.isRowWhite(doc, pos)) {
int currentOffset = offset; while (currentOffset > 0) { if (!Utilities.isRowEmpty(doc, currentOffset) && !Utilities.isRowWhite(doc, currentOffset) && !LexUtilities.isCommentOnlyLine(doc, currentOffset)) { indent = GsfUtilities.getLineIndent(doc, currentOffset);
private void comment(BaseDocument doc, int startOffset, int lineCount) throws BadLocationException { for (int offset = startOffset; lineCount > 0; lineCount--, offset = Utilities.getRowStart(doc, offset, +1)) { if (Utilities.isRowEmpty(doc, offset) || Utilities.isRowWhite(doc, offset)) { continue;
private void uncomment(BaseDocument doc, int startOffset, int lineCount) throws BadLocationException { for (int offset = startOffset; lineCount > 0; lineCount--, offset = Utilities.getRowStart(doc, offset, +1)) { if (Utilities.isRowEmpty(doc, offset) || Utilities.isRowWhite(doc, offset)) { continue;
if (Utilities.isRowEmpty(doc, next) || Utilities.isRowWhite(doc, next) || LexUtilities.isCommentOnlyLine(doc, next)) { continue;