Issue
I wrote an Eclipse Plugin in order to set up a new Java Project that is prepared with files and libraries and other stuff we need every time we create a new project. Now I would like to set "Text file encoding=UTF-8" and "New text file delimiter=Unix" as well.
For "Text file encoding" I did this by:
IProject project = ...
project.setDefaultCharset("UTF-8", null)
And after that in Project->Properties->Resource it is set to UTF-8.
My Question: But I do not find an IProject-Method that allows me to do the same for "text file delimiter". Is it possible to do this by org.eclipse.core as well?
Solution
This is just set in a preferences value.
The code for this is in org.eclipse.ui.internal.ide.LineDelimiterEditor
which uses:
String val = ... line separator ...
Preferences node = Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE)
.node(project.getName()).node(Platform.PI_RUNTIME);
node.put(Platform.PREF_LINE_SEPARATOR, val);
node.flush();
Note: since this is in an internal class it is not guaranteed to be the same in all releases.
Answered By - greg-449
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.