|Re: Starting command at startup [message #902792 is a reply to message #902613]
||Mon, 20 August 2012 13:23
| Joseph Carroll
Registered: May 2012
Location: Milwaukee, WI
The main problem I see is that you want to be aware of something that the model doesn't know about (there isn't a "shell" model object). The workbench is aware of the shell, so once you are operating within the workbench you can have a shell injected, however, this is purely convenience. |
The way you can accomplish this (albeit a hack), is to listen for the creation of a workbench window. You would still want to use the life-cycle hook @PostContextCreate (or @ProcessAdittions doesn't matter), but only you would register an event handler with the event admin on the topic UIEvents.Window.TOPIC_ALL and look for the create event (testable through the method isCREATE). Then you would be able to get the active shell (atleast in theory). Once you have executed your code, I would recommend removing your listener from the event admin service.
I'll double check later today to make sure this works. The one issue you may run into is the selection service may not have been populated at this point. IF that is the case, I would believe that to be a bug, but as I said that would be the one caveat that might creep up.
I'll try to model this myself later today and post.
Powered by FUDForum
. Page generated in 0.02720 seconds