Bug 98062 - PDE text models don't honor line delimiter preferences
Summary: PDE text models don't honor line delimiter preferences
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal with 2 votes (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, helpwanted
: 176014 222389 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-02 04:50 EDT by Tobias Widmer CLA
Modified: 2012-04-12 05:54 EDT (History)
11 users (show)

See Also:


Attachments
patch (21.05 KB, patch)
2009-04-23 13:42 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Widmer CLA 2005-06-02 04:50:57 EDT
3.1 RC1

Steps to reproduce:
- Create standard plugin-project, using manifest.mf
- Set line delimiter preference on plugin-project to something else than the 
platform default
- Create a new extension (generates the plugin.xml)

-> Regardless of the line delimiter preference, plugin.xml always contains 
platform line delimiters
Comment 1 Benjamin Cabé CLA 2008-03-09 16:20:14 EDT
To fix this bug, we must have something like write(String indent, String lineSeparator, PrintWriter writer) in the org.eclipse.pde.core.IWritable API
Comment 2 Chris Aniszczyk CLA 2008-03-10 10:34:36 EDT
Without digging into the code, don't we have an IWritableDelimiter kicking around somewhere? Can't we just modify that?
Comment 3 Benjamin Cabé CLA 2008-03-10 10:53:10 EDT
I'm afraid that IWritableDelimiter#writeDelimiter isn't to be used to write new lines ; here is the javadoc (whose meaning is confirmed by a quick look at the call hierarchy of the method)
/*    Write a customized delimeter to the serialized stream that delimits the
 * text representation of multiple model objects selected.
 * This is applicable when serializing multiple objects for copy, cut and
 * paste operations.
 */
 
What happens is that every org.eclipse.pde.core.IWritable#write(indent, writer) implementor (e.g. org.eclipse.pde.internal.core.plugin.Plugin)  makes call to writer.println(xxxxx) ; instead, it should call something like writer.print(xxxx + lineSeparator).
Comment 4 Chris Aniszczyk CLA 2008-03-10 11:02:58 EDT
ah, duh, we need something like a IWritableLineDelimiter :P

A patch against IWritable or creating a new IWritableLineDelimiter is fine with me.
Comment 5 Chris Aniszczyk CLA 2008-09-17 11:27:49 EDT
*** Bug 222389 has been marked as a duplicate of this bug. ***
Comment 6 Chris Aniszczyk CLA 2009-01-08 17:33:21 EST
*** Bug 176014 has been marked as a duplicate of this bug. ***
Comment 7 Darin Wright CLA 2009-03-16 11:59:00 EDT
It's the PrintWriter that's used to create the line separators. We should be able to create a subclass of PrintWriter that does the write thing when "println()" is called.
Comment 8 Darin Wright CLA 2009-04-23 13:42:11 EDT
Created attachment 132983 [details]
patch

Here's a quick patch. However, this code path is not used at all when saving. Instaed the editor's document is saved in via the text framework. I'm not even sure this is an issue anymore - the text framework should be doing the right thing.
Comment 9 Curtis Windatt CLA 2011-06-08 12:02:25 EDT
The print writer is not even used anymore.  Closing as INVALID.
Comment 10 Markus Keller CLA 2011-06-08 12:20:41 EDT
The steps from comment 0 still reproduce that problem. This bug was only about wrong initial line delimiters in the newly created plugin.xml.

Bug 176014 is a problem with mixed line delimiters but without steps to reproduce. In the setup from comment 0, I could not reproduce mixed delimiters, even when I added another extension.

Bug 222389 is probably unrelated to this bug. That problem is still reproducible and should be fixed since it introduces mixed line delimiters (in a command that should not touch the file at all).
Comment 11 Dani Megert CLA 2012-04-12 05:18:52 EDT
Still an issue and build.properties is also wrong.
Comment 13 Gunnar Wagenknecht CLA 2012-04-12 05:54:21 EDT
Thx Dani!