Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366363 - No way to notify listeners when expand ExpandableComposite programmatically
Summary: No way to notify listeners when expand ExpandableComposite programmatically
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-ua-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-12 04:26 EST by Viatcheslav Sysoltsev CLA
Modified: 2020-09-24 13:27 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Viatcheslav Sysoltsev CLA 2011-12-12 04:26:14 EST
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.
Comment 1 Viatcheslav Sysoltsev CLA 2011-12-12 04:27:16 EST
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();
	}
}
Comment 2 Lars Vogel CLA 2019-11-14 03:30:55 EST
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.
Comment 3 Jaime Barragan CLA 2020-09-24 13:27:17 EDT
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.