Controlling enable/disable menu of eclipse4.x [message #757012] |
Tue, 15 November 2011 21:32  |
Eclipse User |
|
|
|
Hi,
Please tell me about controlling plugin menu of eclipse4.x.
Now, I am checking the operation of migrating plugin created for 3.x to 4.x.
I thought that it would go smoothly without any problem, but there was a problem found on controlling menu. Specifically, I was checking on switching enable/disable menu caused by external factor such as selecting object, but for 4.x, controlling could not be done correctly only when not using menu. Here, I am using IWorkbenchWindowActionDelegate for controlling menu.
When I checked by debugging, I realized that the timing when IWorkbenchWindowActionDelegate performed creation is different for 3.x and 4.x as I described below:
3.x timing when loading plugin
4.x timing when executing menu (first time)
Is this caused by the specification difference between 3.x and 4.x?
If so, please tell me how to control activate/deactivate menu when not using the menu so that it would operate the same as 3.x.
[Updated on: Tue, 15 November 2011 23:08] by Moderator
|
|
|
|
|
Re: Controlling enable/disable menu of eclipse4.x [message #757436 is a reply to message #757418] |
Fri, 18 November 2011 08:01  |
Eclipse User |
|
|
|
The correct behaviour of the system is not to create an IWWAD until the first time something activates the plugin. So simply opening a menu and showing the menu item should not instantiate it.
That it was instantiated early in 3.x means something was eagerly starting your plugin that has been fixed in 4.x.
In eclipse with its lazy loading strategy, the workflow is that clicking on the menu should get an "Operation not currently available" or some such, and its state would be correct from then on.
For RCP apps that *really* want the state of their menus to be correct all the time, they can use OSGi to start their plugins in the RCP WorkbenchAdvisor postStartup() method.
PW
|
|
|
Powered by
FUDForum. Page generated in 0.13140 seconds