Yes, I have SelectionListeners on all menu items. When the Opeen, New or Import item is selected the listener calls the sendOpenEvent method in the DocumentManager, with an int parameter specifyingthe action to be taken. This method creates an instance of Event and places the parameter in the detail field. It then calls notifyListeners on the DocumentManager's Shell with SWT.OpenDocument and the event. When it started, WPManager used addListener on the Display, which is the only SWT class it has, to add a listener for the OpenDocument event. The handleEvent method in this listener calls the addDocument method in the WPManager. This creates a new instance of DocumentManager and adds it to the ArrayList of active documents. However, this never happens. It is not necessary to generate an event for the Close menu selection, since this process occurs entirely withing the DocumentManager. The listener merely sets an exitSelected boolean to true. The normal event loop also tests the value of this boolean, and if it is true the DocumentManager does what is necessary to close the document and exits. The addDocument method in the WPManager, which created this instance of DocumentManager then sets its reference in the list of active documents to null, so the garbage collector can dispose of it, and then removes the reference from the list of active documents. John dreats an instan On Wed, Jun 15, 2011 at 04:05:56PM -0700, Chris von See wrote: > I'm not sure I completely understand what you did, but what I've done > in the past is add a SelectionListener to the "Open..." menu item. > The listener gets called when the user selects that menu item; you can > then create and open a file dialog to allow the user to select the > file and create your XOM tree, views, etc. You can also use a > SelectionListener on a "Close" menu item to close the active document > and free resources. > > Cheers > Chris > > > > On Jun 15, 2011, at 3:47 PM, John J. Boyer wrote: > > >In the design for the word processor that I have come up with, it is > >entered by a call to WPManager from somewhere, the main mehtod now. > >WPManager creates an instance of DocumentManager which creates > >instances > >of BrailleView, SaisyView, BBMenu BBToolbar and BstatusBar. > >DocumentManager handles everything relating to a single document. When > >the user choses the Open, New or Import items on the menu it calls > >notifyListeners on its Shell. WPmanager has previously registered a > >listener for the IpenDocument event on the display. The listener is > >supposed to call a method which creates a new document and adds it > >to an > >ArrayList of documents. However, the listener never hears anything. > >What > >is wrong? > > > >Thanks, > >John > > > >-- > >John J. Boyer; President, Chief Software Developer > >Abilitiessoft, Inc. > >http://www.abilitiessoft.com > >Madison, Wisconsin USA > >Developing software for people with disabilities > > > > > -- John J. Boyer; President, Chief Software Developer Abilitiessoft, Inc. http://www.abilitiessoft.com Madison, Wisconsin USA Developing software for people with disabilities