I tried adding a number for each row in my tree. The tree and its numbering is working but not that great so is there any other best way to implement this? because if the tree node expanded I have to get all the expanded tree node and increase its numbering. I also used the TreeViewer to create the tree.
// base container
Composite composite = new Composite( (Composite) parent, SWT.NONE );
composite.setLayout( new GridLayout( 2, false ) );
composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
// The container for numbering in the tree
Composite numComposite = new Composite( composite, SWT.NONE );
numComposite.setLayout( new FillLayout( SWT.VERTICAL ) );
numComposite.setLayoutData( new GridData( GridData.VERTICAL_ALIGN_BEGINNING ) );
// the tree container
MyTree tree = new MyTree( composite );
tree.setContentProvider( new ContentProvider() );
Label test = new Label( numComposite, SWT.NONE );
test.setText( "1" );
test = new Label( numComposite, SWT.NONE );
test.setText( "2" );
test = new Label( numComposite, SWT.NONE );
test.setText( "3" );
test = new Label( numComposite, SWT.NONE );
test.setText( "4" );
test = new Label( numComposite, SWT.NONE );
test.setText( "5" );