0

I want to create a Treeview for an Eclipse-Plugin.

I generated the Treeview with:

_viewer = new TreeViewer(parent,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); 
_viewer.setContentProvider(new ViewContentProvider());

_viewer.getTree().setHeaderVisible(true);
_viewer.getTree().setLinesVisible(true);
_viewer.setAutoExpandLevel(1);

TreeViewerColumn column = new TreeViewerColumn(_viewer, SWT.NONE);
column.getColumn().setText("Package / CCID");
column.getColumn().setWidth(120);
column.setLabelProvider(new ColumnLabelProvider(){

        @Override
        public String getText(Object element) {
            return "test";
        }
        }
);

column = new TreeViewerColumn(_viewer, SWT.NONE);
column.getColumn().setText("Stage");
column.getColumn().setWidth(100);
column.setLabelProvider(new ColumnLabelProvider(){

    public String getText(Object element) {
        return "test";
    }
});

Now I want to fill the Treeview with Data from DB2. DB2 contains a table with the name "Package" and a table with the name CCID.

At first I want to list all packages in the table. Then I want to expand the package and show all CCID´s for each package.

For example:

+ package 1
+ package 2
+ package 3

and expended:

- package 1
   ccid 1
   ccid 2
   ccid 3
- package 2
   ccid 54
   ccid 34
   ccid 23
- package 3
   ccid 32
   ccid 23
   ccid 23

Is there any idea to solve my problem?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
JonnyBeton
  • 173
  • 12
  • 2
    It is not at all clear what you are having problems with. Have you read any tutorials [like this](http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm) on TreeViewer? – greg-449 Aug 19 '14 at 12:48
  • Hey Greg, i have problems to expand a object. For example: I want to expand an created object. For example: In the tutorial I want to expand each book object and not only the subject. Do you have any idea? – JonnyBeton Aug 20 '14 at 12:09
  • http://stackoverflow.com/questions/25404594/how-to-expand-an-object-in-a-treeviewer Here is a new link – JonnyBeton Aug 20 '14 at 12:22

0 Answers0