Eclipse:将编辑器与内容类型相关联 [英] Eclipse: associate an editor with a content type

查看:126
本文介绍了Eclipse:将编辑器与内容类型相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以基于内容类型而不是单个文件类型来更改编辑器关联吗?

Can I change editor associations based on the content type rather than individual file types?

如果我转到 Window->,首选项->一般->编辑器->文件关联,我会看到基于文件扩展名的文件类型列表。

If I go to Window -> Preferences -> General -> Editors -> File Associations, I see a list of file types based on the file extension.

例如,单击 * .py(关联)编辑器框列出了被'Python File'内容类型锁定的编辑器。

Clicking on "*.py" for example, the Associated Editors box lists editors that are "locked by 'Python File' content type".

我可以在顶部看到一条消息,说我可以查看'内容类型'对于基于内容类型的关联,但是首选项(常规->内容类型)的该部分仅显示与内容类型相关的文件扩展名,而不显示编辑器。

I can see the message at the top that says I can "See 'Content Types' for content-type based associations", but that section of the preferences (General -> Content Types) only shows file extensions associated with the content types, not editors.

内容类型的层次结构以大多数文件都位于文本内容类型下的方式进行组织,我要做的一件事情是将gvim添加为可用于Text / *文件的外部编辑器,而不是转到每个文件

Since the hierarchy of content types is organized in a way that most files are under the "Text" content type, one of the things I'd like to do is add gvim as an external editor available for Text/* files rather than go to each file type individually and add the editor.

谢谢。

推荐答案

我发现做到这一点的唯一方法是在安装了具有编辑器到内容类型绑定的插件中安装插件。在此示例中,我使Gedit可用于文本内容类型:

The only way I found to do that is by installing a plugin into your install that has the editor-to-content-type binding. In this example, I make Gedit available for the text content type:

<extension point="org.eclipse.ui.editors">
   <editor command="gedit"
         default="false"
         id="z.ex.rcp.mail.gedit"
         name="Gedit">
      <contentTypeBinding contentTypeId="org.eclipse.core.runtime.text"/>
   </editor>
</extension>

请参见 http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform。 doc.isv / reference / extension-points / org_eclipse_ui_editors.html 了解更多详细信息。

See http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_editors.html for more details.

这篇关于Eclipse:将编辑器与内容类型相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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