Listener is a way to add code to generated UI classes by specifying it in the xml File. For example, open file $projectDirectory/resources/xml/include/detail/FilmDI.xml with XML editor.
Change element:

		<text textLimit="255" mandatory="true" property="title" id="title"/>
		<text textLimit="255" mandatory="true" property="title" id="title">
		        <listener listenerTypes="MODIFY_TEXT">
		             <code>//Use red if title length &gt;=40, otherwise use blue color
import org.eclipse.swt.SWT;
if (40 &lt; #CONTROL(title).getText().length())

Open a new editor for the detail of a film, if the description field is longer than 40 letters, then the foreground color pass to Red otherwise the foreground color is Blue. Be sure that the editor was not already open for the Film, otherwise the editor use the old version without the listener.

tutorial/create_listener.txt · Last modified: 2015/10/05 17:52 (external edit)