定制Eclipse RCP编辑器右键菜单
2010-07-22 16:32
806 查看
这篇文章其实是《Eclipse RCP编辑器关闭按钮的屏蔽方法》的下半部分,之所以没放一起是因为原文很容易引起误解,所以拆开了。
在UnCloseableEditorPresentationFactory类createEditorPresentation()方法中,我们可以定制StandardViewSystemMenu类,从而去掉RCP中编辑器folder上的菜单中的close,closeall,new editor等菜单。
然后在createEditorPresentation()方法中,修改代码如下:
在UnCloseableEditorPresentationFactory类createEditorPresentation()方法中,我们可以定制StandardViewSystemMenu类,从而去掉RCP中编辑器folder上的菜单中的close,closeall,new editor等菜单。
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.internal.WorkbenchMessages; import org.eclipse.ui.internal.presentations.util.StandardViewSystemMenu; import org.eclipse.ui.presentations.IPresentablePart; import org.eclipse.ui.presentations.IStackPresentationSite; public class MyStandardEditorSystemMenu extends StandardViewSystemMenu { public MyStandardEditorSystemMenu(IStackPresentationSite site) { super(site); // TODO Auto-generated constructor stub } String getMoveMenuText() { return WorkbenchMessages.EditorPane_moveEditor; } public void show(Control parent, Point displayCoordinates, IPresentablePart currentSelection) { super.show(parent, displayCoordinates, currentSelection); } }
然后在createEditorPresentation()方法中,修改代码如下:
TabbedStackPresentation result = new TabbedStackPresentation(site, partFolder, new MyStandardEditorSystemMenu(site));
相关文章推荐
- Eclipse RCP中编辑器右键菜单与默认可拖动属性的屏蔽方法
- Eclipse RCP编辑器右键菜单与默认可拖动属性的屏蔽方法
- Unity3D研究院编辑器之重写Hierarchy的右键菜单
- 可定制的IE鼠标右键菜单
- 编辑器sublime text 加入到右键菜单
- 定制鼠标右键新建菜单选项
- Gnome桌面的定制(修改面板 修改右键菜单) [初级]
- 定制 Send To 右键菜单
- Eclipse定制右键创建文件快捷菜单
- 定制Eclipse视图Tab的右键系统菜单
- javascript简单的右键菜单定制
- Ubuntu & GNOME 2 下 gvim 右键菜单的定制
- flex中定制右键菜单
- Eclipse rcp 开发 : 自定义导航视图CNF(4)为导航视图重新定义右键菜单
- TWaver HTML5学习笔记 —— 可定制的右键菜单
- Eclipse RCP 之屏蔽视图上的右键菜单
- 为何定制的系统,长按触摸屏没有右键菜单?
- flex中定制右键菜单
- 将Show In菜单添加至视图或编辑器的右键菜单中
- vista右键菜单美化的定制与优化指南