指名為 Readme 的下拉式功能表只在Readme 檔編輯器有焦點時出現。 包含之前描述的動作:「Readme Editor Action 1」、「Readme Editor Action 2」和「Readme Editor Action 3」。
副檔名為 .readme 的檔案可將開頭為數字的區段分割為一節一節。 例如,輸入下列文字至 readme 檔案編輯器中,Readme 工具會偵測到 2 節區段。 要了解在 Readme 工具中如何偵測區段,請在 Readme 檔編輯器中輸入一些文字, 輸入 CTRL-S 或選取「檔案->儲存」儲存檔案。開啟「Readme 區段」檢視畫面並且從 「導覽器」檢視畫面中選取 .readme 檔案。
範例文字:
99.1 This is my first section
This is some text in my first section.
99.1.1 This is a sub section
This is some text in my sub-section.
在「概要」檢視畫面選取區段可以看見拖放功能然後拖曳選項至文字檔的頂端。 新增選項的內容至檔案中。
這範例也提供外掛程式中宣告的延伸點。 外掛程式所需的 IReadmeFileParser 類別,使用這個範例定義的 org.eclipse.ui.examples.readmetool.sectionParser 延伸項目。 類別 DefaultSectionParser 是 IReadmeFileParser 的範例實作。
類別 ReadmeEditor 實作 IEditorPart,被定義為在 plugin.xml 中使用 org.eclipse.ui.editors 延伸點 的延伸項目 .readme 檔案編輯器。 類別 ReadmeSectionsView 實作 IViewPart 使用 org.eclipse.ui.views 延伸點定義檢視畫面。 延伸點也定義檢視畫面種類供檢視畫面選項使用。
喜好設定設定的兩個類型定義在這個範例中,工作台喜好設定和資源內容。 工作台喜好設定定義於實作 IWorkbenchPreferencePage 的 ReadmePreferencePage 類別中, 以便它將新增至「視窗」->「喜好設定」對話框。在 plugin.xml 中的延伸點 org.eclipse.ui.preferencePages 定義類別。 兩個資源內容頁面為 ReadmeFilePropertyPage 和 ReadmeFilePropertyPage2,兩者皆實作 IWorkbenchPropertyPage。 他們皆定義為 org.eclipse.ui.propertyPages 延伸點中 plugin.xml 之 objectClas 標示的 IFile 類型所呼叫。
實作 INewWizard 的類別 ReadmeCreationWizard 而且被定義於 org.eclipse.ui.newWizards 延伸點中的 plugin.xml 檔案。 延伸點也定義使用者選取「檔案」->「新建」->「範例...」時, 將顯示哪一種類的精靈。
新增某些動作 Stub 至此範例中。動作集宣告功能表,標籤為 Readme File Editor ,使用延伸點 org.eclipse.ui.actionSets 被併入至工作台視窗功能表列中。 也使用標示 toolbarPath 和 manubarpath 為工作台工具列和功能表列定義動作。 它使用 WindowActionDelegate 類別實作 IWorkbenchWindowActionDelegate to 來實作這個動作。 這個蹦現功能表動作被 org.eclipse.ui.popupMenus 延伸點中的 PopupMenuActionDelegate 類別定義為 objectContribution。 PopupMenuActionDelegate 實作 IObjectActionDelegate 並使用提供的 IWorkbenchPart 來開啟訊息對話框。 檢視畫面動作 ViewActionDelegate 被定義於 org.eclipse.ui.viewActions 延伸點中並實作 IViewActionDelegate。 它所出現的檢視畫面為標示 targetID 所定義,在這個範例中為 org.eclipse.ui.views.ResourceNavigator。 編輯器動作為類別 EditorActionDelegate 所定義並實作 IEditorActionDelegate,而且使用 org.eclipse.ui.editorActions 延伸點來新增。 它所適用的編輯器為標示 targetID 所定義,在這個範例中定義在 org.eclipse.ui.examples.readmetool.ReadmeEditor。
實作 IDropDelegate 的類別 ReadmeDropActionDelegate。每一次工作台中執行了放置動作,就會通知 IDropDelegates。 這個動作的延伸點為 org.eclipse.ui.dropActions。