开发者

Get view from Widget reference

In Eclipse, can I get the View ID given a reference to one of its widgets? I don't want to enumerate all view开发者_开发问答s and traverse their hierarchies.


Use Control.getParent() API to go up the widget hierarchy starting with your widget. At some point, you will find the view part. Then you can get the info you need. I'd do this in the debugger first to make it easier to identify the class that the view part will have in the controls tree. It should be pretty obvious when you see it.


Ended up using SWTbot and some manual bookkeeping for the purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜