/** * Constructor. * * @param parent the parent composite * @param style the composite style */ public RichTextComposite(Composite parent, int style) { super(parent, style); Composite container = new Composite(this, SWT.BORDER); GridLayout richTextLayout = new GridLayout(); richTextLayout.marginWidth = 0; richTextLayout.marginHeight = 0; container.setLayout(richTextLayout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); commentsText = new RichText(container, SWT.NONE); commentsText.setEditable(false); commentsText.setLayoutData(new GridData(GridData.FILL_BOTH)); // the Rich Text control is a Browser for sure. Browser browser = (Browser) commentsText.getControl(); browser.addLocationListener(new URLLocationListener()); }