Export the Eclipse XML Formatting Rules?

。_饼干妹妹 提交于 2019-12-05 06:56:05
VonC

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.

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!