TableViewer - 如何显示()和项目*和*选择它?

发布于 2024-07-11 14:35:31 字数 277 浏览 2 评论 0原文

到目前为止,我已经构建了一个编辑器和一个查看器,它们都可以使用相同类型的数据库资源。

我正在尝试实现 JDT 中看到的那种行为:选择文件编辑器会在包资源管理器中选择相同的文件。

我与 TableView 的交互已经停止。 谁能告诉我怎么办 1) 迭代查看器中显示的域项集合 2)然后更改选择,我应该找到我需要的项目。

换句话说,就是一个 RevealAndSelect(Object) 方法。

我们将非常感谢您的经验。

M。

I have thus far built an Editor and a Viewer that both work on the same sort of database resource.

I'm trying to implement the sort of behaviour seen in the JDT: where selecting a files editor selects the same file in the Package Explorer.

I have ground to a halt on interaction with the TableView. Can anyone tell me how I can
1) iterate over the collection of domain-items on display in the viewer
2) then change the selection, should I find the item I need.

So in other words, a revealAndSelect(Object) method.

Your experience would be much appreciated.

M.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莳間冲淡了誓言ζ 2024-07-18 14:35:31

啊。 傻我:解决办法当然是

viewer.setSelection( new StructuredSelection( domainObjectToSelect ), true );

Ah. Silly me: the solution is of course

viewer.setSelection( new StructuredSelection( domainObjectToSelect ), true );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文