Source:
private void initializeAppearColorTable(Composite tableComposite) { fAppearanceColorTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { handleAppearanceColorListSelection(); } }); colorPreviewImages= new ArrayList<>(); fAppearanceColorTableViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { ColorEntry colorEntry= ((ColorEntry) element); if (colorEntry.isSystemDefault()) return null; int dimensions= 10; RGB rgb= colorEntry.getRGB(); Color color= new Color(tableComposite.getParent().getDisplay(), rgb.red, rgb.green, rgb.blue); Image image= new Image(tableComposite.getParent().getDisplay(), dimensions, dimensions); GC gc= new GC(image); gc.setBackground(color); gc.fillRectangle(0, 0, dimensions, dimensions); gc.setBackground(new Color(tableComposite.getParent().getDisplay(), 0, 0, 0)); gc.setLineWidth(2); gc.drawRectangle(0, 0, dimensions, dimensions); gc.dispose(); colorPreviewImages.add(image); return image; } @Override public String getText(Object element) { return ((ColorEntry) element).label; } }); TableColumn tc= new TableColumn(fAppearanceColorTableViewer.getTable(), SWT.NONE, 0); TableColumnLayout tableColumnLayout= new TableColumnLayout(true); PixelConverter pixelConverter= new PixelConverter(tableComposite.getParent().getFont()); tableColumnLayout.setColumnData(tc, new ColumnWeightData(1, pixelConverter.convertWidthInCharsToPixels(30))); tableComposite.setLayout(tableColumnLayout); GridData gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH); Table fAppearanceColorTable= fAppearanceColorTableViewer.getTable(); gd.heightHint= fAppearanceColorTable.getItemHeight() * 8; fAppearanceColorTable.setLayoutData(gd); }

Target:
private void initializeAppearColorTable(Composite tableComposite) { fAppearanceColorTableViewer.addSelectionChangedListener((SelectionChangedEvent event) -> handleAppearanceColorListSelection()); colorPreviewImages= new ArrayList<>(); fAppearanceColorTableViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { ColorEntry colorEntry= ((ColorEntry) element); if (colorEntry.isSystemDefault()) return null; int dimensions= 10; RGB rgb= colorEntry.getRGB(); Color color= new Color(tableComposite.getParent().getDisplay(), rgb.red, rgb.green, rgb.blue); Image image= new Image(tableComposite.getParent().getDisplay(), dimensions, dimensions); GC gc= new GC(image); gc.setBackground(color); gc.fillRectangle(0, 0, dimensions, dimensions); gc.setBackground(new Color(tableComposite.getParent().getDisplay(), 0, 0, 0)); gc.setLineWidth(2); gc.drawRectangle(0, 0, dimensions, dimensions); gc.dispose(); colorPreviewImages.add(image); return image; } @Override public String getText(Object element) { return ((ColorEntry) element).label; } }); TableColumn tc= new TableColumn(fAppearanceColorTableViewer.getTable(), SWT.NONE, 0); TableColumnLayout tableColumnLayout= new TableColumnLayout(true); PixelConverter pixelConverter= new PixelConverter(tableComposite.getParent().getFont()); tableColumnLayout.setColumnData(tc, new ColumnWeightData(1, pixelConverter.convertWidthInCharsToPixels(30))); tableComposite.setLayout(tableColumnLayout); GridData gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH); Table fAppearanceColorTable= fAppearanceColorTableViewer.getTable(); gd.heightHint= fAppearanceColorTable.getItemHeight() * 8; fAppearanceColorTable.setLayoutData(gd); }