<!ELEMENT extension (theme* , colorDefinition* , fontDefinition* , themeElementCategory* , data* , categoryPresentationBinding*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT theme (colorOverride* , fontOverride* , description? , data*)>
<!ATTLIST theme
id CDATA #REQUIRED
name CDATA #IMPLIED>
字体、颜色和数据覆盖的集合。这种集合可用来改变工作台的外观。多个 theme 元素可存在同一标识。这允许组件作者添加到现有的主题。
<!ELEMENT themeElementCategory (description)>
<!ATTLIST themeElementCategory
id CDATA #REQUIRED
parentId CDATA #IMPLIED
class CDATA #IMPLIED
label CDATA #IMPLIED>
主题元素定义的逻辑组合。此类别可包括颜色和字体。
org.eclipse.ui.themes.IThemePreview
的类<!ELEMENT colorDefinition (colorFactory? , colorValue* , description?)>
<!ATTLIST colorDefinition
id CDATA #IMPLIED
label CDATA #REQUIRED
defaultsTo CDATA #IMPLIED
value CDATA #IMPLIED
categoryId CDATA #IMPLIED
colorFactory CDATA #IMPLIED
isEditable (true | false) >
符号颜色定义。
defaultsTo
、value
或 colorFactory
的其中一项。defaultsTo
、value
或 colorFactory
的其中一项。如果指定了 value
,可通过 colorValue
元素根据平台/窗口系统指定其它值定义。themeElementCategory
的可选标识。org.eclipse.ui.themes.IColorFactory
的类。可使用它(而不是
value
)来指定颜色的缺省值。特此通知:使用时应特别谨慎,使用此属性将导致在工作台启动时激活插件。false
,则不会对用户显示添加项。<!ELEMENT fontDefinition (fontValue* , description?)>
<!ATTLIST fontDefinition
id CDATA #REQUIRED
label CDATA #REQUIRED
value CDATA #IMPLIED
categoryId CDATA #IMPLIED
defaultsTo CDATA #IMPLIED
isEditable (true | false) >
符号字体定义。
字体值。它的格式为:fontname-style-height
,其中 fontname
是字体的名称,style
是字体样式("regular"
、"bold"
、"italic"
或 "bold italic"
的其中一种),而 height
是一个表示字体高度的整数。
示例:Times New Roman-bold-36
。
只能使用 value
或 defaultsTo
的其中一个(或者两个都不使用)。
value
,可通过 fontValue
元素根据平台/窗口系统指定其它值定义。themeElementCategory
的可选标识。
只能使用 value
或 defaultsTo
的其中一个(或者两个都不使用)。
false
,则不会对用户显示添加项。<!ELEMENT colorOverride (colorFactory? , colorValue*)>
<!ATTLIST colorOverride
id CDATA #REQUIRED
value CDATA #IMPLIED
colorFactory CDATA #IMPLIED>
允许覆盖在 colorDefinition
元素中定义的颜色。将在使用该主题时应用这些颜色。
isEditable
设置为 false
的 colorDefinition
。value
或 colorFactory
的其中一个。与 colorDefinition
不同,您可以不提供用于覆盖的 defaultsTo
。org.eclipse.ui.themes.IColorFactory
的类。可使用它(而不是
value
)来指定颜色的缺省值。特此通知:使用时应特别谨慎,使用此属性将导致在工作台启动时激活插件。<!ELEMENT fontOverride (fontValue*)>
<!ATTLIST fontOverride
id CDATA #REQUIRED
value CDATA #REQUIRED>
允许覆盖在 fontsDefinition
元素中定义的字体。将在使用该主题时应用这些字体。
isEditable
设置为 false
的 fontDefinition
。此字体的覆盖值。它的格式为:fontname-style-height
,其中 fontname
是字体的名称,style
是字体样式("regular"
、"bold"
、"italic"
或 "bold italic"
的其中一种),而 height
是一个表示字体高度的整数。
示例:Times New Roman-bold-36
。
必须对字体覆盖定义 value
。与 fontDefinition
不同,您可以不提供用于 fontOverride
的 defaultsTo
。
<!ELEMENT description (#PCDATA)>
元素用法的简短描述。
<!ELEMENT colorFactory (parameter*)>
<!ATTLIST colorFactory
class CDATA #REQUIRED
plugin CDATA #IMPLIED>
colorFactory
属性的元素版本。当 colorFactory 实现
org.eclipse.core.runtime.IExecutableExtension
并且存在您希望在其初始化中使用的参数化数据时,就会使用它。
org.eclipse.ui.themes.IColorFactory
的类。它还会实现 org.eclipse.core.runtime.IExecutableExtension
。<!ELEMENT parameter EMPTY>
<!ATTLIST parameter
name CDATA #REQUIRED
value CDATA #REQUIRED>
要在 colorFactory 元素中使用的参数元素。它会作为初始化数据传递至 colorFactory 类。
<!ELEMENT data EMPTY>
<!ATTLIST data
name CDATA #REQUIRED
value CDATA #REQUIRED>
允许与主题或缺省主题相关联的任意数据的元素。此数据可以是梯度方向或百分比、标注和作者信息等等。
此元素的行为类似于定义和覆盖。如果键在缺省主题和标识主题中同时存在,将在访问该主题时使用标识主题值。如果标识主题未提供值,将使用缺省值。
<!ELEMENT colorValue (colorFactory?)>
<!ATTLIST colorValue
os CDATA #IMPLIED
ws CDATA #IMPLIED
value CDATA #IMPLIED
colorFactory CDATA #IMPLIED>
此元素允许根据平台指定颜色值。
value
或 colorFactory
的其中一个。
org.eclipse.ui.themes.IColorFactory
的类。可使用它(而不是
value
)来指定颜色值。特此通知:使用时应特别谨慎,使用此属性将导致在工作台启动时激活插件。<!ELEMENT fontValue EMPTY>
<!ATTLIST fontValue
os CDATA #IMPLIED
ws CDATA #IMPLIED
value CDATA #REQUIRED>
此元素允许根据平台指定字体值。
字体值。它的格式为:fontname-style-height
,其中 fontname
是字体的名称,style
是字体样式("regular"
、"bold"
、"italic"
或 "bold italic"
的其中一种),而 height
是一个表示字体高度的整数。
示例:Times New Roman-bold-36
。
<!ELEMENT categoryPresentationBinding EMPTY>
<!ATTLIST categoryPresentationBinding
categoryId CDATA #REQUIRED
presentationId CDATA #REQUIRED>
此元素允许将类别绑定至 org.eclipse.ui.presentationFactory
扩展点描述的特定表示。如果类别具有任何表示绑定,则仅当它绑定至活动表示时,用户才能配置它(及其子代)。这对于除去用户认为未使用的项是非常有用的。
<extension point=
"org.eclipse.ui.themes"
>
<themeElementCategory id=
"com.xyz.ThemeCategory"
class=
"com.xyz.XYZPreview"
label=
"XYZ Elements"
/>
<colorDefinition id=
"com.xyz.Forground"
categoryId=
"com.xyz.ThemeCategory"
label=
"XYZ Foreground Color"
value=
"COLOR_BLACK"
>
<!-- white should be used on GTK -->
<colorValue value=
"COLOR_WHITE"
os=
"linux"
ws=
"gtk"
/>
<description>
This color is used for the forground color of the XYZ plugin editor.</description>
</colorDefinition>
<colorDefinition id=
"com.xyz.Background"
categoryId=
"com.xyz.ThemeCategory"
label=
"XYZ Background Color"
>
<colorFactory class=
"org.eclipse.ui.themes.RGBBlendColorFactory"
plugin=
"org.eclipse.ui"
>
<parameter name=
"color1"
value=
"COLOR_WHITE"
/>
<parameter name=
"color2"
value=
"COLOR_BLUE"
/>
</colorFactory>
<!-- black should be used on GTK -->
<colorValue value=
"COLOR_BLACK"
os=
"linux"
ws=
"gtk"
/>
<description>
This color is used for the background color of the XYZ plugin editor.</description>
</colorDefinition>
<fontDefinition id=
"com.xyz.TextFont"
categoryId=
"com.xyz.ThemeCategory"
label=
"XYZ Editor Font"
defaultsTo=
"org.eclipse.jface.textfont"
>
<description>
This font is used by the XYY plugin editor.</description>
</fontDefinition>
<data name=
"com.xyz.EditorMarginWidth"
value=
"5"
/>
<theme id=
"com.xyz.HarshTheme"
label=
"Harsh Colors for XYZ"
>
<colorOverride id=
"com.xyz.Forground"
value=
"COLOR_CYAN"
/>
<colorOverride id=
"com.xyz.Background"
value=
"COLOR_MAGENTA"
/>
<data name=
"com.xyz.EditorMarginWidth"
value=
"1"
/>
</theme>
</extension>
org.eclipse.ui.IWorkbench.getThemeManager()
提供了 org.eclipse.ui.themes.IThemeManager
的实例,该实例可用于获取指定主题(根据标识,包括标识为
IThemeManager.DEFAULT_THEME
的缺省主题)或当前主题。从 org.eclipse.ui.themes.ITheme
中,您可以获取 org.eclipse.jface.resources.ColorRegistry
、org.eclipse.jface.resources.FontRegistry
以及与主题相关联的任意数据。
Copyright (c) 2003, 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html