本文整理了Java中javax.swing.text.Document.getEndPosition()
方法的一些代码示例,展示了Document.getEndPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.getEndPosition()
方法的具体详情如下:
包路径:javax.swing.text.Document
类名称:Document
方法名:getEndPosition
暂无
代码示例来源:origin: SonarSource/sonarqube
private void updateHighlighting(Component component) {
highlightingEditor.setText("");
try (CloseableIterator<ScannerReport.SyntaxHighlightingRule> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
while (it.hasNext()) {
ScannerReport.SyntaxHighlightingRule rule = it.next();
highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateMeasures(Component component) {
measuresEditor.setText("");
try (CloseableIterator<ScannerReport.Measure> it = reader.readComponentMeasures(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Measure measure = it.next();
measuresEditor.getDocument().insertString(measuresEditor.getDocument().getEndPosition().getOffset(), measure + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read measures for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateSymbols(Component component) {
symbolEditor.setText("");
try (CloseableIterator<ScannerReport.Symbol> it = reader.readComponentSymbols(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Symbol symbol = it.next();
symbolEditor.getDocument().insertString(symbolEditor.getDocument().getEndPosition().getOffset(), symbol + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read symbol references for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateScm(Component component) {
scmEditor.setText("");
Changesets changesets = reader.readChangesets(component.getRef());
if (changesets == null) {
return;
}
List<Integer> changesetIndexByLine = changesets.getChangesetIndexByLineList();
try {
int index = 0;
for (Changeset changeset : changesets.getChangesetList()) {
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), Integer.toString(index) + "\n", null);
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), changeset + "\n", null);
index++;
}
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), "\n", null);
int line = 1;
for (Integer idx : changesetIndexByLine) {
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), Integer.toString(line) + ": " + idx + "\n", null);
line++;
}
} catch (Exception e) {
throw new IllegalStateException("Can't read SCM for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateCoverage(Component component) {
coverageEditor.setText("");
try (CloseableIterator<ScannerReport.LineCoverage> it = reader.readComponentCoverage(component.getRef())) {
while (it.hasNext()) {
ScannerReport.LineCoverage coverage = it.next();
coverageEditor.getDocument().insertString(coverageEditor.getDocument().getEndPosition().getOffset(), coverage + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read code coverage for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateIssues(Component component) {
issuesEditor.setText("");
try (CloseableIterator<Issue> it = reader.readComponentIssues(component.getRef())) {
while (it.hasNext()) {
Issue issue = it.next();
int offset = issuesEditor.getDocument().getEndPosition().getOffset();
issuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read issues for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateExternalIssues(Component component) {
externalIssuesEditor.setText("");
try (CloseableIterator<ScannerReport.ExternalIssue> it = reader.readComponentExternalIssues(component.getRef())) {
while (it.hasNext()) {
ScannerReport.ExternalIssue issue = it.next();
int offset = externalIssuesEditor.getDocument().getEndPosition().getOffset();
externalIssuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read external issues for " + getNodeName(component), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateCpdTextBlocks(Component component) {
cpdTextBlocksEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
try (CloseableIterator<ScannerReport.CpdTextBlock> it = reader.readCpdTextBlocks(component.getRef())) {
while (it.hasNext()) {
ScannerReport.CpdTextBlock textBlock = it.next();
cpdTextBlocksEditor.getDocument().insertString(cpdTextBlocksEditor.getDocument().getEndPosition().getOffset(), textBlock + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read CPD text blocks for " + getNodeName(component), e);
}
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateDuplications(Component component) {
duplicationEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
try (CloseableIterator<ScannerReport.Duplication> it = reader.readComponentDuplications(component.getRef())) {
while (it.hasNext()) {
ScannerReport.Duplication dup = it.next();
duplicationEditor.getDocument().insertString(duplicationEditor.getDocument().getEndPosition().getOffset(), dup + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read duplications for " + getNodeName(component), e);
}
}
}
代码示例来源:origin: SonarSource/sonarqube
private void updateSignificantCode(Component component) {
significantCodeEditor.setText("");
if (reader.hasCoverage(component.getRef())) {
try (CloseableIterator<ScannerReport.LineSgnificantCode> it = reader.readComponentSignificantCode(component.getRef())) {
if (it != null) {
while (it.hasNext()) {
ScannerReport.LineSgnificantCode textBlock = it.next();
significantCodeEditor.getDocument().insertString(significantCodeEditor.getDocument().getEndPosition().getOffset(), textBlock + "\n", null);
}
}
} catch (Exception e) {
throw new IllegalStateException("Can't read significant code for " + getNodeName(component), e);
}
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* {@inheritDoc}
*/
public Position getEndPosition() {
return delegate.getEndPosition();
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* {@inheritDoc}
*/
@Override
public Position getEndPosition() {
return delegate.getEndPosition();
}
代码示例来源:origin: tmyroadctfig/swingx
/**
* {@inheritDoc}
*/
@Override
public Position getEndPosition() {
return delegate.getEndPosition();
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-document
public LineRootElement(Document doc) {
this.doc = doc;
assert (doc.getLength() == 0) : "Cannot start with non-empty document"; // NOI18N
Position startPos = doc.getStartPosition();
assert (startPos.getOffset() == 0) : "Document.getStartPosition()=" + startPos + " != 0";
Position endPos = doc.getEndPosition();
assert (endPos.getOffset() == 1) : "Document.getEndPosition()=" + endPos + " != 1";
Element line = new LineElement(this, startPos, endPos);
replace(0, 0, new Element[]{ line });
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-protocol
private void updateHighlighting(Component component) {
highlightingEditor.setText("");
try (CloseableIterator<ScannerReport.SyntaxHighlightingRule> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
while (it.hasNext()) {
ScannerReport.SyntaxHighlightingRule rule = it.next();
highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-protocol
private void updateIssues(Component component) {
issuesEditor.setText("");
try (CloseableIterator<Issue> it = reader.readComponentIssues(component.getRef())) {
while (it.hasNext()) {
Issue issue = it.next();
int offset = issuesEditor.getDocument().getEndPosition().getOffset();
issuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read issues for " + getNodeName(component), e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-protocol
private void updateExternalIssues(Component component) {
externalIssuesEditor.setText("");
try (CloseableIterator<ScannerReport.ExternalIssue> it = reader.readComponentExternalIssues(component.getRef())) {
while (it.hasNext()) {
ScannerReport.ExternalIssue issue = it.next();
int offset = externalIssuesEditor.getDocument().getEndPosition().getOffset();
externalIssuesEditor.getDocument().insertString(offset, issue.toString(), null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read external issues for " + getNodeName(component), e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch-protocol
private void updateHighlighting(Component component) {
highlightingEditor.setText("");
try (CloseableIterator<BatchReport.SyntaxHighlighting> it = reader.readComponentSyntaxHighlighting(component.getRef())) {
while (it.hasNext()) {
BatchReport.SyntaxHighlighting rule = it.next();
highlightingEditor.getDocument().insertString(highlightingEditor.getDocument().getEndPosition().getOffset(), rule.toString() + "\n", null);
}
} catch (Exception e) {
throw new IllegalStateException("Can't read syntax highlighting for " + getNodeName(component), e);
}
}
代码示例来源:origin: org.codehaus.sonar.sslr/sslr-devkit
private void loadFromString(String code) {
showCode(code);
lineOffsets.computeLineOffsets(code, codeEditor.getDocument().getEndPosition().getOffset());
showAst(code);
}
代码示例来源:origin: org.jenkins-ci/executable-war
/**
* Forces the scroll of text area.
*/
private void scrollDown() {
int pos = textArea.getDocument().getEndPosition().getOffset();
textArea.getCaret().setDot(pos);
textArea.requestFocus();
}
}
内容来源于网络,如有侵权,请联系作者删除!