Eclipse editor extension point : org.eclipse.ui.editors

This extension point is used to add new editors to the workbench. A editor is a visual component within a workbench page. It is typically used to edit or browse a document or input object. To open an editor, the user will typically invoke "Open" on anIFile. When this action is performed the workbench registry is consulted to determine an appropriate editor for the file type and then a new instance of the editor type is created. The actual result depends on the type of the editor. The workbench provides support for the creation of internal editors, which are tightly integrated into the workbench, and external editors, which are launched in a separate frame window. There are also various level of integration between these extremes.
In the case of an internal editor tight integration can be achieved between the workbench window and the editor part. The workbench menu and toolbar are pre-loaded with a number of common actions, such as cut, copy, and paste. The active part, view or editor, is expected to provide the implementation for these actions. An internal editor may also define new actions which appear in the workbench window. These actions only appear when the editor is active.

The integration between the workbench and externaleditors is more tenuous. In this case the workbench may launch an editor but after has no way of determiningthe state of the external editor or collaborating with it by any means except through the file system.

<!ATTLIST editor

id               CDATA #REQUIRED

name             CDATA #REQUIRED

icon             CDATA #IMPLIED

extensions       CDATA #IMPLIED

class            CDATA #IMPLIED

command          CDATA #IMPLIED

launcher         CDATA #IMPLIED

contributorClass CDATA #IMPLIED

default          (true | false) "false"

filenames        CDATA #IMPLIED

symbolicFontName CDATA #IMPLIED

matchingStrategy CDATA #IMPLIED
>

  • id - a unique name that will be used to identify this editor
  • name - a translatable name that will be used in the UI for this editor
  • icon - A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench will use the icon provided by the operating system.
  • extensions - an optional field containing the list of file types understood by the editor. This is a string containing comma separate file extensions. For instance, an editor which understands hypertext documents may register for "htm, html".
  • class - the name of a class that implements org.eclipse.ui.IEditorPart. The attributesclass, command, and launcher are mutually exclusive. If this attribute is defined thencontributorClass should also be defined.
  • command - a command to run in order to launch an external editor. The executable command must be located on the system path or in the plug-in's directory. The attributesclass, command, and launcher are mutually exclusive.
  • launcher - the name of a class which that implements org.eclipse.ui.IEditorLauncher. A launcher will open an external editor. The attributesclass, command, and launcher are mutually exclusive.
  • contributorClass - the name of a class that implements org.eclipse.ui.IEditorActionBarContributor. This attribute should only be defined if theclass attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
  • default - if true, this editor will be used as the default editor for thetype. This is only relevant in a case where more than one editoris registered for the same type. If an editor is not the defaultfor the type, it can still be launched using "Open with..."submenu for the selected resource.

    Please note that this attribute is only honored for filename and extension associations at this time. It will not be honored for content type bindings. Content type-based resolution will occur on a first come, first serve basis and is not explicitly specified.

  • filenames - an optional field containing the list of file names understood by the editor. This is a string containing comma separate file names. For instance, an editor which understands specific hypertext documents may register for "ejb.htm, ejb.html".
  • symbolicFontName - the symbolic name of a font. The symbolic font name must be the id of a defined font (see org.eclipse.ui.fontDefinitions). If this attribute is missing or invalid then the font name is the value of "org.eclipse.jface.textfont" in the editor's preferences store. If there is no preference store or the key is not defined then the JFace text font will be used. The editor implementation decides if it uses this symbolic font name to set the font.
  • matchingStrategy - the name of a class that implements org.eclipse.ui.IEditorMatchingStrategy. This attribute should only be defined if theclass attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
   <extension point="org.eclipse.ui.editors"> 
      <editor 
         id="com.xyz.XMLEditor" 
         name="Fancy XYZ XML editor" 
         icon="./icons/XMLEditor.gif" 
         extensions="xml" 
         class="com.xyz.XMLEditor" 
         contributorClass="com.xyz.XMLEditorContributor" 
         symbolicFontName="org.eclipse.jface.textfont"
         default="false"> 
      </editor> 
   </extension> 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值