Bug 460974

Summary: [CommonNavigator] Pass the content service into commonWizards
Product: [Eclipse Project] Platform Reporter: Eike Stepper <stepper>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 4.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Eike Stepper CLA 2015-02-26 12:18:56 EST
My commonWizards create new elements and I'd like these new elements be selected in the viewer after their creation.

I could not find a nice way to let my wizards know about the viewer or its content provider. I'm using the following trick but it feels nasty:


      final CDOCheckoutContentProvider contentProvider = getContentProvider();
      final IWizardRegistry wizardRegistry = PlatformUI.getWorkbench().getNewWizardRegistry();

      IWizardRegistry wrapperRegistry = new IWizardRegistry()
      {
        public IWizardCategory getRootCategory()
        {
          return wizardRegistry.getRootCategory();
        }

        public IWizardDescriptor[] getPrimaryWizards()
        {
          return wizardRegistry.getPrimaryWizards();
        }

        public IWizardDescriptor findWizard(String id)
        {
          IWizardDescriptor wizard = wizardRegistry.findWizard(id);
          if (wizard instanceof AbstractNewWizard)
          {
            AbstractNewWizard newWizard = (AbstractNewWizard)wizard;
            newWizard.setContentProvider(contentProvider);
          }

          return wizard;
        }

        public IWizardCategory findCategory(String id)
        {
          return wizardRegistry.findCategory(id);
        }
      };

      newWizardActionGroup = new WizardActionGroup(window, wrapperRegistry, WizardActionGroup.TYPE_NEW,
          extensionSite.getContentService());

It would be cool if there was a "context" injection interface for wizards like ICommonContentProvider or ICommonLabelProvider.