private void createTable ( Composite parent ) { int style = SWT . MULTI | SWT . BORDER | SWT . H_SCROLL | SWT . V_SCROLL | SWT . FULL_SELECTION | SWT . HIDE_SELECTION ; table = new Table ( parent , style ) ; GridData gridData = new GridData ( GridData . FILL_BOTH ) ; gridData . grabExcessVerticalSpace = true ; gridData . horizontalSpan = 3 ; table . setLayoutData ( gridData ) ; table . setLinesVisible ( true ) ; table . setHeaderVisible ( true ) ; TableColumn column ; //Expression col column = new TableColumn ( table , SWT . LEFT , 0 ) ; column . setText ( "Language Expression" ) ; column . setWidth ( 350 ) ; // Add listener to column so sorted when clicked column . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { tableViewer . setSorter ( new DSLMappingSorter ( DSLMappingSorter . EXPRESSION ) ) ; } } ) ; // 3rd column with task Owner column = new TableColumn ( table , SWT . LEFT , 1 ) ; column . setText ( "Rule Language Mapping" ) ; column . setWidth ( 200 ) ; // Add listener to column so sorted when clicked column . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { tableViewer . setSorter ( new DSLMappingSorter ( DSLMappingSorter . MAPPING ) ) ; } } ) ; // 4th column with task PercentComplete column = new TableColumn ( table , SWT . LEFT , 2 ) ; column . setText ( "Object" ) ; column . setWidth ( 80 ) ; // 5th column with task PercentComplete column = new TableColumn ( table , SWT . LEFT , 3 ) ; column . setText ( "Scope" ) ; column . setWidth ( 80 ) ; // Add listener to column so tasks are sorted when clicked column . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { tableViewer . setSorter ( new DSLMappingSorter ( DSLMappingSorter . SCOPE ) ) ; } } ) ; }
Create the Table