org.eclipse.jface.text.BadLocationException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(193)

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

BadLocationException.<init>介绍

[英]Creates a new bad location exception.
[中]创建新的坏位置异常。

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

/**
 * Throws an exception.
 *
 * @param offset the illegal character or line offset that caused the exception
 * @throws BadLocationException always
 */
private void fail(int offset) throws BadLocationException {
  throw new BadLocationException();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

/**
 * Throws an exception.
 *
 * @param offset the illegal character or line offset that caused the exception
 * @throws BadLocationException always
 */
private void fail(int offset) throws BadLocationException {
  throw new BadLocationException();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public final int getLineLength(int line) throws BadLocationException {
  int lines= fLines.size();
  if (line < 0 || line > lines)
    throw new BadLocationException();
  if (lines == 0 || lines == line)
    return 0;
  Line l= fLines.get(line);
  return l.length;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public final String getLineDelimiter(int line) throws BadLocationException {
  int lines= fLines.size();
  if (line < 0 || line > lines)
    throw new BadLocationException();
  if (lines == 0)
    return null;
  if (line == lines)
    return null;
  Line l= fLines.get(line);
  return l.delimiter;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public final String getLineDelimiter(int line) throws BadLocationException {
  int lines= fLines.size();
  if (line < 0 || line > lines)
    throw new BadLocationException();
  if (lines == 0)
    return null;
  if (line == lines)
    return null;
  Line l= fLines.get(line);
  return l.delimiter;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public final int getLineLength(int line) throws BadLocationException {
  int lines= fLines.size();
  if (line < 0 || line > lines)
    throw new BadLocationException();
  if (lines == 0 || lines == line)
    return 0;
  Line l= fLines.get(line);
  return l.length;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

/**
 * Enforces the invariant that all positions must be disjoint.
 *
 * @param position the position to check
 * @throws BadLocationException if the disjointness check fails
 */
private void enforceDisjoint(LinkedPosition position) throws BadLocationException {
  for (LinkedPosition p : fPositions) {
    if (p.overlapsWith(position))
      throw new BadLocationException();
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public final int getNumberOfLines(int position, int length) throws BadLocationException {
  if (position < 0 || position + length > fTextLength)
    throw new BadLocationException();
  if (length == 0) // optimization
    return 1;
  return getNumberOfLines(getLineNumberOfOffset(position), position, length);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public int computeIndexInCategory(String category, int offset) throws BadLocationException, BadPositionCategoryException {
  if (0 > offset || offset > getLength())
    throw new BadLocationException();
  List<Position> c= fPositions.get(category);
  if (c == null)
    throw new BadPositionCategoryException();
  return computeIndexInPositionList(c, offset);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public int computeIndexInCategory(String category, int offset) throws BadLocationException, BadPositionCategoryException {
  if (0 > offset || offset > getLength())
    throw new BadLocationException();
  List<Position> c= fPositions.get(category);
  if (c == null)
    throw new BadPositionCategoryException();
  return computeIndexInPositionList(c, offset);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public char getChar(int pos) throws BadLocationException {
  if ((0 > pos) || (pos >= getLength()))
    throw new BadLocationException();
  return getStore().get(pos);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public char getChar(int pos) throws BadLocationException {
  if ((0 > pos) || (pos >= getLength()))
    throw new BadLocationException();
  return getStore().get(pos);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public String get(int pos, int length) throws BadLocationException {
  int myLength= getLength();
  if ((0 > pos) || (0 > length) || (pos + length > myLength))
    throw new BadLocationException();
  return getStore().get(pos, length);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

private final void checkOriginRegion(IRegion originRegion) throws BadLocationException {
  int offset= originRegion.getOffset();
  int endOffset= inclusiveEnd(originRegion);
  int max= fMasterDocument.getLength();
  if (offset < 0 || offset > max || endOffset < 0 || endOffset > max)
    throw new BadLocationException();
}

代码示例来源:origin: pulse00/Twig-Eclipse-Plugin

protected final void checkBadLocation(int offset) throws BadLocationException {
  ITextRegion lastRegion = getLastToken();
  if (offset < 0 || lastRegion.getEnd() < offset) {
    throw new BadLocationException("offset " + offset + " is out of [0, " + lastRegion.getEnd() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public final IRegion getLineInformationOfOffset(int position) throws BadLocationException {
  if (position > fTextLength)
    throw new BadLocationException("Offset > length: " + position + " > " + fTextLength);  //$NON-NLS-1$//$NON-NLS-2$
  if (position == fTextLength) {
    int size= fLines.size();
    if (size == 0)
      return new Region(0, 0);
    Line l= fLines.get(size - 1);
    return (l.delimiter != null ? new Line(fTextLength, 0) : new Line(fTextLength - l.length, l.length));
  }
  return getLineInformation(findLine(position));
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

private final void checkOriginRegion(IRegion originRegion) throws BadLocationException {
  int offset= originRegion.getOffset();
  int endOffset= inclusiveEnd(originRegion);
  int max= fMasterDocument.getLength();
  if (offset < 0 || offset > max || endOffset < 0 || endOffset > max)
    throw new BadLocationException();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public String get(int pos, int length) throws BadLocationException {
  int myLength= getLength();
  if ((0 > pos) || (0 > length) || (pos + length > myLength))
    throw new BadLocationException();
  return getStore().get(pos, length);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.text

@Override
public boolean isLineInformationRepairNeeded(int offset, int length, String text) throws BadLocationException {
  if ((0 > offset) || (0 > length) || (offset + length > getLength()))
    throw new BadLocationException();
  return isLineInformationRepairNeeded(text) || isLineInformationRepairNeeded(get(offset, length));
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public boolean isLineInformationRepairNeeded(int offset, int length, String text) throws BadLocationException {
  if ((0 > offset) || (0 > length) || (offset + length > getLength()))
    throw new BadLocationException();
  return isLineInformationRepairNeeded(text) || isLineInformationRepairNeeded(get(offset, length));
}

相关文章