目錄(TOC)

org.eclipse.help.toc

用來登錄個別外掛程式的線上說明構成要素。

每個提供說明檔的外掛程式通常都應該執行下列動作:

選擇性地,可以使用 index 元素預先建置並登錄搜尋索引,以執行第一次搜尋嘗試。每一個外掛程式只能登錄一個索引 - 多個 index 元素會導致未定義的行為。

<!ELEMENT extension (toc* , index?)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT toc EMPTY>

<!ATTLIST toc

file     CDATA #REQUIRED

primary  (true | false) "false"

extradir CDATA #IMPLIED>


<!ELEMENT index EMPTY>

<!ATTLIST index

path CDATA #REQUIRED>

自 3.1 後)容許宣告由此外掛程式提供的文件所建立的預先建置之搜尋索引之選用性元素。



下列是使用 toc 延伸點的範例。

(在 plugin.xml 檔中)

 

<extension point=

"org.eclipse.help.toc"

>

<toc file=

"maindocs.html"

primary=

"true"

/>

<toc file=

"task.xml"

/>

<toc file=

"sample.xml"

extradir=

"samples"

/>

<index path=

"index/"

/>

</extension>

(在 maindocs.xml 檔中)

<toc label="Help System Example">
 <topic label="Introduction" href="intro.html"/>
 <topic label="Tasks">
  <topic label="Creating a Project" href="tasks/task1.html">
   <topic label="Creating a Web Project" href="tasks/task11.html"/>
   <topic label="Creating a Java Project" href="tasks/task12.html"/>
  </topic>
  <link toc="task.xml" />
  <topic label="Testing a Project" href="tasks/taskn.html"/>
 </topic>
 <topic label="Samples">
  <topic label="Creating Java Project" href="samples/sample1.html">
   <topic label="Launch a Wizard" href="samples/sample11.html"/>
   <topic label="Set Options" href="samples/sample12.html"/>
   <topic label="Finish Creating Project" href="samples/sample13.html"/>
  </topic>
  <anchor id="samples" />
 </topic>
</toc>


(在 tasks.xml 檔中)

<toc label="Building a Project">
 <topic label="Building a Project" href="build/building.html">
  <topic label="Building a Web Project" href="build/web.html"/>
  <topic label="Building a Java Project" href="build/java.html"/>
 </topic>
</toc>


(在 samples.xml 檔中)

<toc link_to="maindocs.xml#samples" label="Using The Compile Tool">
 <topic label="The Compile Tool Sample" href="compilesample/example.html">
  <topic label="Step 1" href="compilesample/step1.html"/>
  <topic label="Step 2" href="compilesample/step2.html"/>
  <topic label="Step 3" href="compilesample/step3.html"/>
  <topic label="Step 4" href="compilesample/step4.html"/>
 </topic>
</toc>

假設更多文件存在於以 samples 起始的路徑,它們將不會顯示在導覽樹狀結構中,但可以使用搜尋來存取。 這是因為在 plugin.xml 檔案<toc file="sample.xml" extradir="samples" /> 元素的 extradir 屬性的存在。 例如,搜尋「建立 Java 專案」會傳回「建立 Java 專案的其他方法」文件,路徑為 samples/sample2.html。

國際化字串 「TOC XML」檔可加以轉換,而且產生的副本(具有已翻譯的標籤)應該置於 nl/<language>/<country> 或 nl/<language> 目錄中。  <language> 和 <country> 代表在語言環境碼中使用、有兩個字母的語言碼和國碼。例如,繁體中文轉換應該置於 nl/zh/TW 目錄中。   nl/<language>/<country> 目錄比起 nl/<language> 具有更高的優先順序。僅在 nl/<language>/<country> 找不到檔案時,才會使用 nl/<language> 中常駐的檔案。 外掛程式的根目錄將放在最後搜尋。

可以藉由建立包含翻譯後版本文件的 doc.zip 檔,將這個 zip 檔中的文件本土化,並將 doc.zip 放置在
nl/<language>/<country> 或 nl/<language> 目錄下。在預設為 plugin 目錄前,說明系統將在這個目錄下尋找檔案。
 

使用這個延伸點不需要程式碼。只需要提供 plugin.xml 檔中所提及的適當 manifest 檔就行了。

Eclipse 平台所提供的說明系統 UI 之預設實作能充分支援 toc 延伸點。