|Commands and default behavior: Save [message #489189]
||Thu, 01 October 2009 18:54
| Millard Ellingsworth
Registered: July 2009
Despite having done a bunch of seemingly cool stuff with Commands (thanks to all who have asked and answered useful questions here), I'm not quite groking how to coax out "default" platform behavior.|
Simple RCP app -- View, Editor, not much else interesting. I add a menu entry with commandId org.eclipse.ui.file.save. When I open an Editor, it is disabled (correctly, since the editor is not dirty). When I change anything in the Editor, I get the asterisk in the title bar indicating it is dirty -- but the Save command (on the toolbar and in the File menu) does not become enabled (nor does the Ctrl-S shortcut). I swear that when I first added this behavior weeks ago, it worked, but maybe I was imagining that. Or maybe there is some interaction with the other stuff that is blocking the correct behavior.
The obvious answer is I don't have a handler. But when I go to add one, I can't find any way to say "use the Save handler that already exists and handles this just fine already". FWIW, we're on 3.4. I didn't add a handler for org.eclipse.ui.help.aboutAction and my About box comes up fine.
I did find this comment in one of Lars (typically excellent) tutorials: "Standard commands sometimes map to actions which are contributed via ActionFactory in the class ApplicationActionBarAdvisor. If the ActionFactory returns an IAction you need to register this action. If not these commands are inactive in your menu.". Is this case one of those? If so, how can I tell? Where should I look next time in order to figure it out ahead of time rather than back into it?
Powered by FUDForum
. Page generated in 0.02248 seconds