xml - eclipse rcp 更改 xml 配置文件的图标

标签 xml eclipse icons rcp

我构建了一个 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/

相关文章:

xml - 从 mulesoft 中的 xml 列表中提取特定的 xml 节点

java - 在 gwtSuperDev 任务中包含用于重新编译的其他源

android - 为什么我的应用程序图标在 MIUI 或 vivo 启动器中没有更新?

Java XML vs SQL vs 自定义数据存储

java - 如何修复从 builder.parse(xmlString) 返回的 SAXException?

java - 为什么这个 Apache Camel 路由不将 JSON 转换为 XML?

java - Eclipse:内容辅助在处理程序中不可用

eclipse - eclipse 中的 tomcat - 由于先前的错误启动失败

Java 图标常量 - 静态常量可以吗?

colors - Flutter PopupMenu 更改图标颜色