Community
Participate
Working Groups
Build Identifier: 20100617-1415 I have a toggleable command that is defined like so: <command defaultHandler="..." id="toggleTest" name="Test"> <state id="org.eclipse.ui.commands.toggleState"> <class class="org.eclipse.ui.handlers.RegistryToggleState"> <parameter name="persisted" value="true"> </parameter> <parameter name="default" value="false"> </parameter> </class> </state> </command> This works fine, and the state of the command appears (in the UI) to be persisted across application restarts. However, when I attempt to read the state after restarting, the code fails at the assertion (with an AssertionError, not a NullPointerException) regardless of the prior state: Command cmd = ((ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class)).getCommand("toggleTest"); assert cmd.getState(RegistryToggleState.STATE_ID).getValue() != null; Reproducible: Always
Eric, Where are you reading the state? Is it during the workbench startup? Can you attach the stack trace?
The state was being read in a ViewPart.createPartControl. But I'm no longer able to reproduce this issue with Eclipse 3.6.1.
(In reply to comment #2) > The state was being read in a ViewPart.createPartControl. But I'm no longer > able to reproduce this issue with Eclipse 3.6.1. Thanks. Closing this bug. If you are able to reproduce again, please attach the stacktrace and reopen the bug