Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

FormText control

It is possible to achieve highly polished results using images, hyperlinks and text snippets mixed together in a form. However, when the mix of these elements is needed as part of one integral text, it is very hard to do. To remedy the problem, UI Forms offer a rudimentary text control that can do the following:

  • Render plain wrapped text

  • Render plain text but convert any segment that starts with https:// into a hyperlink on the flyv

  • Render text with XML tags

In all the modes, FormText control is capable of rendering either a string or an input stream.

Rendering normal text (label mode)

	FormText rtext = toolkit.createFormText(form.getBody(), true);
	String data = "Here is some plain text for the text to render.";
	rtext.setText(data, false, false);

Second argument set to false means that we will treat input text as-is, and the third that we will not try to expand URLs if found.

Automatic conversion of URLs into hyperlinks

It is possible to still handle the text as normal but automatically convert segments with https:// protocol into hyperlinks:

	FormText rtext = toolkit.createFormText(form.getBody(), true);
	String data = "Here is some plain text for the text to render; "+
                       "this text is at https://www.eclipse.org web site.";
	rtext.setText(data, false, true);

Similar to the Hyperlink control, FormText accepts listeners that implement HyperlinkListener. These listeners will be notified about events related to the hyperlink segments within the control.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire