教你怎樣擴展Eclipse的擴展點(二)

我們先新建一個 元素(New Element)名稱爲 extender,

這時有兩個元素了,在第一個元素上點右鍵,在彈出的對話框中選擇"序列",

再在這個新增的對象上右鍵新增一個 extender 對象。

在 extender 的明細頁中將 最大邊界選擇爲 無邊界就行了。

接下來我們給 extender 元素增加屬性,過程就省略了

 

上面是添加好的屬性,注意其中的className屬性

好了,擴展點就這樣建好了,下面我將這個擴展點文件貼出來:

<?xml version='1.0' encoding='UTF-8'?>

<!-- Schema file written by PDE -->

<schema   targetNamespace= "TheMainMenuProject" >

<annotation>

       <appInfo>

          <meta.schema   plugin= "TheMainMenuProject"   id= "org.vwpolo.rcp.extender"   name= "RCP Extension Point" />

       </appInfo>

       <documentation>

         [Enter description of this extension point.]

       </documentation>

    </annotation>

    <element   name= "extension" >

       <complexType>

          <sequence>

             <element   ref= "extender"   minOccurs= "1"   maxOccurs= "unbounded" />

          </sequence>

          <attribute   name= "point"   type= "string"   use= "required" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "id"   type= "string" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "name"   type= "string" >

             <annotation>

                <documentation>

                  

                </documentation>

                <appInfo>

                   <meta.attribute   translatable= "true" />

                </appInfo>

             </annotation>

          </attribute>

       </complexType>

    </element>

    <element   name= "extender" >

       <complexType>

          <attribute   name= "id"   type= "string"   use= "required" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "name"   type= "string"   use= "required" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "type"   use= "required" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

             <simpleType>

                <restriction   base= "string" >

                   <enumeration   value= "perspective" >

                   </enumeration>

                   <enumeration   value= "view" >

                   </enumeration>

                   <enumeration   value= "action" >

                   </enumeration>

                </restriction>

             </simpleType>

          </attribute>

          <attribute   name= "clientId"   type= "string"   use= "required" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "index"   type= "string" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "desc"   type= "string" >

             <annotation>

                <documentation>

                  

                </documentation>

             </annotation>

          </attribute>

          <attribute   name= "className"   type= "string" >

             <annotation>

                <documentation>

                  

                </documentation>

                <appInfo>

                   <meta.attribute   kind= "java"   basedOn= "org.eclipse.jface.action.Action:" />

                </appInfo>

             </annotation>

          </attribute>

       </complexType>

    </element>

    <annotation>

       <appInfo>

          <meta.section   type= "since" />

       </appInfo>

       <documentation>

         [Enter the first release in which this extension point appears.]

       </documentation>

    </annotation>

    <annotation>

       <appInfo>

          <meta.section   type= "examples" />

       </appInfo>

       <documentation>

         [Enter extension point usage example here.]

       </documentation>

    </annotation>

    <annotation>

       <appInfo>

          <meta.section   type= "apiInfo" />

       </appInfo>

       <documentation>

         [Enter API information here.]

       </documentation>

    </annotation>

    <annotation>

       <appInfo>

          <meta.section   type= "implementation" />

       </appInfo>

       <documentation>

         [Enter information about supplied implementation of this extension point.]

       </documentation>

    </annotation>

    <annotation>

       <appInfo>

          <meta.section   type= "copyright" />

       </appInfo>

       <documentation>

         

       </documentation>

    </annotation>

</schema>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章