Project: Eclipse_Platform_UI
Bug 186800 [Trim] Provide public API to re-layout Trim contents
Reported: 2007-05-14 10:47:45 | Status: verified fixed

Build ID: I20070503-1400 Steps To Reproduce: I've added a WorkbenchWindowControlContribution to one of the trim areas using the new org.eclipse.ui.menus extension point. It works great, however I'd like to add a dynamic control, that is one whose children change in some way that will affect the layout of the trim. For example, the following control contribution adds a Label and a Button to the Trim area. When the button is clicked the text of the Label is changed. However, the control does not appear correctly in the Trim at this point because the Label text is too long for the Label itself. protected Control createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Label label = new Label(composite, SWT.NONE); label.setText("Label"); Button button = new Button(composite, SWT.PUSH); button.setText("Add"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Model.label = "Something longer"; label.setText("Something longer"); // Need to trigger TrimLayout update here } }); return composite; } I posed this scenario on the Platform newsgroup and it doesn't seem that there is a public API to accomplish this. Can one be exposed to support these dynamic types of control contributions?

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java