質問

I am creating my own extension point for my Eclipse plugin and I also had a look at the schemas of other extension points, e.g. org.eclipse.ui.editors.

However, one thing I don't understand: When adding extensions in plugin.xml using the extension editor, elements like "editor" are added as childelements to "extension". However, in the extension point schema, these elements are not declared as child elements of "extension" but on the same level. How does this fit together?

This is the generated xml when registering an extension:

<plugin>
    <extension
         point="org.eclipse.ui.editors">
        <editor
            class="mc.umlp.cd.graphics.CDGraphicsEditor"
            ....>
        </editor>
    </extension>
</plugin>

This is an extract from editors.exsd.

<schema targetNamespace="org.eclipse.ui" xmlns="http://www.w3.org/2001/XMLSchema">
    ...
    <element name="extension">
    ...
    </element>
    <element name="editor">
    ...
    </element>

    <element name="contentTypeBinding">
    ...
    </element>
...
</schema>

When I try to register extensions to my own extension point, I can't add any child elements to the extension, which would be what I expect looking at the extension point schema.

役に立ちましたか?

解決

You use a sequence or choice to add references to other elements:

<element name="extension">
  <complexType>
     <sequence minOccurs="1" maxOccurs="unbounded">
        <element ref="detail"/>
     </sequence>
     ...
  </complexType>
</element>

<element name="detail">
 ....
</element>

The Definition tab looks like this:

enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top