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.
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