/** * Determine the current Line delimiter at the given offset. * * @param doc * the document to query for the newline sequence. * @param offset * absolute character position * @return the new line sequence used in the line containing offset * @throws BadLocationException * in case offset doesn't fit a legal position */ public static String lineDelimiter(IXtextDocument doc, int offset) throws BadLocationException { String nl = doc.getLineDelimiter(doc.getLineOfOffset(offset)); if (nl == null) { if (doc instanceof AbstractDocument) { nl = ((AbstractDocument) doc).getDefaultLineDelimiter(); } } return nl; }