|
From: Thomas R. C. <co...@sa...> - 2006-07-03 00:27:41
|
On Saturday, 01 July 2006 10:24 am, Rogan Dawes escreveu: > Ryan Sonnek (JIRA) wrote: > > [ > > http://opensource.atlassian.com/projects/spring/browse/RCP-376?page=comme > >nts#action_18351 ] > > > > Ryan Sonnek commented on RCP-376: > > --------------------------------- > > > > looks like the LifecycleAdvisor is supposed to initialize this field. > > > > is it true that *only* commands declared in the > > windowCommandBarDefinitions get the application window set on them? > > Yes, I think so. ISTR that there is a special type of > BeanFactory/Context that registers a BeanPostProcessor that is > responsible for setting the current ApplicationWindow. Trace the code, > and see how it is done. You should find it without too much difficulty, > as an inner class somewhere. > > This is one of the reasons that I'm not too happy about the way that > commands are constructed. I was trying to construct a globally > consistent ToggleCommand (i.e. I could define it in one place, and have > it keep all its menuitems, togglebuttons, etc up to date, regardless of > how many windows were opened) > > What it is doing makes sense in a way (creating new commands for each > window, and letting each command know which window it relates to), but > there seems to be no way to define a single globally-consistent > ToggleCommand using this scheme. > > Theoretically, one should create such globally-applicable in the > application context; however, doing this doesn't let the command get > auto-configured with message labels, etc. If I could solve this problem, > I think I'd be happy enough with the way that things are done currently. > I don't know if this deals with what you are talking about, but I declare a list of "otherCommands" in my xml files and then in my lifecycle advisor do this: public void initializeOtherCommandGroups() { // // Only want to do this once, I think. // if ( _loggedIn ) { return; } Iterator iter = _commandGroups.iterator(); String commandGroup; while ( iter.hasNext() ) { commandGroup = (String) iter.next(); getCommandGroup( commandGroup ); } } That gets them all initialized properly. Actually, I have a list of other command groups, other tool bars, or just a list of miscellaneous commands that I want to use. |