diff options
author | Tor Norbye <tnorbye@google.com> | 2013-03-13 10:40:45 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-03-13 10:40:45 -0700 |
commit | 67833f793127533958dad9c8f86f9887afcd4028 (patch) | |
tree | 0afe554af0515e9dd23bf18416d9d236dfb0eaf4 /eclipse/plugins | |
parent | 11a3406fe5ae2cceeb4bcb98b898bf72bbae003a (diff) | |
download | sdk-67833f793127533958dad9c8f86f9887afcd4028.zip sdk-67833f793127533958dad9c8f86f9887afcd4028.tar.gz sdk-67833f793127533958dad9c8f86f9887afcd4028.tar.bz2 |
53031 and 53032: XML formatting line separator fix
Change-Id: I62208c275eb13ec18e3c5f8078fd4aad524534df
Diffstat (limited to 'eclipse/plugins')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinter.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinter.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinter.java index 2051e5a..d3b6803 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinter.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinter.java @@ -28,6 +28,7 @@ import com.android.utils.SdkUtils; import com.android.utils.XmlUtils; import org.eclipse.core.runtime.IPath; +import org.eclipse.jface.text.TextUtilities; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; import org.w3c.dom.Document; @@ -56,7 +57,7 @@ public class EclipseXmlPrettyPrinter extends XmlPrettyPrinter { XmlFormatPreferences prefs, XmlFormatStyle style, String lineSeparator) { - super(prefs, style, lineSeparator); + super(prefs, style, lineSeparator == null ? getDefaultLineSeparator() : lineSeparator); } /** @@ -93,7 +94,17 @@ public class EclipseXmlPrettyPrinter extends XmlPrettyPrinter { @NonNull public static String prettyPrint(@NonNull Node node) { return prettyPrint(node, EclipseXmlFormatPreferences.create(), XmlFormatStyle.get(node), - SdkUtils.getLineSeparator()); + null); + } + + private static String getDefaultLineSeparator() { + org.eclipse.jface.text.Document blank = new org.eclipse.jface.text.Document(); + String lineSeparator = TextUtilities.getDefaultLineDelimiter(blank); + if (lineSeparator == null) { + lineSeparator = SdkUtils.getLineSeparator(); + } + + return lineSeparator; } /** |