Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » toggle state not persisted
icon9.gif  toggle state not persisted [message #670810] Sun, 15 May 2011 17:29 Go to next message
Anton Mising name is currently offline Anton Mising nameFriend
Messages: 7
Registered: August 2010
Junior Member
Hi there,

I am using v3.5.2

Despite setting the persisted parameter to true, the state isn't stored between two sessions.

Here is how I define the command:
      <command
            defaultHandler="xyz.example.commands.menuColumns.NameHandler"
            id="xyz.example.commands.menuColumns.name"
            name="Name">
         <state
               class="org.eclipse.ui.handlers.RegistryToggleState"
               id="org.eclipse.ui.commands.toggleState">
            <class
                  class="org.eclipse.ui.handlers.RegistryToggleState">
               <parameter
                     name="persisted"
                     value="true">
               </parameter>
            </class>
         </state>
      </command>


And here some code of the menu contribution part:
<command
                     commandId="xyz.example.commands.menuColumns.name"
                     label="Name"
                     style="toggle">
               </command>


Any help will be appreciated!
Re: toggle state not persisted [message #670993 is a reply to message #670810] Mon, 16 May 2011 13:21 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:Problem exporting: A cycle was detected when generating the classpath
Next Topic:How to add functionality to an existing View using a PlugIn
Goto Forum:
  


Current Time: Fri Apr 19 23:34:20 GMT 2024

Powered by FUDForum. Page generated in 0.03200 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top