eclipse rcp更改xml配置文件的图标 [英] eclipse rcp change icon for xml configuration file

查看:645
本文介绍了eclipse rcp更改xml配置文件的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个Eclipse RCP应用程序,它在项目的根目录中使用 configuration.xml 来进行某些项目配置。我想自定义图标并保留默认的xml编辑器。我找到一个博客发布,我正在寻找一个属性文件。我提取它:

I built an Eclipse RCP application that uses the configuration.xml in the root of the project for some project configurations. I would like to customize the icon and keep default xml editor. I found one blog post, that does exactly what I'm looking for a property file. I extracted it:

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

我想我基本上需要调整属性 class 编辑器元素,用于Eclipse中xml编辑器的实现。我安装了 org.eclipse.wst.xml_ui.feature.feature.group 。我找不到合适的实施方案。请帮忙:)谢谢!

I guess that I basically need to adjust the attribute class of the editor element to the implementation of the xml editor in Eclipse. I installed the org.eclipse.wst.xml_ui.feature.feature.group. I'm not able to find the right implementation. Please help :) Thank you!

推荐答案

我可以解决我的问题,如果有人应该有同样的问题,这是我的解决方案。

I could to solve my problem, here is my solution if someone should have the same issue.

 <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 文件中的Extension选项卡。扩展点 org.eclipse.ui.editors 只出现一个。所以我在属性中使用了它的实现,并且它有效:)

I imported the org.eclipse.wst.xml.ui bundle to my workspace and had a look into Extension tab in the MANIFEST.MF file. The extension point org.eclipse.ui.editors appeared just one. So I used the implementation in the class attribute and it worked :)

编辑 :如果我知道 Eclipse插件间谍,这会更容易。因此,如果某个功能已经存在,只需使用魔术快捷方式来确定实施细节:)

Edit: If I would have known about the Eclipse Plugin Spy, this would have been easier. So, if a feature is already present, just use the magic shortcut to figure out the implementation details :)

这篇关于eclipse rcp更改xml配置文件的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆