Eclipse force handlers to to re-evaluate

2019-07-11 06:29发布

How can I force Eclipse to do a re-evaluation of the activeWhen-conditions of all handlers?

Situation: I have defined a command on a TreeViewer. This command has more than one possible handlers. Handlers have defined some conditions to decide whether the handler shall be activated or not.

My problem is that there is no re-evaluation of the handler conditions until I de-seclect the item in the tree (e.g. select another item) and select it again.

If the selection does not change but the raise conditions do (e.g. due to an update of the element) the wrong handler will be executed.

Is there a way to manually force an Handler re-evaluation on the selection?

1条回答
聊天终结者
2楼-- · 2019-07-11 07:20

If your condition examines state in your treeviewer selection using property testers, then you need to notify the IEvaluationService that the property in question has changed. See org.eclipse.ui.services.IEvaluationService.requestEvaluation(String)

查看更多
登录 后发表回答