Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Controlling enable/disable menu of eclipse4.x(Controlling enable/disable menu of eclipse4.x)
Controlling enable/disable menu of eclipse4.x [message #757012] Wed, 16 November 2011 02:32 Go to next message
Taichi Yamamura is currently offline Taichi Yamamura
Messages: 3
Registered: November 2011
Junior Member
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: Wed, 16 November 2011 04:08]

Report message to a moderator

Re: Controlling enable/disable menu of eclipse4.x [message #757095 is a reply to message #757012] Wed, 16 November 2011 13:51 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

So what happens in 3.x? After the plugin has been loaded, the IWWAD is asked to update the IAction enabled state? And in 4.x that only happens the first time the menu is shown? Or the first time that specific menu item is clicked?

PW


Re: Controlling enable/disable menu of eclipse4.x [message #757418 is a reply to message #757095] Fri, 18 November 2011 11:40 Go to previous messageGo to next message
Taichi Yamamura is currently offline Taichi Yamamura
Messages: 3
Registered: November 2011
Junior Member
Thank you for the reply.

IWorkbenchWindowActionDelegate for the menu was created at the start of Eclipse on 3.x, so it was possible to monitor object status even though the menu is not clicked. That is why it was possible to control menu.
Specifically, that is to disable menu while in specific status.

However, IWorkbenchWindowActionDelegate for the menu is created for the first time only when the menu is clicked on 4.x.
Because of this, if the menu is not clicked, IWorkbenchWindowActionDelegate is not created and thus cannot monitor status. Therefore, the menu gets displayed while in enable status as default.
This causes difference between internal status and menu display status and cannot control menu as a result.

I want to know how to monitor status even when the menu is not clicked and that is why I posted my question.
Re: Controlling enable/disable menu of eclipse4.x [message #757436 is a reply to message #757418] Fri, 18 November 2011 13:01 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:NPE closing part
Next Topic:ToolControl in Toolbar doesn't show up
Goto Forum:
  


Current Time: Wed Oct 01 10:16:47 GMT 2014

Powered by FUDForum. Page generated in 0.01811 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software