컨텐츠 유형

org.eclipse.core.runtime.contentTypes

3.0

컨텐츠 유형 확장점을 사용하면 플러그인에서 플랫폼 컨텐츠 유형 카탈로그를 제공할 수 있습니다. content typesfile associations와 같이 두 가지 양식의 컨트리뷰션이 있습니다.

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


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

다음은 파일 확장자가 특정한 단순 텍스트 기반 컨텐츠 유형에 관한 예제입니다.

   

<extension point=

"org.eclipse.core.runtime.contentTypes"

>

<content-type id=

"MyText"

base-type=

"org.eclipse.core.runtime.text"

file-extensions=

"mytxt"

/>

</extension>

새 파일 이름/확장자를 기존 컨텐츠 유형에 연관시켜야 할 때(새 컨텐츠 유형 정의와는 반대로) 아래에 표시된 것처럼 플러그인에서는 파일 연관을 제공할 수 있습니다. 이것은 "*.mytxt" 패턴을 따르는 이름을 갖는 파일을 포함시키기 위해 텍스트 컨텐츠 유형의 정의를 향상시키는 효과를 갖습니다.

   

<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.content.IContentDescriber 또는 org.eclipse.core.runtime.content.ITextContentDescriber의 구현자를 표시해야 합니다. org.eclipse.core.runtime.content API에 의해 리턴되는 org.eclipse.core.runtime.content.IContentDescription 오브젝트

org.eclipse.core.runtime 플러그인에서는 다음 컨텐츠 유형을 제공합니다.

플랫폼의 다른 플러그인에서는 다른 컨텐츠 유형을 제공합니다.

또한 org.eclipse.core.runtime 플러그인에서는 컨텐츠 설명자의 사용 가능한 구현을 제공합니다.