指令影像

org.eclipse.ui.commandImages

3.2

影像延伸點可將不同類型的影像和圖示鏈結特定指令。每當使用者介面中顯示指令時,可適當地使用這些影像。為顧及一些難以歸類的情況(例如,工具列下拉項目),可將特定指令的影像組合成「樣式」。在顯示指令時,可以具體要求這些樣式。

<!ELEMENT extension (image*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT image EMPTY>

<!ATTLIST image

commandId    CDATA #REQUIRED

icon         CDATA #REQUIRED

disabledIcon CDATA #IMPLIED

hoverIcon    CDATA #IMPLIED

style        CDATA #IMPLIED>

與特定指令建立關聯性的影像。



<extension point=

"org.eclipse.ui.commandsImages"

>

<image commandId=

"ProfileLast"

hoverIcon=

"icons/full/etool16/profile.gif"

disabledIcon=

"icons/full/dtool16/profile.gif"

icon=

"icons/full/etool16/profile.gif"

/>

<image commandId=

"ProfileLast"

hoverIcon=

"icons/full/etool16/history.gif"

disabledIcon=

"icons/full/dtool16/history.gif"

icon=

"icons/full/etool16/history.gif"

imageStyle=

"toolbar"

/>

</extension>

在工作台內,可利用 org.eclipse.ui.handlers.ICommandImageService 介面來取得指令的影像。此介面可以從支援工作台物件,例如 IWorkbench 本身擷取。若要擷取服務,您可以呼叫 IWorkbench.getAdapter(ICommandImageService.class)