I don't know how to control the availability of the menu [message #760043] |
Thu, 01 December 2011 05:17 |
Taichi Yamamura Messages: 3 Registered: November 2011 |
Junior Member |
|
|
Eclipse plugin, which we are developing now, adds menu to Eclipse without using perspective.
The added menu executes the embedded process by selecting it. It is simple as that.
However, use of the added menu is controlled; therefore it is not that the menu is always available.
Availability of the menu switches depends on the conditions.
I needed to increase the number of Eclipse versions that Eclipse plugin can correspond to.
I then modified the program to have Eclipse 4.x corresponsive, but the following two problems are found:
1. I don't know how to control the availability of the menu, which is added by extending org.eclipse.ui.menus.
2. I don't know when the menu action class is loaded.
The details are as follows:
1. I don't know how to control the availability of the menu, which is added by extending org.eclipse.ui.menus.
Up to Eclipse 3.2, in order to add menu to the Eclipse existing menu using plugin, I used the extension of org.eclipse.ui.actionSets.
org.eclipse.ui.actionSets
**└ actionSet
****├ menu
****└ action
Above Eclipse 3.3, it says in the manual that, use the extension of org.eclipse.ui.menus and not the extension of org.eclipse.ui.actionSets.
So I replaced org.eclipse.ui.actionSets with org.eclipse.ui.menus and then I modified the source.
org.eclipse.ui.menus
**└ menuContribution
****└ command
*******└ visibleWhen
After extending org.eclipse.ui.menus and added menu, I understood how to implement the process after the menu selected and controlling method of menu enable/disable.
However, I cannot find out how to control menu availability, which is what we mostly want to do.
Could you please tell me how to control availability of the menu that is added by extending org.eclipse.ui.menus? Or is controlling the availability impossible at all?
2. I don't know when the menu action class is loaded.
In Eclipse 3.x, the menu added by extending org.eclipse.ui.actionSets creates class in which IWorkbenchWindowActionDelegate is embedded, and implements the process (run method) when the menu is selected, and the control (selectionChanged method) of menu availability.
The class created is loaded at the start of Eclipse. When the Eclipse started, I was able to use all functions of plugin.
When I used the Eclipse plugin, which we developed, in Eclipse 4.x, the action of the menu seems to be correctly executed, but controlling of the menu availability is not.
I tried to find out why the controlling of the menu availability is not correctly executed, the class in which IWorkbenchWindowActionDelegate was embedded was loaded at the start of Eclipse in Eclipse 3.x, but in Eclipse 4.x, it was not loaded at the start.
In Eclipse 4.x, it seems that the class is loaded when the action occurs and that is why controlling of the menu availability was impossible.
Is it possible to load the class at the start of Eclipse like it was done for Eclipse 3.x? Or is there any other solution even though the class is not loaded at the start of Eclipse?
Please give me information or hint(s) that would lead to solve the problems.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03956 seconds