0
我在我的視圖中有一個TableViewer,我想用org.eclipse.ui.edit.selectAll命令來選擇所有行,使用標準的Ctrl + A捷徑。標準'全選'命令不起作用
當我把跟蹤上我可以看到HandlerAuthority類解決了一些矛盾和輸出看起來是這樣的:
HANDLERS >>> Command('org.eclipse.ui.edit.selectAll') has changed to 'org.eclipse.ui.internal.handlers.SelectAllHandler' as its handler
HANDLERS >>> resolveConflicts: eval: HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
[email protected],
expression=,sourcePriority=0)
HANDLERS >>> Resolved conflict detected. The following activation won:
HANDLERS >>> HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
[email protected],
expression=,sourcePriority=0)
HANDLERS >>> resolveConflicts: eval: HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
[email protected],
expression=,sourcePriority=0)
HANDLERS >>> Resolved conflict detected. The following activation won:
HANDLERS >>> HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
[email protected],
expression=,sourcePriority=0)
HANDLERS >>> resolveConflicts: eval: HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
handler=ActionHandler(RetargetAction(selectAll)),
expression=ActiveShellExpression(Shell {SPL v0.1.2 (VYVOJ) (DB TEST)}),sourcePriority=17408)
HANDLERS >>> resolveConflicts: eval: HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
[email protected],
expression=,sourcePriority=0)
HANDLERS >>> Resolved conflict detected. The following activation won:
HANDLERS >>> HandlerActivation(commandId=org.eclipse.ui.edit.selectAll,
handler=ActionHandler(RetargetAction(selectAll)),
expression=ActiveShellExpression(Shell {SPL v0.1.2 (VYVOJ) (DB TEST)}),sourcePriority=17408)
HANDLERS >>> Command('org.eclipse.ui.edit.selectAll') has changed to 'ActionHandler(RetargetAction(selectAll))' as its handler
當我按下Ctrl + AI可以看到:
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x0, keyCode = 0x40000, time = 9403459, character = 0x0)
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x40000, keyCode = 0x61, time = 9403553, character = 0x1)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+A])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId = 'org.eclipse.ui.edit.selectAll', parameters = {})
KEYS >>> not handled
調試RetargetAction我發現Action沒有被處理,因爲它沒有處理程序集。
所以我的問題是,爲什麼HandlerAuthority設置一個RetargetAction作爲 org.eclipse.ui.edit.selectAll命令處理程序?我想使用默認的(org.eclipse.ui.internal.handlers.SelectAllHandler)。
這太瘋狂了。我認爲命令框架通過使用缺省處理程序解決了這個問題,當沒有更多適當的處理程序處於活動狀態時,使用它。我有很多意見和編輯。所以我真的必須爲他們所有人做這件事嗎? – Behnil
這個日期預先引入了命令和處理程序,並沒有真正更新過。儘管在e4應用程序中,您確實需要在每個地方使用命令和處理程序,但我希望爲每個視圖使用單獨的處理程序。查看'org.eclipse.ui.internal.handlers.SelectAllHandler'的來源,它無論如何都不能在表上工作。 –
哦,我明白了。那麼請你給我一個提示,當我按下Ctrl + A時,如何選擇表格中的所有行?我希望它是默認的操作系統行爲。如果沒有,我必須實現自己的處理程序來選擇'all command'?或者甚至我自己的行爲,如上所述? – Behnil