Eclipse force handlers to to re-evaluate

本秂侑毒 提交于 2020-01-04 08:16:52

问题


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:


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)



来源:https://stackoverflow.com/questions/12092661/eclipse-force-handlers-to-to-re-evaluate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!