且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更新Eclipse菜单项的启用状态

更新时间:2023-09-11 20:53:04

您是否将 org.eclipse.core子类化? .commands.AbstractHandler ?您应该使用 setBaseEnabled(boolean)来更新处理程序的状态(这将更新您的命令)。

Are you subclassing org.eclipse.core.commands.AbstractHandler? You should use setBaseEnabled(boolean) to update the state of your handler (which would update your command).

仅当您还触发 HandlerEvent 时,才可以更改处理程序中的启用状态。调用 setBaseEnabled(boolean)通常会更容易,它将为您触发该事件。

It's only valid to change enabled state in your handler as long as you also fire the HandlerEvent. It's usually easier to call setBaseEnabled(boolean) which will fire the event for you.