This is the definition,Menu Contributions/Toggle Button Command.
Use the RegistryToggleState has two reasons:
- It implements IExecutableExtension. So you can specify the default values in the plugin.xml.
- It extends PersistentState, so it can remember the value between Eclipse sessions. So if the user had checked/unchecked the menu, restarts Eclipse, he will get the same state as he left before - all this, you get without even your plugin being loaded.
<command
categoryId="lear.IPDetector.category"
id="lear.IPDetector.commands.startDectectCommand"
name="Start Dectect">
<state
id="org.eclipse.ui.commands.toggleState">
<class
class="org.eclipse.ui.handlers.RegistryToggleState">
<parameter
name="default"
value="false">
</parameter>
<parameter
name="persisted"
value="false">
</parameter>
</class>
</state>
</command>