Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Commands and default behavior: Save
Commands and default behavior: Save [message #489189] Thu, 01 October 2009 18:54 Go to next message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
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 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 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?


Re: Commands and default behavior: Save [message #489198 is a reply to message #489189] Thu, 01 October 2009 19:44 Go to previous message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
It seems this is one of those cases -- after adding the necessary create/register to ActionBarAdvisor, it all works again [Looking back, I incrementally tore down the Actions stuff and I must have had the makeAction stuff still in place while starting the Commands migration. When I deleted most of the stuff in makeActions(), thinking I didn't need it, it broke -- and I didn't notice quickly enough.]

So, one question remains: How can you tell when you need to do this? And a related question: Is this "legacy" behavior?

New question: I need to do some of this stuff in a plug-in that is not the application (call it the toolkit). Only the application level has an ApplicationActionBarAdvisor that gets called. What I've done for now is add a ToolkitActionBarAdvisor that the Application level calls during it's makeActions(). But that doesn't feel entirely cool. If a plug-in can contribute stuff that requires this sort of behavior, it shouldn't have to rely on the host to enable it, should it?
Previous Topic:In need of assistance with a SearchPage extension
Next Topic:How to deploy a Servlet in a Desktop RCP App?
Goto Forum:

Current Time: Mon Jun 25 14:18:03 GMT 2018

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

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

Back to the top