|Need Command Reference on Startup [message #988234]
||Thu, 29 November 2012 02:54
| Mark Leone
Registered: April 2012
I contribute a toggle-style Command to a view menu via plugin.xml. The command has a state defined, with id org.eclipse.ui.commands.toggleState, and a default value of true the first time the runtime workspace is created. Afterwards, the state is automatically persisted between workbench restarts. The command shows up on the view menu, selected or not depending on its most recent state. When I select it, the default handler fires and is able to toggle the state and retrieve the old value.|
That's all great, but having the command persist its state does me no good if I can't retrieve the state independent of the user executing the command. I use the toggle state to determine a certain behavior in the view. If I don't know the state of the command on startup, I can't make the view behave consistent with the toggle setting of the command, until the user executes the Command the first time, enabling me to retrieve the state in the handler's execute method.
So how can I get a reference to this command or its state value (my real objective), other than from the ExecutionEvent provided in the execute method of the handler?
[Updated on: Thu, 29 November 2012 02:55]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.16211 seconds