Bug 202382 [Forms] Behaviour of Section with fixed style changed between Eclipse 3.0 and 3.1 (and later)
Build ID: M20060118-1600 Steps To Reproduce: 1. Create a section and assign a shortcut: final Section addressSection = toolkit.createSection(this, SWT.NONE); addressSection.setText("&Adresse"); 2. Add a text field to the section final Composite nameComposite = toolkit.createComposite(addressComposite, SWT.NONE); toolkit.createLabel(nameComposite, "Name", SWT.NONE); final Text nameText = toolkit.createText(nameComposite, null, SWT.NONE); 3. Run this in a Eclipse 3.0 dialog. Pressing the shortcut key ALT-A moves the focus to the text input file nameText. 4. Run this in a Eclipse 3.1 dialog. Pressing the shortcut key ALT-A hides the section! More information: In the ExpandableComposite which is the base class of Section, there is always a TraverseListener added to the object. This TraverseListener always toggles the state of the section, even if isFixedStyle() returns true. To restore the old behaviour, simply call programmaticToggleState() only if isFixedSytle() returns false.
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.internal.forms.widgets.FormUtil;
import org.eclipse.ui.internal.forms.widgets.FormsResources;
/**
 * This composite is capable of expanding or collapsing a single client that is
 * its direct child. The composite renders an expansion toggle affordance
 * (according to the chosen style), and a title that also acts as a hyperlink
 * (can be selected and is traversable). The client is layed out below the title
 * when expanded, or hidden when collapsed.
 * <p>
 * The widget can be instantiated as-is, or subclassed to modify some aspects of
 * it. *
 * <p>
 * Since 3.1, left/right arrow keys can be used to control the expansion state.
 * If several expandable composites are created in the same parent, up/down
 * arrow keys can be used to traverse between them. Expandable text accepts
 * mnemonics and mnemonic activation will toggle the expansion state.
 * 
 * <p>
 * While expandable composite recognize that different styles can be used to
 * render the title bar, and even defines the constants for these styles (<code>TITLE_BAR</code>
 * and <code>SHORT_TITLE_BAR</code> the actual painting is done in the
 * subclasses.
 * 
 * @see Section
 * @since 3.0
 */
public class ExpandableComposite extends Canvas {