Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse eRCP命令框架-无法动态更新命令标签_Eclipse_Command_Label - Fatal编程技术网

Eclipse eRCP命令框架-无法动态更新命令标签

Eclipse eRCP命令框架-无法动态更新命令标签,eclipse,command,label,Eclipse,Command,Label,我在网上搜索了一整天,试图找到一个如何实现我所读到的关于动态更改命令标签的示例: http://wiki.eclipse.org/Platform_UI_Command_Design#Issue_102_-_Command_implementation_标签的更改 我在plugin.xml中定义了一个命令,该命令使用建议的模式: <command description="Hoping to change my state" id="my.commandWithStat

我在网上搜索了一整天,试图找到一个如何实现我所读到的关于动态更改命令标签的示例:

http://wiki.eclipse.org/Platform_UI_Command_Design#Issue_102_-_Command_implementation_标签的更改

我在plugin.xml中定义了一个命令,该命令使用建议的模式:

<command
     description="Hoping to change my state"
     id="my.commandWithState"
     name="Command Wtih State">
  <state
        class="org.eclipse.jface.menus.TextState"
        id="NAME"/>
</command>
状态值本身会更新,但不会持久化。我在plugin.xml的menuContribution区域中指定了一种“push”样式,命令上的文本始终是“command With State”,因为我没有指定标签(尽管我希望它会更改…)

我使用的是Eclipse3.6,所以我假设我已经有了应该允许从3.3实现这一点的更新

我能够在command ui对象上设置文本的唯一方法是让我的处理程序实现IElementUpdater,就像我在使用ToggleState一样。这允许我在第一次启动产品时总共更改文本1次

我要把头发扯下来了

1) 命令“label”未更新且 2) 即使TextState扩展PersistedState,状态值也不会持久化

什么d>_
public Object execute(final ExecutionEvent pEvent) throws ExecutionException {
        pEvent.getCommand().getState("my.commandWithState").setValue("UPDATED!");
        return null;
    }