Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335717 - ServerActionProvider removes all other contribution from the Servers view toolbar
Summary: ServerActionProvider removes all other contribution from the Servers view too...
Status: CLOSED DUPLICATE of bug 291664
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.4   Edit
Assignee: Angel Vera CLA
QA Contact: Angel Vera CLA
URL:
Whiteboard: plan_draft_324
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-28 13:09 EST by Tim deBoer CLA
Modified: 2011-03-09 21:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***