我正在編寫一個自定義的Eclipse編輯器,通過繼承TextEditor
,我不能使用我配置的Format
操作。如何在自定義Eclipse編輯器中公開內容格式化程序?
我讀了Creating a commercial quality IDE中的3個部分,我知道SourceViewerConfiguration
。我實現了所需的方法:
override def getContentFormatter(viewer: ISourceViewer) = {
val formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(viewer), IDocument.DEFAULT_CONTENT_TYPE)
formatter.setMasterStrategy(new ScalaFormattingStrategy(textEditor))
formatter
}
但是,我無法找到Format
菜單,上下文菜單,工具欄等Java的快捷方式(CMD-Shift-F
)不起作用或者任何地方。
編輯:我已經在我創建的SourceViewerConfiguration
子類中實現了其他方法,並且其他所有方法在我的編輯器(完成,超鏈接,對帳)中按預期工作。
暴露格式化程序的首選方法是什麼?我需要做更多的事嗎?
非常感謝您的聯繫!我GOOGLE了很多,但沒有發現任何相關的。看起來不錯! – 2012-07-31 21:08:11