Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335717

Summary: ServerActionProvider removes all other contribution from the Servers view toolbar
Product: [WebTools] WTP ServerTools Reporter: Tim deBoer <deboer>
Component: wst.serverAssignee: Angel Vera <arvera>
Status: CLOSED DUPLICATE QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2.4   
Hardware: PC   
OS: Windows XP   
Whiteboard: plan_draft_324

Description Tim deBoer CLA 2011-01-28 13:09:06 EST
The ServerActionProvider removes all contributions from the Servers view toolbar. This includes the 'collapse all' button that's available in every other common navigator view, as well as any buttons added by adopters.

The problem is in method fillActionBars(IActionBars), which contains the line:
	IContributionManager cm = actionBars.getToolBarManager();
	cm.removeAll();
which removes any contributions from other sources.

This method is called every time the user makes a selection in the view, so we can't simply remove the removeAll(), which would repeatedly add the server view's actions to the toolbar. Instead, it could be changed to something like:
	IContributionManager cm = actionBars.getToolBarManager();
	IContributionItem[] cis = cm.getItems();
	List<IAction> existingActions = new ArrayList<IAction>();
	for (IContributionItem ci : cis) {
		if (ci instanceof ActionContributionItem) {
			ActionContributionItem aci = (ActionContributionItem) ci;
			existingActions.add(aci.getAction());
		}
	}
	
	for (int i = 0; i < actions.length - 1; i++)
		if (!existingActions.contains(actions[i]))
			cm.add(actions[i]);
Comment 1 Angel Vera CLA 2011-03-09 21:37:16 EST

*** This bug has been marked as a duplicate of bug 291664 ***