我的菜单包含菜单项“添加文件1”,“添加文件2”,“保存”。每个都有一个关联的处理程序和命令。现在我需要禁用“保存”菜单项,直到“添加文件1”和“添加File2“至少运行一次。我怎样才能实现这个目标?
我认为可以使用Core表达式完成,但我无法理解如何执行它,特别是plugin.xml修改。对于上面提到的情况,我需要一个非常简单的示例用法。
答案 0 :(得分:0)
在“保存”处理程序中使用@CanExecute
方法执行此操作可能最简单。类似的东西:
public class SaveHandler
{
@CanExecute
public boolean canExecute()
{
boolean enable;
// TODO your code to test if the menus have run and set the enable flag
return enable;
}
@Execute
public void execute()
{
// TODO your execute code
}
}