问题

自4.x开始,Quick Access搜索框成为Toolbar的“标准装备”,一般删除Actionset的方式似乎不起作用,通过Quick Access,用户很容易访问到RCP程序本来想隐藏的功能。

解决方法

在WorkbenchWindowAdvisor的openIntro中加入以下代码

IWorkbenchWindow window = (IWorkbenchWindow) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
if (window instanceof WorkbenchWindow) {
MWindow model = ((WorkbenchWindow) window).getModel();
EModelService modelService = model.getContext().get(
EModelService.class);
MToolControl searchField = (MToolControl) modelService.find(
"SearchField", model);
if (searchField != null) {
searchField.setToBeRendered(false);
MTrimBar trimBar = modelService.getTrim((MTrimmedWindow) model,
SideValue.TOP);
trimBar.getChildren().remove(searchField);
}
}

需要添加依赖

 org.eclipse.e4.ui.model.workbench
org.eclipse.e4.ui.workbench
org.eclipse.e4.core.contexts

参考

https://bugs.eclipse.org/bugs/show_bug.cgi?id=362420 Comment66

 

Binhua Liu原创,写于2013/8/30。

RCP:如何移除Toolbar中的Quick Access的更多相关文章

  1. Eclipse RCP /Plugin移除Search对话框

    RCP:如何移除Search对话框中不需要的项 2013-08-18 22:31 by Binhua Liu, 231 阅读, 0 评论, 收藏, 编辑 前言 很久没写文章了,准备写一系列关于Ecli ...

  2. WPF 4 Ribbon 开发 之 快捷工具栏(Quick Access Toolbar)

    转自 http://www.cnblogs.com/gnielee/archive/2010/05/10/wpf4-ribbon-quick-access-toolbar.html 在Office 2 ...

  3. Jquery 移除 html中绑定的onClick事件

    HTML绑定示例: <button class="edit" onClick="showTurnEdit(this)">编辑</button& ...

  4. 用SQL脚本移除视图中存在的机器名

    用SQL脚本移除视图中存在的机器名 例子: msccdr.cdr.DimRMAReturnMethod CREATE VIEW CDR.DimRMAReturnMethod ( ReturnMetho ...

  5. 巧妙利用ToArray()函数移除集合中的元素

    当我们对集合foreach遍历时,不能直接移除遍历的集合的元素,解决的方法有很多种,见我之前的随笔: http://www.cnblogs.com/527289276qq/p/4331000.html ...

  6. LeetCode 80 Remove Duplicates from Sorted Array II(移除数组中出现两次以上的元素)

    题目链接:https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/#/description 给定一个已经排好序的数组 ...

  7. LeetCode 27 Remove Element (移除数组中指定元素)

    题目链接: https://leetcode.com/problems/remove-element/?tab=Description   Problem : 移除数组中给定target的元素,返回剩 ...

  8. array_unique() 函数移除数组中的重复的值

    array_unique() 函数移除数组中的重复的值,并返回结果数组. 当几个数组元素的值相等时,只保留第一个元素,其他的元素被删除. 返回的数组中键名不变.

  9. 去除自定义Toolbar中左边距

    问题 自定义Toolbar之后,发现左侧不能完全填充,总是留一点空白,如下图: 原因 查看Wiget.AppCompat.Toolbar的parent(Toolbar默认的style),如下: < ...

随机推荐

  1. iOS CUICatalog: Invalid asset name supplied: (null)

    iOS开发出现CUICatalog: Invalid asset name supplied: (null), or invalid scale factor: 2.000000 原因: 你用了这个方 ...

  2. Mysql权限

    连接Oracle/Mysql数据库的配置 1.Oracle <context:property-placeholder location="jdbc.properties"/ ...

  3. LDA 初见(JGibbLDA-v.1.0 eclipse使用)

    参考:Eclipse下使用JGibbLDA使用总结 一.下载和初次使用JGibbLDA 1.导入JGibbLDA-v.1.0项目(参考上面链接) 2.在LDA.java右键“run”--->“r ...

  4. IOS第二天多线程-05NSOperationQueue 暂停,和恢复队列任务

    *********** #import "HMViewController.h" @interface HMViewController () <UITableViewDel ...

  5. 省略号 对单行 多行的css

    .twoline{ display: -webkit-box !important;; overflow:hidden; text-overflow: ellipsis; word-break: br ...

  6. ExtJS笔记 Using Events

    Using Events The Components and Classes of Ext JS fire a broad range of events at various points in ...

  7. hibernate学习(4)——实体配置详解

    1.实体 编写规则 提供一个无参数 public访问控制符的构造器 提供一个标识属性,映射数据表主键字段,hibernate以id识别,必须有主键 所有属性提供public访问控制符的 set  ge ...

  8. C# 消息队列

    阅读目录 1. 消息队列是什么? 2. 常见的消息队列框架有哪些? 3. MSMQ介绍 4. RabbitMQ介绍 消息队列是什么 简单的理解就是将消息添加一个队列中,使用时在从这个队列中取出来.那么 ...

  9. k8s入门系列之扩展组件(一)DNS安装篇

    DNS (domain name system),提供域名解析服务,解决了难于记忆的IP地址问题,以更人性可读可记忆可标识的方式映射对应IP地址. Cluster DNS扩展插件用于支持k8s集群系统 ...

  10. ubuntu dpkg 依赖问题处理

    ubuntu dpkg 依赖问题处理 使用 apt-get 安装软件期间,如果出现意外中断的情况,下次安装时会出现 dpkg 的一系列依赖问题,提示如下 :: dpkg: error processi ...