麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

解決RCP中CNF(navigator)配置后delete/copy/past快捷鍵失效

2019-11-11 06:09:26
字體:
來源:轉載
供稿:網友

這兩天在配置一個CNF導航視圖時候發現快捷鍵delete、past、copy等都失效了,折騰良久,搞清楚了;

1.快捷鍵要想能在菜單右邊顯示出來:

deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);2.要想生效必須綁定handler:

@Override	public void fillActionBars(final IActionBars actionBars) {		if (textActionHandler == null) {			textActionHandler = new TextActionHandler(actionBars); // hook																	// handlers		}		textActionHandler.setCopyAction(copyAction);		textActionHandler.setPasteAction(pasteAction);		textActionHandler.setDeleteAction(deleteAction);		// renameAction.setTextActionHandler(textActionHandler);		updateActionBars();		textActionHandler.updateActionBars();	}
public void updateActionBars() {		actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),                textCutAction);		actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),                textCopyAction);actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),                textPasteAction);		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),                textSelectAllAction);		actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),                textDeleteAction);	}setGlobalActionHandler把id和action綁定到一塊;

這里你發現綁定的action并不是自己那個action,是texthandler中的action;

如果想強制生效可以直接把這個action換成我們那個action;

3.推薦的解決方法:

之所以不生效,是因為系統找不到action對應的commandid,我們可以綁定:

PRotected void makeActions() {		clipboard = new Clipboard(shell.getDisplay());		...		deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);		initActionCommandMappingService();	}	/**	 * 快捷鍵綁定actionBars.setGlobalActionHandler();	 * 這里使用了textActionHandler.updateActionBars();所以綁定的是textActionHandler中text*Action,而不是這里的action;	 * 方法一:重新設置setGlobalActionHandler為這里的action;	 * 方法二:ActionCommandMappingService中添加這里的action映射WorkbenchCommandConstants.EDIT_*	 */	private void initActionCommandMappingService() {		final IActionCommandMappingService actionCommandMappingService = (IActionCommandMappingService) CommonUIPlugin.getDefault().getWorkbench()				.getActiveWorkbenchWindow().getService(IActionCommandMappingService.class);		final String idDelete = actionCommandMappingService.getCommandId(ActionFactory.DELETE.getId());		if (idDelete == null) {			actionCommandMappingService.map(ActionFactory.DELETE.getId(), IWorkbenchCommandConstants.EDIT_DELETE);		}		final String idCopy = actionCommandMappingService.getCommandId(ActionFactory.COPY.getId());		if (idCopy == null) {			actionCommandMappingService.map(ActionFactory.COPY.getId(), IWorkbenchCommandConstants.EDIT_COPY);		}		final String idPast = actionCommandMappingService.getCommandId(ActionFactory.PASTE.getId());		if (idPast == null) {			actionCommandMappingService.map(ActionFactory.PASTE.getId(), IWorkbenchCommandConstants.EDIT_PASTE);		}	}這樣問題就解決了


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人精品一区二区 | 亚洲精品无码不卡在线播放he | 在线影院av| 91懂色 | 国产亚洲精品久久久久婷婷瑜伽 | 欧美精品久久久久久久久老牛影院 | 看个毛片 | sese在线视频 | 91精品国产综合久久男男 | 国产中文99视频在线观看 | 2019天天干夜夜操 | 欧美成在线视频 | 免费a级黄色毛片 | 伊人在线视频 | 久草在线高清视频 | 国产va在线观看 | 九九热九九爱 | 国产精品久久久久久久久久iiiii | 国产精品久久久久久久久久大牛 | 黄色一级毛片免费看 | 国产黄色一区二区 | 黄色片一区二区 | 国产免费区 | 日本一区二区不卡高清 | 精品一区二区三区免费看 | 黄色视屏免费看 | av在线免费播放 | 高颜值美女啪啪 | 精品久久久久久久久久久αⅴ | 久久久久国产成人免费精品免费 | 黄网站免费观看视频 | 一级毛片电影院 | 日本一区二区久久 | 特片网久久| 欧美一级毛片欧美一级成人毛片 | 亚洲视频在线视频 | 成人福利网 | 日日摸夜夜骑 | 操碰网 | 亚洲精品动漫在线观看 | 国产精品一区二区免费在线观看 |