Source:
public void createControl(Composite parent, FormToolkit toolkit) { Composite composite = toolkit.createComposite(parent); GridLayoutFactory.fillDefaults().numColumns(15).applyTo(composite); GridDataFactory.fillDefaults().indent(28, 0).applyTo(composite); for (TaskAttribute attribute : getTaskAttribute().getAttributes().values()) { if (attribute.getId().startsWith("APPROVAL-")) { final String displayName = attribute.getAttribute("id").getValue(); Hyperlink hyperlink = toolkit.createHyperlink(composite, displayName, SWT.NONE); hyperlink.setToolTipText("Show Comments"); hyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { toggleFilter(displayName); } void toggleFilter(final String displayName) { TreeViewer viewer = viewerFunction.apply(null); if (viewer != null) { if (((IReviewItemSet) viewer.getInput()).getAllComments().isEmpty()) { return; } if (displayName.equals(currentFilter)) { viewer.removeFilter(personFilter); currentFilter = null; } else { if (currentFilter != null) { viewer.removeFilter(personFilter); } viewer.addFilter(personFilter); personFilter.setUser(displayName); currentFilter = displayName; } viewer.refresh(); viewer.expandAll(); page.reflow(); } } }); toolkit.createLabel(composite, attribute.getAttribute("value").getValue()); toolkit.createLabel(composite, ""); } } setControl(composite); }

Target:
public void createControl(Composite parent, FormToolkit toolkit) { Composite composite = toolkit.createComposite(parent); GridLayoutFactory.fillDefaults().numColumns(15).applyTo(composite); GridDataFactory.fillDefaults().indent(28, 0).applyTo(composite); for (TaskAttribute attribute : getTaskAttribute().getAttributes().values()) { if (attribute.getId().startsWith("APPROVAL-")) { final String displayName = attribute.getAttribute("id").getValue(); Hyperlink hyperlink = toolkit.createHyperlink(composite, displayName, SWT.NONE); hyperlink.setToolTipText("Show Comments"); hyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { toggleFilter(displayName); } void toggleFilter(final String displayName) { TreeViewer viewer = viewerFunction.apply(null); if (viewer != null) { if (((IReviewItemSet) viewer.getInput()).getAllComments().isEmpty()) { return; } if (displayName.equals(currentFilter)) { viewer.removeFilter(personFilter); currentFilter = null; } else { if (currentFilter != null) { viewer.removeFilter(personFilter); } viewer.addFilter(personFilter); personFilter.setUser(displayName); currentFilter = displayName; } viewer.refresh(); viewer.expandAll(); page.reflow(); } } }); toolkit.createLabel(composite, ""); String value = attribute.getAttribute("value").getValue(); Label voteLabel = toolkit.createLabel(composite, value); if (value.equals("+2")) { voteLabel.setImage(CommonImages.getImage(ReviewsImages.GREEN_CHECK)); } else if (value.equals("+1")) { voteLabel.setImage(CommonImages.getImage(ReviewsImages.PLUS_ONE)); } else if (value.equals("-1")) { voteLabel.setImage(CommonImages.getImage(ReviewsImages.MINUS_ONE)); } else if (value.equals("-2")) { voteLabel.setImage(CommonImages.getImage(ReviewsImages.RED_NOT)); } } } setControl(composite); }