@Override public void setEnabled(boolean enabled) { if (!isDisposed()) { super.setEnabled(enabled); if (commentsText != null && commentsText.getControl() != null) { commentsText.getControl().setEnabled(enabled); } } }
/** * 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()); }
/** * Sets the given text into the <code>RichTextCommentsComposite</code> * * @param text text to put into the <code>RichTextCommentsComposite</code> */ public void setDocumentationValue(String text) { commentsText.setText(text); }
/** * This method returns the text contained in the <code>RichTextCommentsComposite</code> * * @return the text contained in the <code>RichTextCommentsComposite</code> */ public String getDocumentationValue() { return commentsText.getText(); }