Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
index df2e9ad5029..9ccd5e9ab05 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -481,12 +481,14 @@ public class TextUtilities {
* @since 3.0
*/
public static String getDefaultLineDelimiter(IDocument document) {
-
- if (document instanceof IDocumentExtension4)
- return ((IDocumentExtension4)document).getDefaultLineDelimiter();
-
String lineDelimiter= null;
+ if (document instanceof IDocumentExtension4) {
+ lineDelimiter= ((IDocumentExtension4) document).getDefaultLineDelimiter();
+ if (lineDelimiter != null)
+ return lineDelimiter;
+ }
+
try {
lineDelimiter= document.getLineDelimiter(0);
} catch (BadLocationException x) {

Back to the top