/**
  * Constructs a new selection tracker for the given window and part id.
  *
  * @param window workbench window
  * @param partId part identifier
  */
 public WindowPartSelectionTracker(IWorkbenchWindow window, String partId) {
   super(partId);
   setWindow(window);
   window.addPageListener(this);
   IWorkbenchPage[] pages = window.getPages();
   for (int i = 0; i < pages.length; i++) {
     pageOpened(pages[i]);
   }
 }
 public void windowOpened(IWorkbenchWindow window) {
   window.addPageListener(listener);
 }