Skip to content

Commit b4204ec

Browse files
committed
Utilities::getRowCount -> LineDocumentUtils::getLineCount
1 parent 3b96e3b commit b4204ec

File tree

13 files changed

+20
-24
lines changed

13 files changed

+20
-24
lines changed

enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/EmbeddedSectionsHighlighting.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.netbeans.api.lexer.TokenHierarchyListener;
3838
import org.netbeans.api.lexer.TokenSequence;
3939
import org.netbeans.editor.BaseDocument;
40-
import org.netbeans.editor.Utilities;
4140
import org.netbeans.lib.editor.util.swing.DocumentUtilities;
4241
import org.netbeans.spi.editor.highlighting.HighlightsLayer;
4342
import org.netbeans.spi.editor.highlighting.HighlightsLayerFactory;
@@ -200,7 +199,7 @@ public boolean moveNext() {
200199
}
201200

202201
// adjust the sections end to the end of the last line
203-
int lines = Utilities.getRowCount((BaseDocument) document);
202+
int lines = LineDocumentUtils.getLineCount((BaseDocument) document);
204203
int lastLineEndOffset;
205204
if (endLine + 1 < lines) {
206205
lastLineEndOffset = LineDocumentUtils.getLineStartFromIndex((BaseDocument) document, endLine + 1);

groovy/groovy.gsp/src/org/netbeans/modules/groovy/gsp/editor/embedding/EmbeddedSectionsHighlighting.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.netbeans.api.lexer.TokenHierarchyListener;
3737
import org.netbeans.api.lexer.TokenSequence;
3838
import org.netbeans.editor.BaseDocument;
39-
import org.netbeans.editor.Utilities;
4039
import org.netbeans.lib.editor.util.swing.DocumentUtilities;
4140
import org.netbeans.modules.groovy.gsp.lexer.GspLexerLanguage;
4241
import org.netbeans.modules.groovy.gsp.lexer.GspTokenId;
@@ -188,7 +187,7 @@ public boolean moveNext() {
188187
}
189188

190189
// adjust the sections end to the end of the last line
191-
int lines = Utilities.getRowCount((BaseDocument) document);
190+
int lines = LineDocumentUtils.getLineCount((BaseDocument) document);
192191
int lastLineEndOffset;
193192
if (endLine + 1 < lines) {
194193
lastLineEndOffset = LineDocumentUtils.getLineStartFromIndex((BaseDocument) document, endLine + 1);

ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/LineNumbersActionsBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ protected void paintComponent(Graphics gr) {
404404
int yOffset;
405405
int localLineHeight = rec.height;
406406
int linesDrawn = clip.height / localLineHeight + 4; // draw past clipping rectangle to avoid partially drawn numbers
407-
int docLines = Utilities.getRowCount((BaseDocument) master.getEditorPane().getDocument());
407+
int docLines = LineDocumentUtils.getLineCount((BaseDocument) master.getEditorPane().getDocument());
408408
if (lineNumber + linesDrawn > docLines) {
409409
linesDrawn = docLines - lineNumber;
410410
}

ide/editor.deprecated.pre65formatting/src/org/netbeans/editor/Formatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public void run () {
499499
endPos - 1 : endPos;
500500

501501
int pos = LineDocumentUtils.getLineStartOffset(doc, startPos );
502-
for (int lineCnt = Utilities.getRowCount(doc, startPos, end);
502+
for (int lineCnt = LineDocumentUtils.getLineCount(doc, startPos, end);
503503
lineCnt > 0; lineCnt--
504504
) {
505505
int indent = Utilities.getRowIndent(doc, pos);

ide/editor.errorstripe/src/org/netbeans/modules/editor/errorstripe/AnnotationView.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959

6060
import org.netbeans.editor.BaseDocument;
6161
import org.netbeans.editor.BaseTextUI;
62-
import org.netbeans.editor.Utilities;
6362
import org.netbeans.lib.editor.util.StringEscapeUtils;
6463
import org.netbeans.modules.editor.errorstripe.caret.CaretMark;
6564
import org.netbeans.modules.editor.errorstripe.privatespi.Mark;
@@ -184,7 +183,7 @@ private synchronized void updateForNewDocument() {
184183
while (position == _modelToView(startLine - 1, componentHeight, usableHeight) && startLine > 0)
185184
startLine--;
186185

187-
while ((endLine + 1) < Utilities.getRowCount(doc) && position == _modelToView(endLine + 1, componentHeight, usableHeight))
186+
while ((endLine + 1) < LineDocumentUtils.getLineCount(doc) && position == _modelToView(endLine + 1, componentHeight, usableHeight))
188187
endLine++;
189188

190189
return new int[] {startLine, endLine};
@@ -474,7 +473,7 @@ public void run() {
474473
}
475474

476475
private void documentChange() {
477-
fullRepaint(lines != Utilities.getRowCount(doc));
476+
fullRepaint(lines != LineDocumentUtils.getLineCount(doc));
478477
}
479478

480479
private double getComponentHeight() {
@@ -550,11 +549,11 @@ private int getYFromPos(int offset) throws BadLocationException {
550549
}
551550

552551
private synchronized int getModelToViewImpl(int line) throws BadLocationException {
553-
int docLines = Utilities.getRowCount(doc);
552+
int docLines = LineDocumentUtils.getLineCount(doc);
554553

555554
if (modelToViewCache == null || height != pane.getHeight() || lines != docLines) {
556-
modelToViewCache = new int[Utilities.getRowCount(doc) + 2];
557-
lines = Utilities.getRowCount(doc);
555+
modelToViewCache = new int[LineDocumentUtils.getLineCount(doc) + 2];
556+
lines = LineDocumentUtils.getLineCount(doc);
558557
height = pane.getHeight();
559558
}
560559

ide/editor.errorstripe/test/unit/src/org/netbeans/modules/editor/errorstripe/AnnotationViewTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.netbeans.api.editor.document.LineDocumentUtils;
3131
import org.netbeans.editor.BaseDocument;
3232
import org.netbeans.editor.BaseKit;
33-
import org.netbeans.editor.Utilities;
3433
import org.netbeans.junit.NbTestCase;
3534
import org.netbeans.modules.editor.errorstripe.caret.CaretMarkProviderCreator;
3635
import org.netbeans.modules.editor.errorstripe.privatespi.Mark;
@@ -121,7 +120,7 @@ public void testGetLinesSpanIsContinuous() throws Exception {
121120
performTest(new Action() {
122121
public void test(AnnotationView aView, BaseDocument document) throws Exception {
123122
int startLine = 1;
124-
int linesCount = Utilities.getRowCount(document);
123+
int linesCount = LineDocumentUtils.getLineCount(document);
125124

126125
while (startLine < linesCount) {
127126
int[] span = aView.getLinesSpan(startLine);

ide/editor.lib/src/org/netbeans/editor/BaseKit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,7 +4314,7 @@ public void run () {
43144314
endPos - 1 : endPos;
43154315

43164316
int lineStartOffset = LineDocumentUtils.getLineStartOffset(doc, startPos );
4317-
int lineCount = Utilities.getRowCount(doc, startPos, end);
4317+
int lineCount = LineDocumentUtils.getLineCount(doc, startPos, end);
43184318
Integer delta = null;
43194319
for (int i = lineCount - 1; i >= 0; i--) {
43204320
int indent = Utilities.getRowIndent(doc, lineStartOffset);
@@ -4379,7 +4379,7 @@ public void run () {
43794379
endPos - 1 : endPos;
43804380

43814381
int lineStartOffset = LineDocumentUtils.getLineStartOffset(doc, startPos );
4382-
int lineCount = Utilities.getRowCount(doc, startPos, end);
4382+
int lineCount = LineDocumentUtils.getLineCount(doc, startPos, end);
43834383
for (int i = lineCount - 1; i >= 0; i--) {
43844384
int indent = Utilities.getRowIndent(doc, lineStartOffset);
43854385
int newIndent = (indent == -1) ? 0 : // Zero indent if row is white

ide/editor.lib/src/org/netbeans/editor/ext/ExtKit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ public void run () {
917917
endPos = LineDocumentUtils.getLineEndOffset(doc, caretInfo.getDot());
918918
}
919919

920-
int lineCount = Utilities.getRowCount(doc, startPos, endPos);
920+
int lineCount = LineDocumentUtils.getLineCount(doc, startPos, endPos);
921921
boolean comment = forceComment != null ? forceComment : !allComments(doc, startPos, lineCount);
922922

923923
if (comment) {
@@ -951,7 +951,7 @@ public void run () {
951951
endPos = LineDocumentUtils.getLineEndOffset(doc, caret.getDot());
952952
}
953953

954-
int lineCount = Utilities.getRowCount(doc, startPos, endPos);
954+
int lineCount = LineDocumentUtils.getLineCount(doc, startPos, endPos);
955955
boolean comment = forceComment != null ? forceComment : !allComments(doc, startPos, lineCount);
956956

957957
if (comment) {

ide/editor.lib/src/org/netbeans/editor/ext/GotoDialogSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected boolean performGoto() {
207207

208208
BaseDocument doc = Utilities.getDocument(c);
209209
if (doc != null) {
210-
int rowCount = Utilities.getRowCount(doc);
210+
int rowCount = LineDocumentUtils.getLineCount(doc);
211211
if (line > rowCount)
212212
line = rowCount;
213213

ide/languages/src/org/netbeans/modules/languages/features/CodeCommentAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void run () {
7171
try {
7272
int end = (endPos > 0 && LineDocumentUtils.getLineStartOffset(doc, endPos) == endPos) ?
7373
endPos-1 : endPos;
74-
int lineCnt = Utilities.getRowCount(doc, startPos, end);
74+
int lineCnt = LineDocumentUtils.getLineCount(doc, startPos, end);
7575
List<String> mimeTypes = new ArrayList<>(lineCnt);
7676
int pos = startPos;
7777
for (int x = lineCnt ; x > 0; x--) {

0 commit comments

Comments
 (0)