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

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

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

BadLocationException.getMessage介绍

暂无

代码示例

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

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

代码示例来源:origin: org.eclipse/org.eclipse.ltk.core.refactoring

public static CoreException asCoreException(BadLocationException e) {
  String message= e.getMessage();
  if (message == null)
    message= "BadLocationException"; //$NON-NLS-1$
  return new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ltk.core.refactoring

public static CoreException asCoreException(BadLocationException e) {
  String message= e.getMessage();
  if (message == null)
    message= "BadLocationException"; //$NON-NLS-1$
  return new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}

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

public void configureBackwardReader(IDocument document, int offset, boolean skipComments, boolean skipStrings) throws IOException {
  fDocument= document;
  fOffset= offset;
  fSkipComments= skipComments;
  fSkipStrings= skipStrings;
  fForward= false;
  try {
    fCachedLineNumber= fDocument.getLineOfOffset(fOffset);
  } catch (BadLocationException x) {
    throw new IOException(x.getMessage());
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ltk.core.refactoring

public static CoreException asCoreException(BadLocationException e) {
  String message= e.getMessage();
  if (message == null)
    message= "BadLocationException"; //$NON-NLS-1$
  return new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}

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

public void configureBackwardReader(IDocument document, int offset, boolean skipComments, boolean skipStrings) throws IOException {
  fDocument= document;
  fOffset= offset;
  fSkipComments= skipComments;
  fSkipStrings= skipStrings;
  fForward= false;
  try {
    fCachedLineNumber= fDocument.getLineOfOffset(fOffset);
  } catch (BadLocationException x) {
    throw new IOException(x.getMessage());
  }
}

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

@Override
public void append(String text) {
  try {
    fDocument.replace(fDocument.getLength(), 0, text);
  } catch (BadLocationException e) {
    throw new IndexOutOfBoundsException(e.getMessage());
  }
}

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

public int read() throws IOException {
  try {
    return fForward ? readForwards() : readBackwards();
  } catch (BadLocationException x) {
    throw new IOException(x.getMessage());
  }
}

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

@Override
public int read() throws IOException {
  try {
    return fForward ? readForwards() : readBackwards();
  } catch (BadLocationException x) {
    throw new IOException(x.getMessage());
  }
}

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

@Override
public int read() throws IOException {
  try {
    return fForward ? readForwards() : readBackwards();
  } catch (BadLocationException x) {
    throw new IOException(x.getMessage());
  }
}

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

private void comment(IDocument document, int openCommentOffset, int closeCommentOffset) {
  try {
    document.replace(openCommentOffset, 0, OPEN_COMMENT);
    document.replace(closeCommentOffset, 0, CLOSE_COMMENT);
    removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
  }
  catch (BadLocationException e) {
    Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
  }
}

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

@Override
public void apply(IDocument document) {
  try {
    String variable= fVariable.getType().equals("dollar") ? "$$" : "${" + fVariable.getType() + '}'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    document.replace(fOffset, fLength, variable);
    fSelection= new Point(fOffset + variable.length(), 0);
  } catch (BadLocationException e) {
    Shell shell= fViewer.getTextWidget().getShell();
    MessageDialog.openError(shell, TemplatesMessages.TemplateVariableProposal_error_title, e.getMessage());
  }
}

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

@Override
public void apply(IDocument document) {
  try {
    String variable= fVariable.getType().equals("dollar") ? "$$" : "${" + fVariable.getType() + '}'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    document.replace(fOffset, fLength, variable);
    fSelection= new Point(fOffset + variable.length(), 0);
  } catch (BadLocationException e) {
    Shell shell= fViewer.getTextWidget().getShell();
    MessageDialog.openError(shell, TemplatesMessages.TemplateVariableProposal_error_title, e.getMessage());
  }
}

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

private static Position createPosition(IDocument document, int offset) {
  Position start = new Position();
  try {
    int lineOfOffset = document.getLineOfOffset(offset);
    start.setLine(Integer.valueOf(lineOfOffset));
    start.setCharacter(Integer.valueOf(offset - document.getLineOffset(lineOfOffset)));
  } catch (BadLocationException e) {
    JavaLanguageServerPlugin.logException(e.getMessage(), e);
  }
  return start;
}

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

private IRegion getRegion(Range range, IDocument document) {
  try {
    int offset = document.getLineOffset(range.getStart().getLine()) + range.getStart().getCharacter();
    int endOffset = document.getLineOffset(range.getEnd().getLine()) + range.getEnd().getCharacter();
    int length = endOffset - offset;
    return new Region(offset, length);
  } catch (BadLocationException e) {
    JavaLanguageServerPlugin.logException(e.getMessage(), e);
  }
  return null;
}

相关文章