RCP:如何移除Toolbar中的Quick Access
生活随笔
收集整理的這篇文章主要介紹了
RCP:如何移除Toolbar中的Quick Access
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
問題
自4.x開始,Quick Access搜索框成為Toolbar的“標(biāo)準(zhǔn)裝備”,一般刪除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.workbenchorg.eclipse.e4.ui.workbenchorg.eclipse.e4.core.contexts參考
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362420 Comment66
?
Binhua Liu原創(chuàng),寫于2013/8/30。
轉(zhuǎn)載于:https://www.cnblogs.com/Binhua-Liu/p/3292350.html
總結(jié)
以上是生活随笔為你收集整理的RCP:如何移除Toolbar中的Quick Access的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 各个刷流量软件总结对比
- 下一篇: apizza+导出html文档,apiz