SWT JFace: How to implement a “leveled or expandable TableViewer”?
-
25-02-2021 - |
문제
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. :-(
해결책
That's simply a TreeViewer
. Note that you can add TreeViewerColumn
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
Here is example in usage with EclipseRCP & ViewPart:
http://javawiki.sowas.com/doku.php?id=swt-jface:treetableviewer