Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 135273 - [Contributions] relayout of view toolbars after remove action does not work
Summary: [Contributions] relayout of view toolbars after remove action does not work
Status: RESOLVED DUPLICATE of bug 122639
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.4   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-06 10:24 EDT by Jörg Lewek CLA
Modified: 2007-09-21 10:47 EDT (History)
2 users (show)

See Also:


Attachments
figures mentioned inthe bug report (15.92 KB, application/zip)
2006-04-06 10:28 EDT, Jörg Lewek CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Lewek CLA 2006-04-06 10:24:44 EDT
I remove and add tool bar action to actionsbars of a view.
I got a different behavior if the actionbar is in the title of the view or in an additional tool bar below the title.
The figure with_action1.jpg shows the additional tool bar with actions added.
The figure without_action1.jpg shows the additional tool bar after removing the actions.
The figure with_action2.jpg shows the title tool bar with actions added.
The figure without_action2.jpg shows the title tool bar after removing the actions.
Comment 1 Jörg Lewek CLA 2006-04-06 10:28:15 EDT
Created attachment 37881 [details]
figures mentioned inthe bug report
Comment 2 Peter Schaich CLA 2006-05-11 11:24:03 EDT
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);
Comment 3 Eric Moffatt CLA 2006-05-11 14:42:47 EDT
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.
Comment 4 Eric Moffatt CLA 2006-08-15 09:23:00 EDT
Sorry, missed the 3.2.1 window due to other issues...
Comment 5 Markus Keller CLA 2007-08-15 11:00:22 EDT
Maybe fixed with bug 122639 (problem sounds similar).
Comment 6 Eric Moffatt CLA 2007-09-21 10:47:41 EDT
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 ***