치트 시트 컨텐츠 파일 XML 형식

버전 3.2

이 문서에서는 치트 시트 컨텐츠 파일 구조를 일련의 DTD 단편(시스템 읽기 가능 XML 스키마)으로 설명합니다.

cheatsheet

<!ELEMENT cheatsheet (intro, item+)> 
<!ATTLIST cheatsheet 
  title               CDATA #REQUIRED
>

<cheatsheet> 요소에서는 치트 시트 컨텐츠 파일의 본문을 정의합니다. <cheatsheet> 속성은 다음과 같습니다.

intro

<!ELEMENT intro (description)>
<!ATTLIST intro 
  contextId           CDATA #IMPLIED 
  href                CDATA #IMPLIED 
>

<intro> 요소를 사용하여 표시할 치트 시트 소개를 설명합니다. <description> 하위 요소에는 소개 본문이 들어 있습니다. <intro> 속성은 다음과 같습니다.

description

<!ELEMENT description EMPTY>
<!ATTLIST description 
>

<description> 요소에는 치트 시트 또는 치트 시트 항목에 대한 설명이 들어 있습니다. 해당 설명은 단순 형식화 태그가 있는 텍스트로 구성됩니다. 치트 시트는 텍스트를 UI에 제대로 표시하도록 자동으로 형식화 및 배치합니다. 텍스트에서 짝이 맞는 <b>...</b> 태그를 사용하면 해당 태그로 둘러싸인 텍스트를 굵은체 글꼴로 렌더링할 수 있고, <br/> 요소를 사용하면 행 바꾸기를 강제 실행할 수 있습니다. 이러한 태그가 이 경우에 지원되는 유일한 형식화 태그입니다. 하지만 나중에 다른 태그를 추가할 수도 있습니다. XML 구문 분석기에서 중요한 텍스트의 특정 문자가 있습니다. 특히 "&lt;", "&gt;", "&amp;", "&apos;" 및 "&quot;"를 쓰는 대신 "<", ">", "&", "'" 및 """(물음표)를 씁니다. 공백(공백 및 행 바꾸기)은 단어 분리자로 처리되고 인접 공간 및 행 바꾸기는 단일 단위로 처리되어 단일 공백 또는 행 바꾸기로 렌더링됩니다. </description> 태그 바로 앞의 공백과 마찬가지로 <description> 및 <br/> 태그 바로 뒤의 공백도 무시됩니다.

item

<!ELEMENT item (description ([action|command|perform-when] | (subitem|repeated-subitem|conditional-subitem)*) [onCompletion])> 
<!ATTLIST item 
  title               CDATA #REQUIRED
  dialog              ("true" | "false") "false"
  skip                ("true" | "false") "false"
  contextId           CDATA #IMPLIED 
  href                CDATA #IMPLIED
>

각 <item> 요소에서는 치트 시트에 있는 하나의 최상위 레벨을 설명합니다. <item>은 <subitem> 요소를 포함합니다. <item> 속성은 다음과 같습니다.

org.eclipse.ui.cheatsheets.cheatSheetItemExtension을 사용하면 항목의 추가 사용자 정의 제어를 UI에 표시할 수 있습니다. 이러한 확장점에 대한 컨트리뷰션은 <item> 요소에 표시할 수 있는 문자열 값의 추가 속성 이름을 선언합니다.

단순 항목에는 설명 및 선택적 조치나 명령이 포함됩니다. 대부분의 경우 일반 프리젠테이션에서 치트 시트 항목의 제목이 사용자에게 표시됩니다. 단계를 실행하는 동안에만 항목에 대한 설명이 표시됩니다. <action>, <command> 또는 <perform-when> 요소는 사용자가 단계 조치나 명령을 수행하도록 누를 수 있는 단추와 연관됩니다. 조치나 명령이 없는 경우 이 단계에서는 사용자가 직접 해당 단계를 수행하여 제대로 완료했음을 표시해야 합니다.

단계는 <subitem> 하위 요소에서 지정한 대로 하위 단계로 나누어집니다. 순서를 엄격히 지켜야 하는 항목과는 달리 해당 항목의 하위 항목은 임의의 순서로 수행할 수 있습니다. 항목 내의 모든 하위 항목을 다음 항목으로 진행하기 전에 먼저 시도하거나 건너뛰어야 합니다. 이는 정해진 순서대로 수행해야 하는 조치는 하위 항목으로 표시할 수 없음을 의미합니다.

<conditional-subitem> 하위 요소를 사용하면 이전 단계에서 값을 확보한 치트 시트 변수에 기초하여 한 단계에서 하위 단계의 프리젠테이션을 조정할 수 있습니다. <repeated-subitem> 하위 요소를 사용하면 한 단계에 유사한 하위 단계 세트를 포함시킬 수 있습니다. 즉, 하위 단계의 해당 세트는 이전 단계에서 값을 확보한 치트 시트 변수에 기초합니다.

subitem

<!ELEMENT subitem ( [action|command|perform-when] )> 
<!ATTLIST subitem 
  label               CDATA #REQUIRED
  skip                ("true" | "false") "false"
  when                CDATA #IMPLIED
>

각 <subitem> 요소에서는 치트 시트에 있는 하위 단계를 설명합니다. <subitem>에 단순 텍스트 레이블은 있지만 긴 설명이나 하위 항목은 들어 있지 않습니다. <subitem> 속성은 다음과 같습니다.

하위 항목에는 선택적 조치나 명령이 있습니다. <action>, <command> 또는 <perform-when> 요소는 일반적으로 하위 단계 조치나 명령을 수행하도록 누를 수 있는 단추와 연관됩니다. 조치나 명령이 없는 경우 이 하위 단계에서는 사용자가 직접 해당 단계를 수행하여 제대로 완료했음을 표시해야 합니다.

순서를 엄격히 지켜야 하는 항목과는 달리, 해당 항목의 하위 항목은 임의의 순서로 수행할 수 있습니다. 항목내의 모든 하위 항목은 다음 항목을 진행하기 전에 완료하거나 건너뛰어야 합니다. 이는 정해진 순서대로 수행해야 하는 조치는 하위 항목으로 표시할 수 없음을 의미합니다.

conditional-subitem

<!ELEMENT conditional-subitem (subitem+)> 
<!ATTLIST conditional-subitem 
  condition               CDATA #REQUIRED
>

각 <conditional-subitem> 요소에서는 항목을 확장할 때 알려진 조건에 기초하여 양식이 달라질 수 있는 단일 하위 단계를 설명합니다. <conditional-subitem> 속성은 다음과 같습니다.

<conditional-subitem> 요소의 condition 속성에서는 치트 시트 변수에 따라 문자열 값을 제공합니다. 각 하위 <subitem>에서는 특정 문자열 값과 함께 when 속성을 제공해야 합니다. 항목을 확장할 때 <conditional-subitem> 요소는 값이 일치하는 <subitem> 요소로 바뀝니다. 값이 일치하는 <subitem> 요소가 없는 경우 오류로 간주됩니다.

예를 들어, 다음 항목을 확장할 때 치트 시트 변수 "v1"의 값이 "b"인 경우 다음과 같습니다.

<item ...> 
  <conditional-subitem condition="${v1}">
     <subitem when="a" label="Step for A." />
     <subitem when="b" label="Step for B." />
     </conditional-subitem>
</item>
그런 다음 두 번째 하위 항목이 선택되고 해당 항목은 다음과 같이 확장됩니다.
<item ...> 
  <subitem label="Step for B."/>
</item>

repeated-subitem

<!ELEMENT repeated-subitem (subitem)> 
<!ATTLIST repeated-subitem 
  values               CDATA #REQUIRED
>

각 <repeated-subitem> 요소에서는 0 또는 하나 이상의 유사한 하위 단계로 확장하는 하위 항목을 설명합니다. <repeated-subitem> 속성은 다음과 같습니다.

values 속성에서는 쉼표로 구분된 문자열 목록을 제공합니다. 하위 <subitem>에서는 템플리트를 제공합니다. 항목을 확장할 때 <repeated-subitem> 요소는 해당 문자열 값으로 바뀌는 "this" 변수의 발생과 함께 <subitem> 요소의 사본으로 바뀝니다.

예를 들어, 다음 항목을 확장할 때 치트 시트 변수 "v1"의 값이 "1,b,3"인 경우 다음과 같습니다.

<item ...> 
  <repeated-subitem values="${v1}">
     <subitem label="Step ${this}.">
        <action class="com.xyz.myaction" pluginId="com.xyz" param1="${this}"/>
  </subitem>
  </repeated-subitem>
</item>
그런 다음 해당 항목은 다음과 같이 확장됩니다.
<item ...> 
  <subitem label="Step 1.">
     <action class="com.xyz.myaction" pluginId="com.xyz" param1="1"/>
  </subitem>
  <subitem label="Step b.">
     <action class="com.xyz.myaction" pluginId="com.xyz" param1="b"/>
  </subitem>
  <subitem label="Step three.">
     <action class="com.xyz.myaction" pluginId="com.xyz" param1="three"/>
  </subitem>
</item>

action

<!ELEMENT action EMPTY> 
<!ATTLIST action 
  class               CDATA #REQUIRED
  pluginId            CDATA #REQUIRED
  param1              CDATA #IMPLIED
  ...
  param9              CDATA #IMPLIED
  confirm             ("true" | "false") "false"
  when                CDATA #IMPLIED
>

각 <action> 요소에서는 치트 시트에 있는 조치를 설명합니다. <action> 속성은 다음과 같습니다.

command

<!ELEMENT command EMPTY> 
<!ATTLIST command 
  serialization       CDATA #REQUIRED
  returns             CDATA #IMPLIED
  confirm             ("true" | "false") "false"
  when                CDATA #IMPLIED
>

각 <command> 요소는 치트 시트의 명령을 설명합니다. <command> 속성은 다음과 같습니다.

다음은 대화 상자를 열고 결과를 치트 시트 변수 "result"에 저장하는 명령을 사용하는 항목의 예입니다.

  <item title="View Selection">
     <description>Select a view which will be opened in the next step.</description>
     <command returns = "result"
      serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select View,buttonLabel0=Package Explorer,message=Select a view ,buttonLabel1=Search View)"/>  
      <onCompletion> Selected the ${result}. </onCompletion>
</item>

onCompletion

<!ELEMENT onCompletion EMPTY>
<!ATTLIST onCompletion 
>

<onCompletion> 요소에는 항목이 완료되었을 때 표시되는 텍스트가 포함됩니다. 이는 전체 타스크 완료를 통보하도록 하는 치트 시트의 마지막 단계에서 유용하게 사용됩니다. 설명은 단순 형식화 태그가 있는 텍스트로 구성되고 <description> 요소와 동일한 규칙을 사용합니다. <onCompletion> 요소에는 "${var}" 양식의 치트 시트 변수에 대한 참조가 포함되며 이 단계가 완료될 때 치트 시트 변수 var의 실제 값을 사용하여 확장됩니다.

perform-when

<!ELEMENT perform-when ((action|command)+)> 
<!ATTLIST perform-when 
  condition               CDATA #REQUIRED
>

각 <perform-when> 요소에서는 치트 시트에 있는 조치를 설명합니다. <perform-when> 속성은 다음과 같습니다.

<conditional-subitem> 요소의 condition 속성에서는 치트 시트 변수에 따라 문자열 값을 제공합니다. 각 하위 <subitem>에서는 특정 문자열 값과 함께 when 속성을 제공해야 합니다. 항목을 확장할 때 <conditional-subitem> 요소는 값이 일치하는 <subitem> 요소로 바뀝니다. 값이 일치하는 <subitem> 요소가 없는 경우 오류로 간주됩니다.

예를 들어, 다음 항목을 확장할 때 치트 시트 변수 "v1"의 값이 "b"인 경우 다음과 같습니다.

<item ...>
  <subitem label="Main step">
     <perform-when condition="${v1}">
        <action when="a" class="com.xyz.action1" pluginId="com.xyz" />
        <action when="b" class="com.xyz.action2" pluginId="com.xyz" />
        <command when="c" serialization="org.eclipse.search.ui.views.SearchView"/>
     </conditional-subitem>
  </subitem>
</item>
그런 다음 두 번째 조치가 선택되고 해당 항목은 다음과 같이 확장됩니다.
<item ...> 
  <subitem label="Main step">
     <action class="com.xyz.action2" pluginId="com.xyz" />
  </subitem>
</item>

예제

다음은 perform-when 명령 사용 및 조건부 하위 항목을 설명하는 단순 치트 시트 컨텐츠 파일의 예입니다.

<?xml version="1.0" encoding="UTF-8" ?>
<cheatsheet title="Sample Cheat Sheet">
  <intro>
    <description>A cheat sheet which demonstrates the use of perform-when and conditional subitems</description>
  </intro>
  <item title="View Selection">
     <description>Select a view which will be opened in the following steps.</description>
     <command returns = "result"
      serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select View,buttonLabel0=Package Explorer,message=Select a view ,buttonLabel1=Search View)"/>  
      <onCompletion> Selected the ${result}. </onCompletion>
</item>
  <item title="Close Views">
     <description>Close the search view and package explorer if open</description>
</item>
  <item title="Open the view from a perform when item" skip = "true">
     <description>Uses perform when to open the view seleted previously.</description> 
     <perform-when condition = "${result}">
           <command when = "Package Explorer" 
            serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.PackageExplorer)"/>
           <command when = "Search View" 
            serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.search.ui.views.SearchView)"/>      
	</perform-when>
</item>
  <item title="Close Views">
     <description>Close the search view and package explorer if open</description>
</item>
  <item title="Open the view from a perform when subitem">
     <description>Uses perform when to open the view seleted previously.</description> 
     <subitem label="Perform when subitem" skip = "true">
     <perform-when condition = "${result}">
           <command when = "Package Explorer" 
            serialization="org.eclipse.jdt.ui.PackageExplorer"/>
           <command when = "Search View" 
            serialization="org.eclipse.search.ui.views.SearchView"/>      
	</perform-when>
  </subitem>
</item>
  <item title="Close Views">
     <description>Close the search view and package explorer if open</description>
</item>
  <item title="Open the view from a conditional subitem">
     <description>Uses perform when to open the view seleted previously.</description> 
      <conditional-subitem condition="${result}">
         <subitem when="Package Explorer" label="Open package explorer.">
             <command serialization = "org.eclipse.jdt.ui.PackageExplorer"/>
  </subitem>
         <subitem when="Search View" label="Open Search View">
             <command serialization = "org.eclipse.search.ui.views.SearchView"/>
  </subitem>
     </conditional-subitem>
</item>
</cheatsheet>