|
|
|
|
Re: How to store SWT window size and view distribution [message #1020542 is a reply to message #1014196] |
Mon, 18 March 2013 08:19  |
Eclipse User |
|
|
|
Ok, while digging into the possibility of adding "view toolbars" (see http://www.eclipse.org/forums/index.php/mv/msg/450899/1018279/#msg_1018279), found out that the view toolbars have the same problem and how to solve it.
The problem is that when a workbench.xml file exists, the elements of the workbench are created much sooner (when the XML file is read) than when they are usually created. One big difference is, that with an existing workbench.xml the various methods to create UI elements are called before the client has been initialised. The mechanism to support a Coolbar already takes this into account by preparing dummy buttons in the fillCoolBar() method and then calling initViewButtons() once the client and SwtEnvironemt have been started. However, this only configures the pre-created buttons on the coolbar, but does not force a redraw of the coolbar.
We need to get and store the configurer when the ApplicationActionBarAdvisor is created:
private IActionBarConfigurer m_configurer;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
m_configurer = configurer;
((SwtEnvironment) Activator.getDefault().getEnvironment()).setAdvisor(this);
}
and then after updating the coolbar buttons in initViewButtons(), the following call must be made:
m_configurer.getCoolBarManager().update(true);
A similar mechanism is needed for the "view toolbars", which I describe in this post: http://www.eclipse.org/forums/index.php/mv/msg/450899/1020541/#msg_1020541
|
|
|
Powered by
FUDForum. Page generated in 0.07980 seconds