Bug 401528 - [ActionSets] IToolBarManager.add does not refresh properly
Summary: [ActionSets] IToolBarManager.add does not refresh properly
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2013-02-22 09:06 EST by Dave Nice CLA
Modified: 2019-11-10 10:53 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Nice CLA 2013-02-22 09:06:17 EST
My application uses a view menu to add new controls to the toolbar using IToolBarManager.add(..).  Since upgrading to Eclipse 4.2, the toolbar is not redrawn correctly.  We can trigger a redraw by resizing some element of Eclipse (e.g. a view or the main window).

I can recreate by using the hello view sample and making it so that clicking action1 calls this method:
	protected void updateToolBar() {
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager manager = actionBars.getToolBarManager();
		manager.add(action2);
		manager.update(true);
	}

In Eclipse 3.6.2, this adds a new toolbar button successfully.  In Eclipse 4.2.2, the toolbar button does not show until something is resized.
Comment 1 Paul Webster CLA 2013-02-22 09:40:19 EST
That's missing a step, if you modify the actionBar toolbars you need to call  org.eclipse.ui.IActionBars.updateActionBars().

From the doc:

 * Updates the action bars.
 * <p>
 * Clients who add or remove items from the menu, tool bar, or status line
 * managers, or that update global action handlers, should call this method
 * to propagated the changes throughout the workbench.
 * </p>


But if you add that step and it still doesn't update, that's a problem.

PW
Comment 2 Dave Nice CLA 2013-02-22 10:13:09 EST
Fantastic!  If only you were on our development team :-D

It is a change in behaviour from Eclipse 3.6.2, but easy to compensate for.

Finding that bit of doc is a bit tricky - you need to know that the method's there before you can find out you need to call it :-)
Comment 3 Eclipse Genie CLA 2019-09-21 14:43:36 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.