Project: JDT
Bug 15370 [misc] Files with non-platform line termination must be flagged
Reported: 2002-05-06 16:33:37 | Status: verified fixed

Eclipse interactive editors (like the Java source code editor) appear to write files using the platform's line termination character(s). This is '\n' on Unix and '\r\n' on Windows. Some other non-interactive "editors" (called "process" editors in the validateEdit document) do not consistently follow this rule. For instance, the '.classpath' process editor writes '\n' even on Windows. This inconsistency can cause ugly problems with CM systems that expect all text files to use the same line termination style. These problems can be very confusing to the users (which is why I marked the Severity as "major"). They can be avoided if the CM systems knows to treat the file as something other than a text file. Thus, Eclipse needs a mechanism whereby Team providers can ask if the file/resource should be treated as something other than a text file (even though it only contains text). Any creator of a file that creates a file that will not conform to the line termination style of the platform when written must mark the resource utilizing this mechanism. -------------------------------------------------------------------------------- Historical note: When this issue was first discussed, the following solution was proposed but rejected: 1) When a file already exists, the editor must write changes out using the line termination style of the pre-existing file (i.e. that it read in when it started the edit session). 2) If the editor is writing a new file or a file that was empty, there should be a new Eclipse-wide preference that will determine the line termination style used. The preference values would be: - Platform default - Windows style ("\r\n") - Unix style ("\n") 3) If a file already exists but has a mixture of line termination styles, the editor should either ask the user for the style to use or use the style indicated by the new Eclipse-wide preference. --------------------------------------------------------------------------------

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaFormatter.java