我构建了一个 Eclipse RCP 应用程序,它使用项目根目录中的 configuration.xml
来进行某些项目配置。我想自定义图标并保留默认的 xml 编辑器。我发现一个博客post ,这正是我正在寻找的 property
文件。我把它提取出来:
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type base-type="org.eclipse.core.runtime.properties"
file-extensions="config"
id="in.cypal.eclipse.myConfig"
name="My Config File"
priority="normal">
</content-type>
</extension>
<extension point="org.eclipse.ui.editors">
<editor class="org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertiesFileEditor"
default="false"
extensions="config"
icon="icons/sample.gif"
id="in.cypal.eclipse.editors.myConfigEditor"
name="My Config Editor">
<contentTypeBinding contentTypeId="in.cypal.eclipse.myConfig">
</contentTypeBinding>
</editor>
</extension>
我猜我基本上需要调整editor
元素的属性class
来实现Eclipse中xml编辑器的实现。我安装了 org.eclipse.wst.xml_ui.feature.feature.group
。我无法找到正确的实现。请帮忙:)谢谢!
最佳答案
我可以解决我的问题,如果有人遇到同样的问题,这是我的解决方案。
<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
file-names="configuration.xml"
id="org.eclipse.core.runtime.xml.spl"
name="Software Product Line Configuration"
priority="normal">
</content-type>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart"
default="true"
icon="icons/configuration.png"
id="YOUR_ID"
name="Software Product Line Configuration">
<contentTypeBinding
contentTypeId="org.eclipse.core.runtime.xml.spl">
</contentTypeBinding>
</editor>
</extension>
我将 org.eclipse.wst.xml.ui
包导入到我的工作区,并查看了 MANIFEST.MF
文件中的“扩展”选项卡。扩展点 org.eclipse.ui.editors 只出现了一个。所以我在 class
属性中使用了实现,它起作用了:)
编辑:如果我知道 Eclipse Plugin Spy ,这会更容易。因此,如果某个功能已经存在,只需使用神奇的快捷方式即可找出实现细节:)
关于xml - eclipse rcp 更改 xml 配置文件的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11483161/