private void update(Hyperlink hyperlink, Object object) { String text = labelProvider != null ? labelProvider.getText(object) : object.toString(); Image image = labelProvider != null ? labelProvider.getImage(object) : null; String tooltip = labelProvider != null ? labelProvider.getToolTipText(object) : text; hyperlink.setText(text); hyperlink.setToolTipText(tooltip); if (hyperlink instanceof ImageHyperlink) ((ImageHyperlink) hyperlink).setImage(image); reflow(); }
private void createLink(Object object) { Image image = labelProvider != null ? labelProvider.getImage(object) : null; Hyperlink hyperlink; if (image != null) { hyperlink = getManagedForm().getToolkit().createImageHyperlink(linkContainer, SWT.NULL); ((ImageHyperlink) hyperlink).setImage(image); } else hyperlink = getManagedForm().getToolkit().createHyperlink(linkContainer, null, SWT.NULL); update(hyperlink, object); hyperlink.setData(object); hyperlink.addHyperlinkListener(linkHandler); }