有没有办法导出中定义的设置 Window > Preferences 对话框下 XML > XML Files > Editor 在 Eclipse 3.5 Galileo(Java EE 包)中?Eclipse 将这些设置存储在哪里?

现在我得到了一个 eclipse_xml_format.epf 包含以下内容

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

但我无法导入这个文件!

有帮助吗?

解决方案

记录这些 XML 设置的文件是:

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

那是:

  • org.eclipse.wst.xml.core.prefs,
  • 在里面 org.eclipse.core.runtime\.settings 目录
  • 您的工作空间

因此,即使您无法直接导出它们,您至少可以将该文件与另一个工作区设置文件复制/合并,从而以这种方式重新导入 XML 设置;


也就是说,如果您导出所有首选项,它们将保存在您选择的 .epf 文件中。

enter image description here

所有以 /instance/org.eclipse.wst.xml.core 很有趣:

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

因此,您可以删除所有其他行,然后重新导入此 epf 文件,其中仅包含 XML 设置。

笔记:为了重新导入“清理后的”导出文件(至少在 eclipse3.5 中),它必须包含以下行 file_export_version=3.0 (在任何地方 .epf 文件)。

#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

将重新导入成功

其他提示

好了,各位谁是懒得从EPF文件中删除所有其他属性。这里是一个小Groovy脚本做这个给你。

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")

也许它帮助。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top