javax.swing.text.Position.getOffset()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中javax.swing.text.Position.getOffset()方法的一些代码示例,展示了Position.getOffset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Position.getOffset()方法的具体详情如下:
包路径:javax.swing.text.Position
类名称:Position
方法名:getOffset

Position.getOffset介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

public int start() {
  return start.getOffset();
}

代码示例来源:origin: groovy/groovy-core

public int end() {
  return end.getOffset();
}

代码示例来源:origin: groovy/groovy-core

public int length() {
  return end.getOffset() - start.getOffset();
}

代码示例来源:origin: groovy/groovy-core

private int valueOf(Object obj) {
    return obj instanceof Integer ? 
        ((Integer)obj).intValue() : 
        (obj instanceof MultiLineRun) ?
          ((MultiLineRun)obj).start() :
          ((Position)obj).getOffset();
  }
}

代码示例来源: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 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 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 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: bobbylight/RSyntaxTextArea

@Override
public int getMarkedOffset() {
  return pos.getOffset();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

@Override
public int getStartOffset() {
  return p0.getOffset();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

@Override
public int getEndOffset() {
  return p1.getOffset();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public int getOffset() {
  return offs.getOffset();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

void removeText() {
  if ((p0 != null) && (p1 != null) && (p0.getOffset() != p1.getOffset())) {
    try {
      Document doc = c.getDocument();
      doc.remove(p0.getOffset(), p1.getOffset() - p0.getOffset());
    } catch (BadLocationException e) {
    }
  }
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

@Override
public int compareTo(GutterIconInfo other) {
  if (other!=null) {
    return pos.getOffset() - other.getMarkedOffset();
  }
  return -1;
}

相关文章