---

developerWorks: Equipping SWT Applications with Content Assistants

“The concept of content assistants is related to a specific
implementation of JFace text viewers, the class
org.eclipse.jface.text.source.SourceViewer. Instances of this class
are used throughout the Eclipse workbench to implement the various
editors. However, SourceViewers are not restricted to the Eclipse
workbench but may be used in any application that builds upon the
SWT and JFace JARs. This article demonstrates the implementation of
content assistants in the context of an Eclipse editor plug-in, and
gives some hints on how to use content assistants with ‘naked’
SourceViewers.

“Let’s implement a simple HTML editor. Here a content assistant
can be very helpful. For example, a content assistant could
generate typical HTML structures such as tables or links, or could
wrap selected text areas into style tags.

“To save time, we will implement this editor by using one of the
New Plug-in Project wizards to generate an appropriate editor
plug-in. Because this generated editor is an XML editor, and HTML
is an XML-based mark-up language, we only need to make some minor
modifications to convert this generated editor into an HTML editor.
Let’s begin…”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis