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" property="description" layoutData="span 3" id="description">
                <listener listenerTypes="MODIFY_TEXT | AFTER_SYNCHRONIZE">
                    <code>//Use red if title length &gt; 12, otherwise use blue color
import org.eclipse.swt.SWT;
if (12 &gt; #CONTROL().getText().length())
    #CONTROLLER().setForeground(#CSSCOLOR(#adichatz-common, error-foreground-color));
    #CONTROLLER().setForeground(#CSSCOLOR(#adichatz-common, info-foreground-color));</code>

Open a new editor for the detail of a film, if the description field is longer than 12 letters, then the foreground color pass to Red otherwise the foreground color is Blue.
listenerTypes=“MODIFY_TEXT | AFTER_SYNCHRONIZE means that listener is launched when text change or after synchonization process.
Be sure that the editor was not already open for the Film, otherwise the editor use the old version without the listener.

2020/04/16 10:56