org.eclipse.ui.decorators

您的外掛程式可以使用 Decorator 來註解出現在工作台檢視畫面中的資源和其他物件影像。當您的外掛程式為現有的資源類型新增功能時,Decorators 是非常有用的。許多標準工作台檢視畫面參與顯示裝飾。

例如,PDE 提供 Decorator,讓您分辨二進位專案和原始檔專案。

PDE Decorator 的套件瀏覽器檢視畫面

com.example.sourceProject  專案是顯示在導覽器中唯一的原始檔專案。請注意所有其他二進位專案在 Java 專案圖示的左上方顯示二進位 Decorator。此 Decorator 是 PDE 使用 org.eclipse.ui.decorators 延伸點所提供。

<extension
   point="org.eclipse.ui.decorators">
      <decorator
            objectClass="org.eclipse.core.resources.IResource"
            adaptable="true"
            label="%decorator.label"
            state="false"
            class="org.eclipse.pde.internal.ui.wizards.imports.BinaryProjectDecorator"
            id="org.eclipse.pde.ui.binaryProjectDecorator">
         <description>
            %decorator.desc
         </description>
      </decorator>
</extension>

class 屬性應該命名一個實作 ILabelDecorator 的類別。這個類別讓您以本身的附註裝飾原始標籤影像和文字。labeldescription 屬性指派喜好設定對話框中所用來指定和說明 Decorator 的文字。objectClass 指定套用 Decorator 的物件類別。adaptable 旗號指出是否應該裝飾適用於類別的物件。state 旗號控制 Decorator 是否依預設為可見的。

Decorators 最終由使用者透過工作台標籤裝飾喜好設定頁面來控制。個別的 Decorator 可以被開啟或關閉。即使是這樣,設計您的 Decorator 以致於 他們不用與現有的平台 SDK Decorator 重疊或衝突,是一個好方法。如果您的 Decorator 包含難以計算或潛在複雜的資訊,當它開啟時,您可能要提供自己的喜好設定,讓使用者做進一步 細部調整 Decorator。這是 CVS 從屬站所使用的技術。

CVS Decorator 喜好設定頁面

 

Copyright IBM Corp. and others 2000,2002.