| Summary: | [Contributions] relayout of view toolbars after remove action does not work | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jörg Lewek <joerg.lewek> | ||||
| Component: | UI | Assignee: | Eric Moffatt <emoffatt> | ||||
| Status: | RESOLVED DUPLICATE | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P2 | CC: | markus.kell.r, peter.schaich | ||||
| Version: | 3.2 | ||||||
| Target Milestone: | 3.4 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Jörg Lewek
Created attachment 37881 [details]
figures mentioned inthe bug report
I tracked it down a little bit while searching for a workaround: The problem seems to be that the Toolbar-Region of the View has to be relayouted, not only updated, since the view has to change if the toolbar becomes to wide after adding a toolbaritem or the view can layouted different when the toolbar becomes smaller by removing a toolbaritem In difference to 3.01, since 3.1.1 the toolbar is relayouted when the size of the view is changed by the user (dragging the sash). In PaneFolder.java i found a comment regarding bug #101683 which issues a relayout when the user changed the size (there is a control listener added to titleAreaProxy to get signalled when a resize occurs). So workaround 1 was to issue a WM_SIZE event to the right composite (this is very tricky and i will not post this). Since this haven't worked in 3.0.1, my final workaround it to force a relayout of the PartStack (which is not nice but works until this bug is fixed): ... getViewSite().getActionBars().getToolBarManager().add(newItem); getViewSite().getActionBars().getToolBarManager().remove(obsoleteItem); getViewSite().getActionBars().updateActionBars(); // force relayout of toolbar after change // this is a hack PartStack partStack = ((ViewSite) getViewSite()).getPane().getStack(); Rectangle bounds = partStack.getBounds(); bounds.width = bounds.width + 1; partStack.setBounds(bounds); bounds.width = bounds.width - 1; partStack.setBounds(bounds); Thanks Peter, there is somewhat similar code in the WOrkbenchWindow's CBanner/CoolBar handling (which works when the main toolbar's contents change; changing the 'size' of the CoolBar (which may also force a 'wrap'). I'll see if I can make the two implementations more symetrical. Sorry, missed the 3.2.1 window due to other issues... Maybe fixed with bug 122639 (problem sounds similar). Thanks Markus, I've just re-tried this and it appears to work now. I'll mark it as a DUP. Jorg, feel free to test this on a version after the other defect was fixed and let me know if it's fixed in your specific case... *** This bug has been marked as a duplicate of bug 122639 *** |