Community
Participate
Working Groups
Build Identifier: 20110615-0604 org.eclipse.ui.forms.widgets.ExpandableComposite.setExpand() does not notify expansion listeners (SWT like), but, unlike in pure SWT, there is no way to notify listeners through notifyListeners() call. Looking at source, there is simply no way to trigger listeners notification programmatically, all notifying methods are private. Reproducible: Always Steps to Reproduce: 1. Create ExpandableComposite 2. add expansion listener 3. call setExpand No listener notified and there is no way to trigger notification.
Little demo program with ExpandableComposite and button to expand it: import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.forms.events.ExpansionAdapter; import org.eclipse.ui.forms.events.ExpansionEvent; import org.eclipse.ui.forms.widgets.ExpandableComposite; public class tmp { Display display = new Display(); Shell shell = new Shell(display, SWT.CLOSE); public tmp() { shell.setLayout(new GridLayout(2, false)); final ExpandableComposite label = new ExpandableComposite(shell, SWT.NULL); label.setText("Title"); label.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { System.out.println("Listener notified"); } }); Button btn = new Button(shell, SWT.NONE); btn.setText("Expand"); btn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { label.setExpanded(!label.isExpanded()); } }); shell.pack(); shell.open(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); } public static void main(String[] args) { new tmp(); } }
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag.
I am getting the same problem with Eclipse RCP 2020-03, I have tried the demo code that is in the but the sout that is in the expansionStateChanged method is never printed, the only signal is the label icon changes.