开发者

How to enable an eclipse MenuItem from Java Code if it is being disabled from Plugin.xml

I have created a MenuItem and made it disable in Plugin.xml.

<开发者_运维技巧;enableFor = false>

Now I want to enable the above MenuItem but only THROUGH JAVA or business logic. How to do?


If you are using objectContributions or actionSets, your IActionDelegate can set the menu item enablement in the run(IAction) or selectionChanged(IAction, ISelection) method.

If you are using commands and handlers (recommended), then you can write an enabledWhen core expression [1]. You can declaratively use any of the variables provided, and you can write a PropertyTester [2] to programmatically provide the enabled state.

[1] http://wiki.eclipse.org/Command_Core_Expressions
[2] http://wiki.eclipse.org/Platform_Expression_Framework

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜