alias-for
屬性)。
使用這項特性時:
<!ELEMENT extension (content-type* , file-association*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT content-type (describer? , property*)>
<!ATTLIST content-type
id CDATA #REQUIRED
base-type CDATA #IMPLIED
name CDATA #REQUIRED
file-extensions CDATA #IMPLIED
file-names CDATA #IMPLIED
priority (low|normal|high) "normal"
default-charset CDATA #IMPLIED
describer CDATA #IMPLIED
alias-for CDATA #IMPLIED>
<content-type>
<property name=
"org.eclipse.core.runtime.charset"
default=
"charset-name"
/>
</content-type>
<!ELEMENT describer (parameter*)>
<!ATTLIST describer
class CDATA #REQUIRED
plugin CDATA #IMPLIED>
如果 content-type 元素中使用 describer 屬性,將忽略此元素。
<!ELEMENT file-association EMPTY>
<!ATTLIST file-association
content-type CDATA #REQUIRED
file-names CDATA #IMPLIED
file-extensions CDATA #IMPLIED>
<!ELEMENT parameter EMPTY>
<!ATTLIST parameter
name CDATA #REQUIRED
value CDATA #REQUIRED>
<!ELEMENT property EMPTY>
<!ATTLIST property
name CDATA #REQUIRED
default CDATA #IMPLIED>
宣告此內容類型相關的內容,可選擇指派預設值。如需內容的相關資訊,請參閱 org.eclipse.core.runtime.content.IContentDescription。
org.eclipse.core.runtime.content.XMLRootElementContentDescriber
來宣告 XML 內容類型的範例:
以下是具有特定副檔名的簡單文字型內容類型的範例:<extension point=
"org.eclipse.core.runtime.contentTypes"
>
<content-type id=
"ABC"
base-type=
"org.eclipse.core.runtime.xml"
file-extensions=
"a,b,c"
>
<describer class=
"org.eclipse.core.runtime.content.XMLRootElementContentDescriber"
>
<parameter name=
"element"
value=
"abc"
/>
</describer>
</content-type>
</extension>
需要建立新檔名/副檔名和現有內容類型的關聯性時(與定義新的內容類型相反),外掛程式可以外掛檔案關聯,如下所示。如此可加強文字內容類型的定義,加入名稱符合 "*.mytxt" 型樣的檔案。<extension point=
"org.eclipse.core.runtime.contentTypes"
>
<content-type id=
"MyText"
base-type=
"org.eclipse.core.runtime.text"
file-extensions=
"mytxt"
/>
</extension>
以下是定義內容的內容類型範例:<extension point=
"org.eclipse.core.runtime.contentTypes"
>
<file-association content-type=
"org.eclipse.core.runtime.text"
file-extensions=
"mytxt"
/>
</extension>
<extension point=
"org.eclipse.core.runtime.contentTypes"
>
<content-type id=
"MyContentType"
file-extensions=
"dat"
>
<property name=
"file-format"
value=
"1"
/>
</content-type>
</extension>
org.eclipse.core.runtime 外掛程式提供下列內容類型:
另外,org.eclipse.core.runtime 外掛程式也提供可以使用的內容說明子實作:
Copyright (c) 2004, 2005 IBM Corporation and others.
All
rights reserved. 本程式與隨附的資料依照 Elipse Public License 1.0 版此次發行所隨附的條款而提供,
可以在以下網址取得:http://www.eclipse.org/legal/epl-v10.html