Eclipse: associate an editor with a content type

前端 未结 2 2059
不知归路
不知归路 2021-02-15 21:31

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

If I go to Window -> Preferences -> General -> Editors ->

相关标签:
2条回答
  • 2021-02-15 22:27

    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>
    

    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.

    0 讨论(0)
  • 2021-02-15 22:28

    Having the same problem: if the editor is choosen by "content-type", you can not change the default editor or add a new one: the content-type screen has no option to edit that.

    But, I discovered that you can configure (all) your extension(s) in your "File Associations". Eclipse will add automatically the editors (based on the Content-Type screen) AND You will then be able to add another editor and/or to change the default used one.

    This is based only on a very short experience, and I didn't find any supporting documentation, but I hope it can help anybody...

    0 讨论(0)
提交回复
热议问题