我想以编程方式设置一个 Eclipse 插件操作(按钮),如下所示:
例如,如果用户按下它,我不希望它在某些条件下关闭。
此代码在此处创建操作(按钮):
class MyAction extends Action {
public MyAction() {
super(NAME, IAction.AS_CHECK_BOX);
}
...
Thread.sleep(100); wait a little bit incase there is a thread update issue
if (condition)
setChecked(true); // does not work, it does not force the button to appear as depressed. It just keeps toggling.
...
}
由于某种原因 setChecked(true) 不起作用。