Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Newlines in source code
Newlines in source code [message #1271261] Fri, 14 March 2014 17:25 Go to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
If I'm not mistaken, currently the Graphiti project is mixing UNIX (\n) and Windows (CRLF) newlines in their text files, specifically the Java source.

For example, cloning the repository from //git.eclipse.org/gitroot/graphiti/org.eclipse.graphiti.git
the current HEAD (b453e93bb2df Fri Mar 14 15:22:03 2014 +0100) the directory plugin has 55 java source files with Windows newlines, and 687 with UNIX newlines
($ find -name '*.java' -exec file '{}' \; | grep CRLF | wc )

For example:

org.eclipse.graphiti/src/org/eclipse/graphiti/platform/IDiagramBehavior.java: CRLF 
org.eclipse.graphiti/src/org/eclipse/graphiti/platform/AbstractExtension.java: LF

I don't know if this has been discussed, or if there is some decision/standard about this, but I think this is bad practice and causes unnecesary pains.

There are no silver bullets for this, Git have several related settings, but all have their problems. I have been dealing with these pains in other projects of mine, and I have adopted the following strategy:

- Prefer UNIX in textual Eclipse text files, also in Windows environment.
- Don't attempt to force an universal normalization: for example, some source code might be created by code generators instead of being coded by hand. We will live with that.

Hence the following instructive:

1. Don't apply EOL normalization in GIT, never:
Set autocrlf=false and add '* -text' to .gitattribute

2. In Eclipse, select always (in Linux and Windows) the UNIX newline preference:
Preferences -> General -> Workspace -> TextFile delimiter= Unix , Encoding UTF-8

This specific strategy/instructive is a mere suggestion. But I think that some standard should be adopted.

[Updated on: Fri, 14 March 2014 17:26]

Report message to a moderator

Re: Newlines in source code [message #1273237 is a reply to message #1271261] Wed, 19 March 2014 19:19 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
In a similar (perhaps irrelevant?) vein, a standard for the charset encoding should be defined at the project level; usually, it's UTF-8. As today, it seems that ISO-8859-1 is (the facto?) used in

./org.eclipse.graphiti/src/org/eclipse/graphiti/services/IPeCreateService.java
./org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/util/draw2d/TransparentGhostFigure.java


(search for 'zier' , at Bézier curve). It's only in comments, but, again, this kind of thing can make trouble for GIT comparisons.

[Updated on: Wed, 19 March 2014 19:23]

Report message to a moderator

Re: Newlines in source code [message #1276251 is a reply to message #1273237] Mon, 24 March 2014 09:46 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hernan,

thanks for bringinh this up, there seems to be some mixup here. Would you
please file that as a bugzilla?

Thanks,
Michael
Re: Newlines in source code [message #1293653 is a reply to message #1276251] Sat, 12 April 2014 21:08 Go to previous message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Michael Wenz wrote on Mon, 24 March 2014 06:46
Hernan,

thanks for bringinh this up, there seems to be some mixup here. Would you
please file that as a bugzilla?

Thanks,
Michael


Done

https://bugs.eclipse.org/bugs/show_bug.cgi?id=432681
Previous Topic:Getting ContainerShape from PictogramElement
Next Topic:Getting anchors from Pictogram Element
Goto Forum:
  


Current Time: Tue Apr 23 14:21:56 GMT 2024

Powered by FUDForum. Page generated in 0.03322 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top