org.eclipse.jface.text.BadLocationException类的使用及代码示例

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

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

BadLocationException介绍

[英]Indicates the attempt to access a non-existing position. The attempt has been performed on a text store such as a document or string.

This class is not intended to be serialized.
[中]表示尝试访问不存在的位置。已在文本存储(如文档或字符串)上执行此尝试。
此类不打算序列化。

代码示例

代码示例来源:origin: org.eclipse.xtext/ui

/**
 * Logs the exception. Will throw a {@link RuntimeException} if {@link #debug} is set to <code>true</code>.
 * @since 2.0
 */
protected void handleBadLocationException(BadLocationException e) {
  log.error(e.getMessage(), e);
  if (debug)
    throw new RuntimeException(e);
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.code.editor

@Override
public void apply(IDocument document) {
  try {
    document.replace(replacementOffset, replacementLength, replacementString);
  } catch (BadLocationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.ui.editors

public char charAt(int index) {
  try {
    return fDocument.getChar(index);
  } catch (BadLocationException x) {
    throw new IndexOutOfBoundsException(x.getLocalizedMessage());
  }
}

代码示例来源: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.scout.sdk.deps/org.eclipse.jdt.ui

private void openErrorDialog(BadLocationException e) {
  Shell shell= getTextViewer().getTextWidget().getShell();
  String message= e.getMessage();
  MessageDialog.openError(shell, JavaTextMessages.FilledArgumentNamesMethodProposal_error_msg,
      message == null ? e.toString() : message);
}

代码示例来源:origin: oyse/yedit

/**
 * @param node A node as returned by SnakeYAML
 * @param parent The parent element
 * @param type The type of YAML element that this is. The different element types are defined
 * as constants in this class.
 * @param document The document containing the YAML text.
 */
protected YAMLOutlineElement( Node node, YAMLOutlineElement parent, int type, IDocument document ){
  this.node = node;
  this.parent = parent;
  this.type = type;
  this.document = document;
  
  if(this.parent != null ){
    this.nodePath = parent.nodePath;
  }
  this.nodePath.add(System.identityHashCode(this.node));
  
  parseNode( node );
  position = getPosition( node );
  try {
    document.addPosition(YAMLContentOutlinePage.YAMLSEGMENT, position);
  } catch (BadLocationException e) {
    YEditLog.logger.warning(e.toString());				
  } catch (BadPositionCategoryException e) {
    YEditLog.logger.warning(e.toString());
  }            
}

代码示例来源: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.jdt/org.eclipse.jdt.ui

private void openErrorDialog(BadLocationException e) {
  Shell shell= getTextViewer().getTextWidget().getShell();
  String message= e.getMessage();
  MessageDialog.openError(shell, JavaTextMessages.FilledArgumentNamesMethodProposal_error_msg,
      message == null ? e.toString() : message);
}

代码示例来源:origin: oyse/yedit

YEditLog.logger.warning( e.toString() );

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private static CoreException wrapBadLocationException(BadLocationException e) {
  String message= e.getMessage();
  if (message == null)
    message= "BadLocationException"; //$NON-NLS-1$
  return new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}

代码示例来源:origin: org.eclipse/org.eclipse.ui.workbench.texteditor

public void apply(IDocument document, char trigger, int offset) {
  try {
    String replacement= fString.substring(offset - fOffset);
    document.replace(offset, 0, replacement);
  } catch (BadLocationException x) {
    // TODO Auto-generated catch block
    x.printStackTrace();
  }
}

代码示例来源: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: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

@Override
public char charAt(int index) {
  try {
    return fDocument.getChar(index);
  } catch (BadLocationException x) {
    throw new IndexOutOfBoundsException(x.getLocalizedMessage());
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static CoreException wrapBadLocationException(BadLocationException e) {
  String message= e.getMessage();
  if (message == null)
    message= "BadLocationException"; //$NON-NLS-1$
  return new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.code.editor

@Override
public void apply(IDocument document) {
  try {
    document.replace(replacementOffset, replacementLength, replacementString);
  } catch (BadLocationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

代码示例来源: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.core.filebuffers

@Override
public char charAt(int index) {
  try {
    return fDocument.getChar(index);
  } catch (BadLocationException x) {
    throw new IndexOutOfBoundsException(x.getLocalizedMessage());
  }
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

@Override
public void replace(int position, int length, String text) {
  try {
    fDocument.replace(position, length, text);
  } catch (BadLocationException e) {
    throw new IndexOutOfBoundsException(e.getMessage());
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor

@Override
public void apply(IDocument document, char trigger, int offset) {
  try {
    String replacement= fString.substring(offset - fOffset);
    document.replace(offset, 0, replacement);
  } catch (BadLocationException x) {
    // TODO Auto-generated catch block
    x.printStackTrace();
  }
}

代码示例来源: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;
}

相关文章