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 元素中使用描述子屬性,就會忽略這個元素。
<!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.
這個程式和檢附的資料是遵循這項分送檢附的 Eclipse Public License 1.0 版的條款而提供的,
請造訪下列網址來取得此條款:http://www.eclipse.org/legal/epl-v10.html