RCP关于配置方式在菜单栏创建菜单
来源:互联网 发布:物流软件系统试用 编辑:程序博客网 时间:2024/05/22 03:01
- RCP关于配置方式在菜单栏创建菜单
- <extension
- point="org.eclipse.ui.commands">
- <category
- id="com.vnvntrip.plugin.dev.commands.category"
- name="Sample Category">
- </category>
- <!---创建一个command命令-->
- <command
- categoryId="com.vnvntrip.plugin.dev.commands.category"
- id="com.vnvntrip.plugin.dev.commands.sampleCommand"
- name="编辑">
- </command>
- <command
- name="Open Mailbox"
- description="Opens a mailbox"
- categoryId="com.vnvntrip.plugin.dev.commands.category"
- id="com.vnvntrip.plugin.dev.commands.category.open">
- </command>
- <command
- name="Open Message Dialog"
- description="Open a message dialog"
- categoryId="com.vnvntrip.plugin.dev.commands.category"
- id="com.vnvntrip.plugin.dev.commands.category.openMessage">
- </command>
- </extension>
- <!---使用处理器(Handler)绑定Command--->
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="com.vnvntrip.plugin.dev.handlers.SampleHandler"
- commandId="com.vnvntrip.plugin.dev.commands.sampleCommand">
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <!---绑定相应的快捷键-->
- <key
- commandId="com.vnvntrip.plugin.dev.commands.sampleCommand"
- contextId="org.eclipse.ui.contexts.window"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+6">
- </key>
- <key
- commandId="com.vnvntrip.plugin.dev.commands.category.open"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+2">
- </key>
- <key
- commandId="com.vnvntrip.plugin.dev.commands.category.openMessage"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+3">
- </key>
- <key
- commandId="org.eclipse.ui.file.exit"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="CTRL+X">
- </key>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.ui.main.menu?after=additions">
- <!---创建相关的菜单对象-->
- <menu
- id="com.vnvntrip.plugin.dev.menus.sampleMenu"
- label="编辑"
- mnemonic="M">
- <!---菜单绑定的命令-->
- <command
- commandId="com.vnvntrip.plugin.dev.commands.sampleCommand"
- id="com.vnvntrip.plugin.dev.menus.sampleCommand"
- mnemonic="S">
- </command>
- </menu>
- ;/menuContribution>
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar
- id="com.vnvntrip.plugin.dev.toolbars.sampleToolbar">
- <command
- commandId="com.vnvntrip.plugin.dev.commands.sampleCommand"
- icon="icons/sample.gif"
- id="com.vnvntrip.plugin.dev.toolbars.sampleCommand"
- tooltip="Say hello world">
- </command>
- </toolbar>
- </menuContribution>
- </extension>
在编码是仅仅需要编写Handler中的代码:
- package com.vnvntrip.plugin.dev.handlers;
- import org.eclipse.core.commands.AbstractHandler;
- import org.eclipse.core.commands.ExecutionEvent;
- import org.eclipse.core.commands.ExecutionException;
- import org.eclipse.swt.widgets.Shell;
- import org.eclipse.ui.handlers.HandlerUtil;
- import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
- /**
- *
- * @author longgangbai
- *
- */
- public class SampleHandler extends AbstractHandler {
- private static String CUSTOMPROPERTYPAGE = "com.vnvntrip.plugin.dev.properties.CustomPropertyPage";
- /**
- * The constructor.
- */
- public SampleHandler() {
- }
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Shell shell = HandlerUtil.getActiveShell(event);
- // JfaceDialog dialog=new JfaceDialog(shell);
- // dialog.open();
- //WorkbenchPreferenceDialog.createDialogOn(shell, preferencePageId)
- WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog
- .createDialogOn(shell, CUSTOMPROPERTYPAGE);
- dialog.showOnly(new String[] { CUSTOMPROPERTYPAGE });
- dialog.open();
- return null;
- }
- }
- RCP关于配置方式在菜单栏创建菜单
- Rcp之代码方式添加菜单栏实例
- RCP创建菜单栏工具栏(下拉)
- 在Unity菜单栏上添加自定义菜单
- 编码方式创建菜单
- Rcp之使用扩展方式添加菜单实例
- 在rcp中用菜单在projectExplorer中新建工程
- 关于linux下rcp的配置
- 关于菜单栏中RecentFiles显示为弹出菜单
- RCP:利用actionSet在菜单(menu)里添加内容
- RCP:利用actionSet在菜单(menu)里添加内容
- 创建菜单栏
- 创建“菜单栏”
- SharePoint 配置站点导航栏顶级菜单栏的下拉菜单
- (NSMenu,NSMenuItme)如何在菜单栏添加新的菜单
- Android之菜单创建方式
- MFC学习笔记.day03-菜单,图形标记菜单创建,菜单栏禁用,命令响应,右键弹出菜单,添加菜单
- rcp 视图中的菜单
- 使用数组实现栈stack功能
- linux下用脚本语言开发自动重启程序
- project3---我们的成果展示
- 给rcp系统添加全局快捷键
- 求你加我为好友吧,谢谢。我想要下载积分
- RCP关于配置方式在菜单栏创建菜单
- 关于打开wps时出现windows install安装的问题
- IOCP模型总结
- Android自动提示--AutoCompleteTextView、MultiAutoCompleteTextView
- 自己实现的二维数组
- 二元树的应用
- 2010 我在这战斗的一年里
- word复制图片 导致桌面图标变成蓝色阴影 解决办法
- 两个栈实现一个队列