/** * 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); }
@Override public void apply(IDocument document) { try { document.replace(replacementOffset, replacementLength, replacementString); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getLocalizedMessage()); } }
/** * 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(); }
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); }
/** * @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()); } }
/** * 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(); }
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); }
YEditLog.logger.warning( e.toString() );
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)); }
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(); } }
@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; }
@Override public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getLocalizedMessage()); } }
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)); }
@Override public void apply(IDocument document) { try { document.replace(replacementOffset, replacementLength, replacementString); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@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; }
@Override public char charAt(int index) { try { return fDocument.getChar(index); } catch (BadLocationException x) { throw new IndexOutOfBoundsException(x.getLocalizedMessage()); } }
@Override public void replace(int position, int length, String text) { try { fDocument.replace(position, length, text); } catch (BadLocationException e) { throw new IndexOutOfBoundsException(e.getMessage()); } }
@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(); } }
@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; }