Bug 20988 - [Coolbar] CoolBarManager does not support wrapping with a SubToolBarManager
Summary: [Coolbar] CoolBarManager does not support wrapping with a SubToolBarManager
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 2.1.1   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-25 21:31 EDT by Randy Giffen CLA
Modified: 2003-04-16 15:48 EDT (History)
3 users (show)

See Also:


Attachments
source for hacked MultiPageContributor (4.92 KB, text/plain)
2002-06-25 21:34 EDT, Randy Giffen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Giffen CLA 2002-06-25 21:31:16 EDT
GM3 

Clients of action bars may create a number of SubToolBarManagers on their 
IToolBarManager (ex. multipage editor).
The client will typically set one SubToolBarManager visible, the rest 
invisible and call updateActionBars.

However, CoolBarManager.update(boolean) does not call update on its 
CoolBarContributionItems. Thus if the visibility of one of the items in a 
CoolBarContributionItem has changed, this change will not be visible.

The attached hack of MultiPageContributor demonstrates the problem using our 
multipage editor example. 

A proposed fix is to update the CoolBarContributionItems at the end of 
CoolBarManager.update(boolean)

// update CoolBarContributionItems
items = getItems();
for (int i = 0; i < items.length; i++) {
   CoolBarContributionItem cbItem = (CoolBarContributionItem) items[i];
   cbItem.update(force);
}

A Workaround is for the client to explictly update the toolbar.
ex.
	actionBars.updateActionBars();
	actionBars.getToolBarManager().update(false);
Comment 1 Randy Giffen CLA 2002-06-25 21:34:47 EDT
Created attachment 1595 [details]
source for hacked MultiPageContributor
Comment 2 Randy Giffen CLA 2002-06-25 21:36:32 EDT
Peter could you verify the workaround works for you.
Comment 3 Peter Burka CLA 2002-06-26 10:52:40 EDT
Workaround seems to work. Thanks!
Comment 4 Lynne Kues CLA 2002-06-26 12:15:56 EDT
Calling update for each coolbar item in update for the CoolBarManager is 
probably not a good idea (unnecessary, may cause flash).  It seems like the fix 
would be to have updateActionBars() call CoolBarManager.update().
Comment 5 Lynne Kues CLA 2002-10-30 14:44:08 EST
Changed SubActionBars.updateActionBars() to handle the case where the action 
bar has its own toolbarmanager (i.e., it's a cool item).
Comment 6 Lynne Kues CLA 2003-04-11 11:45:22 EDT
The fix for this somehow got lost when SubActionBars was moved from 
org.eclipse.ui.internal to org.eclipse.ui.
Comment 7 Lynne Kues CLA 2003-04-11 13:45:33 EDT
Should put the fix back in for 2.1.1.

public void updateActionBars() {
	IToolBarManager mgr = getToolBarManager();
	if (mgr instanceof CoolItemToolBarManager) {
		mgr.update(false);
	} 
	parent.updateActionBars();
	fireActionHandlersChanged();
}
Comment 8 Nick Edgar CLA 2003-04-16 09:56:02 EDT
Approved.
Comment 9 Lynne Kues CLA 2003-04-16 15:48:44 EDT
Released fix into 2.1.1 and head streams.