Skip to main content

Posts

Showing posts from November, 2010

Hide empty last column from Table/Tree Viewer

1. How to remove last vestigial column from TableViewer You might have seen that there is dummy or vestigial column in the TableViewer (as marked by the red oval in the below figure) which  is annoying at times because not only it look ugly but more so it occupy;s the precious  real state from your component/control like shown in figure below: Solution: You can use  TableColumnLayout from  org.eclipse.jface.layout package inside  org.eclipse.jface plugin which allows to layout the columns in your TableViewer in essentially two ways: Firstly via mentioning the width in pixel for each column present in the Viewer  Secondly, we could mentioned weights The data could be supplied to the layout via of the implementation of  ColumnLayoutData. The following snippet shows how to achieve it: tableColumnLayout.setColumnData(tableColumn, new ColumnWeightData(1)); Explanation of the above line: tableColumnLayout is   instance of...