Export Eclipse XML Formatting Rules?

Is there a way to export options defined in Window > Preferences Dialog under XML > XML Files > Editor in Eclipse 3.5 Galileo (Java EE Package)? And where does Eclipse store these settings?

Now I got eclipse_xml_format.epf with the following content

 /instance/org.eclipse.wst.xml.core/lineWidth=120 /instance/org.eclipse.wst.xml.core/indentationChar=space /instance/org.eclipse.wst.xml.core/indentationSize=4 

But I can not import this file!

+4
eclipse eclipse-wtp text-formatting
source share
2 answers

The file that writes these XML settings is:

 <workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.wst.xml.core.prefs 

I.e:

  • org.eclipse.wst.xml.core.prefs
  • at org.eclipse.core.runtime\.settings directorty
  • your workspace

Thus, even if you cannot export them directly, you can at least copy / merge this file with another workspace settings file, thus re-importing the XML parameters in this way;


If you export all your settings, they are saved in the .epf file of your choice.

enter image description here

And all the lines starting with /instance/org.eclipse.wst.xml.core are interesting:

 /instance/org.eclipse.wst.xml.core/indentationChar=space 

So, you can delete all other lines and then re-import these epf files with XML settings only.

Note: for your β€œcleaned” export file to be reimported (at least with eclipse3.5), it contains the line file_export_version=3.0 (somewhere in the file_export_version=3.0 file).

 #Thu Mar 11 13:33:16 CET 2010 /instance/org.eclipse.wst.xml.core/lineWidth=119 /instance/org.eclipse.wst.xml.core/indentationChar=space /instance/org.eclipse.wst.xml.core/indentationSize=4 file_export_version=3.0 

will be successfully imported

+9
source share

Well, for all of you that are too lazy to remove all other properties from the epf file. Here is a small groovy script do it for you.

 def output = new File("eclipse_xml_format.epf") new File("eclipse.epf").eachLine { line, number -> if(line.startsWith("/instance/org.eclipse.wst.xml.core")) { output.append(line + "\n") } } output.append("file_export_version=3.0") 

Perhaps this helps.

+2
source share

All Articles