rcp(插件开发)org.eclipse.ui.menus-可以添加在视图上

2024-01-24 03:32

本文主要是介绍rcp(插件开发)org.eclipse.ui.menus-可以添加在视图上,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

以下是eclipse help中的内容

 

org.eclipse.ui.menus

Commands can be implemented using org.eclipse.ui.handlersand bound to keys usingorg.eclipse.ui.bindings. With the org.eclipse.ui.menusextension point they can be placed in the main menu, view dropdown menus, context menus. They can also be added to the main toolbar, view toolbars, and various trim locations.

Contribution location

The older action contribution points use the concept of menu and toolbar pathsto place menu items and tool items. The org.eclipse.ui.menusextension point requires the id of a menu, toolbar, or trim area and an insertion point. This is the locationURI of a <menuContribution/> element. Some examples of locationURIs:

  • menu:org.eclipse.ui.main.menu?after=window - insert this contribution in the main menu after the Window menu.
  • menu:file?after=additions - insert this contribution in the File menu after the additions group. Equivalent to the old menubarPath="file/additions".
  • menu:org.eclipse.ui.views.ContentOutline?after=additions - insert this contribution in the Content Outline view dropdown menu after the additions group.
  • toolbar:org.eclipse.ui.views.ContentOutline?after=additions - insert this contribution in the Content Outline view toolbar, after the additions group.
  • popup:org.eclipse.ui.examples.propertysheet.outline?after=additions - insert this contribution in the Property Sheet outline page context menu after the additions group.

A word about popup: locationURIs. In popup:id, the id refers to the id that comes from registering the context menu when the registerContextMenu(*) method is called. If an no id is specified in the call, it defaults to the id of the view or editor registering the context menu.

The workbench defines all of its group slot names in the classes IWorkbenchActionConstantsand IIDEActionConstants. These ids, like the file example above, are available to menu contributions.

After the locationURI specifies the insertion point, the <menuContribution/> elements are turned into IContributionItems and inserted in order. Another difference between menu contributions and action contributions is that the menu contributions can be defined in the XML in the same kind of containing relationship that one would would see in a menu or toolbar.

Let's start with a simple example from our Info example, adding some commands to the InfoView.

   <extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.examples.contributions.view?after=additions">
<command
commandId="org.eclipse.ui.examples.contributions.view.count"
mnemonic="%contributions.view.count.mnemonic">
</command>
<command
commandId="org.eclipse.ui.examples.contributions.view.edit"
mnemonic="%contributions.view.edit.mnemonic">
</command>
<command

这篇关于rcp(插件开发)org.eclipse.ui.menus-可以添加在视图上的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/638421

相关文章

Android开发环境配置避坑指南

《Android开发环境配置避坑指南》本文主要介绍了Android开发环境配置过程中遇到的问题及解决方案,包括VPN注意事项、工具版本统一、Gerrit邮箱配置、Git拉取和提交代码、MergevsR... 目录网络环境:VPN 注意事项工具版本统一:android Studio & JDKGerrit的邮

Python开发文字版随机事件游戏的项目实例

《Python开发文字版随机事件游戏的项目实例》随机事件游戏是一种通过生成不可预测的事件来增强游戏体验的类型,在这篇博文中,我们将使用Python开发一款文字版随机事件游戏,通过这个项目,读者不仅能够... 目录项目概述2.1 游戏概念2.2 游戏特色2.3 目标玩家群体技术选择与环境准备3.1 开发环境3

Go语言开发实现查询IP信息的MCP服务器

《Go语言开发实现查询IP信息的MCP服务器》随着MCP的快速普及和广泛应用,MCP服务器也层出不穷,本文将详细介绍如何在Go语言中使用go-mcp库来开发一个查询IP信息的MCP... 目录前言mcp-ip-geo 服务器目录结构说明查询 IP 信息功能实现工具实现工具管理查询单个 IP 信息工具的实现服

使用Python开发一个带EPUB转换功能的Markdown编辑器

《使用Python开发一个带EPUB转换功能的Markdown编辑器》Markdown因其简单易用和强大的格式支持,成为了写作者、开发者及内容创作者的首选格式,本文将通过Python开发一个Markd... 目录应用概览代码结构与核心组件1. 初始化与布局 (__init__)2. 工具栏 (setup_t

Spring Shell 命令行实现交互式Shell应用开发

《SpringShell命令行实现交互式Shell应用开发》本文主要介绍了SpringShell命令行实现交互式Shell应用开发,能够帮助开发者快速构建功能丰富的命令行应用程序,具有一定的参考价... 目录引言一、Spring Shell概述二、创建命令类三、命令参数处理四、命令分组与帮助系统五、自定义S

Python通过模块化开发优化代码的技巧分享

《Python通过模块化开发优化代码的技巧分享》模块化开发就是把代码拆成一个个“零件”,该封装封装,该拆分拆分,下面小编就来和大家简单聊聊python如何用模块化开发进行代码优化吧... 目录什么是模块化开发如何拆分代码改进版:拆分成模块让模块更强大:使用 __init__.py你一定会遇到的问题模www.

Spring Security基于数据库的ABAC属性权限模型实战开发教程

《SpringSecurity基于数据库的ABAC属性权限模型实战开发教程》:本文主要介绍SpringSecurity基于数据库的ABAC属性权限模型实战开发教程,本文给大家介绍的非常详细,对大... 目录1. 前言2. 权限决策依据RBACABAC综合对比3. 数据库表结构说明4. 实战开始5. MyBA

使用Python开发一个简单的本地图片服务器

《使用Python开发一个简单的本地图片服务器》本文介绍了如何结合wxPython构建的图形用户界面GUI和Python内建的Web服务器功能,在本地网络中搭建一个私人的,即开即用的网页相册,文中的示... 目录项目目标核心技术栈代码深度解析完整代码工作流程主要功能与优势潜在改进与思考运行结果总结你是否曾经

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

Python基于wxPython和FFmpeg开发一个视频标签工具

《Python基于wxPython和FFmpeg开发一个视频标签工具》在当今数字媒体时代,视频内容的管理和标记变得越来越重要,无论是研究人员需要对实验视频进行时间点标记,还是个人用户希望对家庭视频进行... 目录引言1. 应用概述2. 技术栈分析2.1 核心库和模块2.2 wxpython作为GUI选择的优