这篇文章其实是《Eclipse RCP编辑器关闭按钮的屏蔽方法》的下半部分,之所以没放一起是因为原文很容易引起误解,所以拆开了。
在UnCloseableEditorPresentationFactory类createEditorPresentation()方法中,我们可以定制StandardViewSystemMenu类,从而去掉RCP中编辑器folder上的菜单中的close,closeall,new editor等菜单。
然后在createEditorPresentation()方法中,修改代码如下: