SWT JFace:如何实现“分级或可扩展的TableViewer”?
我认为这个问题很常见。
最近我有一个需求,我需要制作一个分层或可扩展的类似表格的视图。如果需要示例,可以参考Mac OS X的Activity Monitor:
同时我在这里尝试了一个例子,它满足了我的要求: http://www.java2s.com/Code/Java/ SWT-JFace-Eclipse/SWTTreeWithMulticolumns.htm
但它有一些问题: 1.它使用SWT的Tree
类而不是JFace类; 2. 我认为它需要重复实现一些 JFace 查看器类的功能,例如通过单击列标题进行排序、过滤器等。
当我感到绝望时,我发现Eclipse本身有一个完美的视图,它的“问题”视图:
所以我认为必须有一种方法可以优雅地做到这一点,例如扩展 JFace 的 TableViewer< /code> 或
TreeViewer
类。
但我需要帮助,因为我在谷歌上搜索了很多,但没有好的结果。 :-(
I think this question is quite common.
Recently I have got a requirement that I need to make a leveled or expandable table-like view. If you need an example, you can refer to Mac OS X's Activity Monitor:
At the same time I tried an example here which meets my requirement quite a little:
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTTreeWithMulticolumns.htm
But it has some problems:
1. It's using SWT's Tree
class not JFace classes;
2. I think it needs a repeat implementation of some JFace viewer classes's functions such as sorting by clicking a column header, filter and so on.
While I was feeling desperate, I found that Eclipse itself has a perfect view, its "Problems" view:
So I think there must be a way to do it elegantly, for example extend JFace's TableViewer
or TreeViewer
class.
But I need help, since I've searched a lot in Google with no good result. :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这只是一个
TreeViewer
。请注意,您可以添加TreeViewerColumn
到它。That's simply a
TreeViewer
. Note that you can addTreeViewerColumn
s to it.好的,谢谢阿列克谢,这确实是事实。
我还在这里找到了一个有用的链接:
OK, thank you Alexey, it is really the truth.
Also I found a useful link here:
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java?view=markup
这是 EclipseRCP 和 EclipseRCP 的使用示例ViewPart:
http://javawiki.sowas.com/doku.php?id =swt-jface:treetableviewer
Here is example in usage with EclipseRCP & ViewPart:
http://javawiki.sowas.com/doku.php?id=swt-jface:treetableviewer