コンポジット虎の巻

コンポジット虎の巻は、問題をより小さいタスクのセットに分けることによって、複雑な問題に関するガイダンスを提供します。コンポジット虎の巻は  org.eclipse.ui.cheatsheets.cheatSheetContent 拡張ポイントを使用して登録されます。

コンテンツ・ファイル・フォーマット

コンポジット虎の巻のコンテンツ自体は、別のファイルに定義されており、これはコンポジット虎の巻コンテンツ・ファイル仕様に準拠します。  コンテンツ・ファイルは XML ファイルで、ツリー構造にグループに分けて編成されたタスクのセットで構成されています。 

<compositeCheatsheet> は、コンポジット虎の巻のルート要素です。これは、<task> または <taskGroup> のいずれかの単一ルート・タスクを持ちます。 <taskGroup> 要素は、1 つ以上の子を持ちます。それぞれの子は、<task> または <taskGroup> のいずれかになります。 <task> は子タスクを持ちません。

タスクおよびタスク・グループには、タスクが開始する前に表示されるテキストを含む <intro> 要素と、タスクが完了したときに表示されるテキストを含む <onCompletion> 要素が含まれます。 <intro> 要素および <onCompletion> 要素の両方に、書式テキスト・マークアップが含まれます。以下の例で、タグ <b> と </b> はテキストをボールド体にするために使用されます。

タスクにはまた、<param> 要素が含まれます。虎の巻のタスクには、以下のパラメーターのいずれかがあります。「id」は登録済み虎の巻の ID です。「path」は虎の巻のコンテンツ・ファイルの相対パスまたは URL です。「skipIntro」は、true が、虎の巻を概要ではなく最初のステップで開始させた場合のブール・パラメーターです。   「id」または「path」の (両方ではなく) どちらかを指定する必要があります。

タスク「B」からタスク「A」への <dependency> ノードは、タスク A はタスク B が開始される前に完了する必要があることを表しています。

虎の巻のタスク・パラメーター

タスクの種類が "cheatsheet" の場合、このタスクの開始時に虎の巻が開きます。虎の巻のタスクには 3 種類のパラメーターがあります。

パラメーター名  説明
id 拡張ポイント org.eclipse.ui.cheatsheets.cheatSheetContent を使用して登録されている虎の巻の ID。これはこのタスクに関連付けられる虎の巻を表します。 ID パラメーターか path パラメーターのいずれか (両方でない) を指定する必要があります。
path 虎の巻コンテンツ・ファイルの URL。これはコンポジット虎の巻のコンテンツ・ファイルの絶対 URL か相対 URL です。 id と path の両方が指定された場合、path によってコンテンツ・ファイルの場所を特定し、id パラメーターは無視されます。
showIntro デフォルト値が true であるブール・パラメーター。「false」の場合、虎の巻は開始時に、まず、概要ではなく最初のステップを表示します。

コンポジット虎の巻の例

下のファイルは、既存の虎の巻からコンポジット虎の巻を作成する方法の例です。また、タスク・グループを作成しそれをスキップ可能にする方法を示しています。

<?xml version="1.0" encoding="UTF-8"?>
<compositeCheatsheet name="Composite cheat sheet example">
    <taskGroup name= "Composite cheat sheet example">
         <intro> This is an example of a <b>composite cheat sheet</b> built from existing cheat sheets.
                 <br/><br/>You can select a task to work on either by following the hyperlinks or by
                 selecting a task in the tree. 
  </intro>
         <onCompletion>Congratulations you have completed all the tasks.</onCompletion>             
         <task kind="cheatsheet" name= "Branching and merging using CVS" skip="true">
              <param name = "id" value = "org.eclipse.platform.cvs_1" />
              <intro>This cheat sheet is intended for CVS users. If you are not using CVS or do
              not intend to branch and merge you may skip this task.
  </intro>
               <onCompletion>Congratulations you now know how to branch and merge.</onCompletion>                  
             </task>
         <taskGroup name= "Create Java Projects" kind = "sequence">
             <intro> First you will learn how to create a simple java project, then you will create 
             an java project which uses SWT. 
             <br/><br/>This task group is a sequence which means that
             if you click on the subtask "Standalone SWT Application" it will not let that task be started 
             until "Create a java project" has been completed.
  </intro>
              <onCompletion>Congratulations you have built both Java applications.</onCompletion>
         <task kind="cheatsheet" name= "Create a java project" id = "createJavaProject">
             <param name="id" value = "org.eclipse.jdt.helloworld"/>
                 <param name="showIntro" value = "false"/>
                 <intro>This cheat sheet walks through the process of creating a simple hello world application. 
                        The cheat sheet can launch wizards to create a new project and a new class. 
  </intro>
             <onCompletion>Congratulations you have succeeded in creating a hello world application</onCompletion>
             </task>
             <task kind="cheatsheet" name= "Standalone SWT Application">
                  <intro>Eclipse plugins which contribute to the user interface use The Standard Widget Toolkit (SWT). 
                        This task guide can be used to learn more about SWT. 
  </intro>
                  <param name = "id" value = "org.eclipse.jdt.helloworld.swt" />
                  <onCompletion>Congratulations you have succeeded in creating an SWT application.</onCompletion>           
             </task>
    </taskGroup>
    </taskGroup>
</compositeCheatsheet>

コンポジット虎の巻の拡張性 - Eclipse 3.2 内で一時的に

コンポジット虎の巻は拡張可能ですが、Eclipse 3.2 内ではこの拡張性は一時的であり、クラスは API になる前に変更される可能性があります。コンポジット虎の巻のサポートは、拡張ポイント org.eclipse.ui.cheatsheets.cheatSheetContent を使用して拡張できます。これは 2 つの新しい要素 taskEditor と taskExplorer を備えていて、タスク・エディターとタスク・エクスプローラーのコントリビューションを可能にします。

タスク・エディターのコントリビューションは、タスク詳細セクションに表示される新規の種類のタスクを定義します。タスク・エディターをコントリビュートするには、TaskEditor の具象サブクラスをインプリメントし、次に taskEditor 要素を plugin.xml に追加します。

タスク・エクスプローラーの表記も、拡張ポイントで構成可能であり、ツリー・エクスプローラーは Eclipse プラットフォームに含まれています。デフォルトでは、最初に開いたときのコンポジット虎の巻のエクスプローラーはツリーです。<compositeCheatSheet> 要素上の属性は、デフォルトのオーバーライドを許可します。複数のエクスプローラーが登録されている場合は、ビュー・メニューには、エクスプローラーの間を切り替えるメニュー項目が含まれます。タスク・エクスプローラーをコントリビュートするには、まず、TaskExplorer の具象サブクラスをインプリメントし、次に TaskExplorer 要素を plugin.xml に追加します。

関連リンク

虎の巻の操作
コンポジット虎の巻の操作
虎の巻の作成
オーサリング・ガイドライン
コンポジット虎の巻コンテンツ・ファイル仕様
org.eclipse.ui.cheatsheets.cheatSheetContent 拡張ポイント