7

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

Now i got an 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't import this file!

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Christopher Klewes
  • 11,181
  • 18
  • 74
  • 102

2 Answers2

13

The file recording those XML settings is:

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

That is:

  • org.eclipse.wst.xml.core.prefs,
  • in the org.eclipse.core.runtime\.settings directorty
  • of your workspace

So even if you cannot export them directly, you can at least copy/merge that file with another workspace setting file, re-importing that way the XML settings;


That being said, if you export all your preferences, they are saved in an .epf file of your choice.

enter image description here

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

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

So you can remove all the other lines, and then re-import this epf files with only the XML settings in it.

Note: for your "cleaned" export file to be reimported (at least with eclipse3.5), it ust contain the line file_export_version=3.0 (anywhere in the .epf 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 re-imported successfully

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Okay, this is really great. Now i have a file which only contains the needed properties. But they can't be re-imported, i changed my question text to show you my file. I changed the values of lineWidth in the file, tried to reimport and nothing changed! – Christopher Klewes Mar 11 '10 at 11:51
  • @chrsk: true. I have updated my answer to reflect the right preference file format (and I have managed to re-import and re-apply only the XML setting by respecting that format) – VonC Mar 11 '10 at 12:47
2

Okay, for all of you who are too lazy to remove all other properties from epf file. Here is a small groovy script doing this 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")

Maybe it helps.

Christopher Klewes
  • 11,181
  • 18
  • 74
  • 102