コンテンツ型

org.eclipse.core.runtime.contentTypes

3.0

コンテンツ型拡張ポイントにより、プラグインは、プラットフォーム・コンテンツ型カタログにコントリビュートできます。 コントリビューションには、コンテンツ型ファイルの関連付け の 2 つの形式があります。

<!ELEMENT extension (content-type* , file-association*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT content-type (describer?)>

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


<!ELEMENT describer (parameter*)>

<!ATTLIST describer

class CDATA #REQUIRED>


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


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"

>

<param name=

"element"

value=

"abc"

/>

</describer>

</content-type>

</extension>

特定のファイル拡張子を持つテキスト・ベースの単純なコンテンツ型の例を以下に示します。

   

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

ディスクライバー・エレメントの class 属性の値は、org.eclipse.core.runtime.content.IContentDescriber または org.eclipse.core.runtime.content.ITextContentDescriber の 実装者を表す必要があります。

org.eclipse.core.runtime プラグインでは、 以下のコンテンツ型が提供されます。

プラットフォームの他のプラグインでは、他のコンテンツ型がコントリビュートされます。

また、org.eclipse.core.runtime プラグインでは、コンテンツ・ディスクライバーのすぐに使用可能な実装が提供されます。