|
Re: toggle state not persisted [message #670993 is a reply to message #670810] |
Mon, 16 May 2011 09:21  |
Eclipse User |
|
|
|
There doesn't appear to be anything wrong with your XML, and a brief examination of the code seems to indicate that it was available in 3.5.x. Here's an example to look at:
<command
categoryId="org.eclipse.ui.category.edit"
defaultHandler="org.eclipse.example.commands.MonitorCountHandler"
id="org.eclipse.example.commands.monitorCount"
name="Monitor Count">
<state
class="org.eclipse.ui.handlers.RegistryToggleState:false"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
and then in the toolbar something like:
<command
commandId="org.eclipse.example.commands.monitorCount"
icon="images/collapseall.gif"
style="toggle">
</command>
The handler then uses org.eclipse.ui.handlers.HandlerUtil.toggleCommandState(Comma nd) to work with the command State object.
The example is at https://github.com/paulweb515/commandsEclipseCon2011 in the org.eclipse.example.commands plugin.
PW
|
|
|
Powered by
FUDForum. Page generated in 0.03407 seconds