本文整理了Java中org.eclipse.jface.text.IDocument.getNumberOfLines()
方法的一些代码示例,展示了IDocument.getNumberOfLines()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IDocument.getNumberOfLines()
方法的具体详情如下:
包路径:org.eclipse.jface.text.IDocument
类名称:IDocument
方法名:getNumberOfLines
[英]Returns the number of lines in this document.
Note that a document always has at least one line.
[中]返回此文档中的行数。
请注意,文档始终至少有一行。
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public int getRangeCount() {
return fDocument.getNumberOfLines();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
/**
* Create a line comparator for the given document.
*
* @param document
*/
public LineComparator(IDocument document) {
this.document = document;
this.hashes = new ArrayList
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Create a line comparator for the given document.
*
* @param document the document
*/
public LineComparator(IDocument document) {
fDocument= document;
Integer[] nulls= new Integer[fDocument.getNumberOfLines()];
fHashes= new ArrayList<>(Arrays.asList(nulls));
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Create a line comparator for the given document.
*
* @param document the document
*/
public LineComparator(IDocument document) {
fDocument= document;
Integer[] nulls= new Integer[fDocument.getNumberOfLines()];
fHashes= new ArrayList<>(Arrays.asList(nulls));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor
public DocumentEquivalenceClass(IDocument document, IHashFunction hashFunction) {
fDocument= document;
Hash[] nulls= new Hash[fDocument.getNumberOfLines()];
fHashes= new ArrayList<>(Arrays.asList(nulls));
if (hashFunction == null)
throw new NullPointerException("hashFunction"); //$NON-NLS-1$
fHashFunction= hashFunction;
}
代码示例来源:origin: org.eclipse/org.eclipse.ui.workbench.texteditor
public DocumentEquivalenceClass(IDocument document, IHashFunction hashFunction) {
fDocument= document;
Object[] nulls= new Object[fDocument.getNumberOfLines()];
fHashes= new ArrayList(Arrays.asList(nulls));
if (hashFunction == null)
throw new NullPointerException("hashFunction"); //$NON-NLS-1$
fHashFunction= hashFunction;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor
public DocumentEquivalenceClass(IDocument document, IHashFunction hashFunction) {
fDocument= document;
Hash[] nulls= new Hash[fDocument.getNumberOfLines()];
fHashes= new ArrayList<>(Arrays.asList(nulls));
if (hashFunction == null)
throw new NullPointerException("hashFunction"); //$NON-NLS-1$
fHashFunction= hashFunction;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
public int getLineOfLastMouseButtonActivity() {
if (fLastMouseButtonActivityLine >= fTextViewer.getDocument().getNumberOfLines())
fLastMouseButtOnActivityLine= -1;
return fLastMouseButtonActivityLine;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
public int getLineOfLastMouseButtonActivity() {
if (fLastMouseButtonActivityLine >= fTextViewer.getDocument().getNumberOfLines())
fLastMouseButtOnActivityLine= -1;
return fLastMouseButtonActivityLine;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
IDocument document= viewer.getDocument();
if (document != null) {
Point range= computeLineRange(viewer, lineNumber, 0, Math.max(0, document.getNumberOfLines() - 1));
if (range.x != -1 && range.y != -1)
return new LineRange(range.x, range.y - range.x + 1);
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
IDocument document= viewer.getDocument();
if (document != null) {
Point range= computeLineRange(viewer, lineNumber, 0, Math.max(0, document.getNumberOfLines() - 1));
if (range.x != -1 && range.y != -1)
return new LineRange(range.x, range.y - range.x + 1);
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
public int getLineOfLastMouseButtonActivity() {
if (fLastMouseButtOnActivityLine== -1)
fLastMouseButtOnActivityLine= toDocumentLineNumber(fLocation.y);
else if (fTextViewer.getDocument() == null || fLastMouseButtonActivityLine >= fTextViewer.getDocument().getNumberOfLines())
fLastMouseButtOnActivityLine= -1;
return fLastMouseButtonActivityLine;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core
public static int getInsertOffset(IDocument doc) {
int offset = doc.getLength();
for (int i = doc.getNumberOfLines() - 1; i >= 0; i--) {
try {
if (doc.get(doc.getLineOffset(i), doc.getLineLength(i)).trim().length() > 0) {
break;
}
offset = doc.getLineOffset(i);
} catch (BadLocationException e) {
}
}
return offset;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
public int getLineOfLastMouseButtonActivity() {
if (fLastMouseButtOnActivityLine== -1)
fLastMouseButtOnActivityLine= toDocumentLineNumber(fLocation.y);
else if (fTextViewer.getDocument() == null || fLastMouseButtonActivityLine >= fTextViewer.getDocument().getNumberOfLines())
fLastMouseButtOnActivityLine= -1;
return fLastMouseButtonActivityLine;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
private static void convertLineDelimiters(IDocument document, String defaultLineDelimiter) throws BadLocationException {
int lines = document.getNumberOfLines();
for (int line = 0; line
String lineDelimiter = document.getLineDelimiter(line);
if (lineDelimiter != null)
document.replace(region.getOffset() + region.getLength(), lineDelimiter.length(), defaultLineDelimiter);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private void convertLineDelimiters(IDocument document) throws BadLocationException {
int lines= document.getNumberOfLines();
for (int line= 0; line
String lineDelimiter= document.getLineDelimiter(line);
if (lineDelimiter != null)
document.replace(region.getOffset() + region.getLength(), lineDelimiter.length(), fLineDelimiter);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private void convertLineDelimiters(IDocument document) throws BadLocationException {
int lines= document.getNumberOfLines();
for (int line= 0; line
String lineDelimiter= document.getLineDelimiter(line);
if (lineDelimiter != null)
document.replace(region.getOffset() + region.getLength(), lineDelimiter.length(), fLineDelimiter);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
protected void handleVisibleDocumentAboutToBeChanged(DocumentEvent event) {
if (fHandleProjectionChanges && event instanceof ProjectionDocumentEvent && isProjectionMode()) {
int deletedLines;
try {
deletedLines= event.getDocument().getNumberOfLines(event.getOffset(), event.getLength());
} catch (BadLocationException e1) {
deletedLines= 0;
}
fDeletedLines= deletedLines;
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
protected void handleVisibleDocumentAboutToBeChanged(DocumentEvent event) {
if (fHandleProjectionChanges && event instanceof ProjectionDocumentEvent && isProjectionMode()) {
int deletedLines;
try {
deletedLines= event.getDocument().getNumberOfLines(event.getOffset(), event.getLength());
} catch (BadLocationException e1) {
deletedLines= 0;
}
fDeletedLines= deletedLines;
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private void indent(IDocument document) throws BadLocationException, MalformedTreeException {
// first line
int offset= document.getLineOffset(0);
document.replace(offset, 0, CodeFormatterUtil.createIndentString(fInitialIndentLevel, fProject));
// following lines
int lineCount= document.getNumberOfLines();
IndentUtil.indentLines(document, new LineRange(1, lineCount - 1), fProject, null);
}
}