Source:
protected void buildColumns(IColumnPresentation presentation) { Tree tree = getTree(); final TreeColumn[] columns = tree.getColumns(); String[] visibleColumnIds = getVisibleColumns(); for (TreeColumn column2 : columns) { column2.removeControlListener(fListener); } for (TreeColumn column2 : columns) { column2.dispose(); } PresentationContext presentationContext = (PresentationContext) getPresentationContext(); if (presentation != null) { for (int i = 0; i < visibleColumnIds.length; i++) { String id = visibleColumnIds[i]; String header = presentation.getHeader(id); TreeColumn column = new TreeColumn(tree, SWT.LEFT, i); column.setMoveable(true); column.setText(header); column.setWidth(1); ImageDescriptor image = presentation.getImageDescriptor(id); if (image != null) { column.setImage(((ITreeModelLabelProvider)getLabelProvider()).getImage(image)); } column.setData(id); } int[] order = fColumnOrder.get(presentation.getId()); if (order != null) { tree.setColumnOrder(order); } tree.setHeaderVisible(true); tree.setLinesVisible(true); presentationContext.setColumns(visibleColumnIds); setColumnProperties(visibleColumnIds); setCellModifier(fCellModifier); } else { tree.setHeaderVisible(false); tree.setLinesVisible(false); presentationContext.setColumns(null); setCellModifier(null); setColumnProperties(null); } int treeWidgetWidth = tree.getSize().x; int avg = treeWidgetWidth; if (visibleColumnIds != null) { avg /= visibleColumnIds.length; } if (avg == 0) { tree.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { Tree tree2 = getTree(); String[] visibleColumns = getVisibleColumns(); if (visibleColumns != null) { int treeWidgetWidth1 = tree2.getSize().x; int avg1 = treeWidgetWidth1 / visibleColumns.length; initColumns(avg1, treeWidgetWidth1, visibleColumns); } tree2.removePaintListener(this); } }); } else { initColumns(avg, treeWidgetWidth, visibleColumnIds); } }

Target:
protected void buildColumns(IColumnPresentation presentation) { Tree tree = getTree(); final TreeColumn[] columns = tree.getColumns(); String[] visibleColumnIds = getVisibleColumns(); for (TreeColumn column : columns) { column.removeControlListener(fListener); } for (TreeColumn column : columns) { column.dispose(); } PresentationContext presentationContext = (PresentationContext) getPresentationContext(); if (presentation != null) { for (int i = 0; i < visibleColumnIds.length; i++) { String id = visibleColumnIds[i]; String header = presentation.getHeader(id); TreeColumn column = new TreeColumn(tree, SWT.LEFT, i); column.setMoveable(true); column.setText(header); column.setWidth(1); ImageDescriptor image = presentation.getImageDescriptor(id); if (image != null) { column.setImage(((ITreeModelLabelProvider)getLabelProvider()).getImage(image)); } column.setData(id); } int[] order = fColumnOrder.get(presentation.getId()); if (order != null) { tree.setColumnOrder(order); } tree.setHeaderVisible(true); tree.setLinesVisible(true); presentationContext.setColumns(visibleColumnIds); setColumnProperties(visibleColumnIds); setCellModifier(fCellModifier); } else { tree.setHeaderVisible(false); tree.setLinesVisible(false); presentationContext.setColumns(null); setCellModifier(null); setColumnProperties(null); } int treeWidgetWidth = tree.getSize().x; int avg = treeWidgetWidth; if (visibleColumnIds != null) { avg /= visibleColumnIds.length; } if (avg == 0) { tree.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { Tree tree2 = getTree(); String[] visibleColumns = getVisibleColumns(); if (visibleColumns != null) { int treeWidgetWidth1 = tree2.getSize().x; int avg1 = treeWidgetWidth1 / visibleColumns.length; initColumns(avg1, treeWidgetWidth1, visibleColumns); } tree2.removePaintListener(this); } }); } else { initColumns(avg, treeWidgetWidth, visibleColumnIds); } }