Bug 460974 - [CommonNavigator] Pass the content service into commonWizards
Summary: [CommonNavigator] Pass the content service into commonWizards
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-26 12:18 EST by Eike Stepper CLA
Modified: 2015-02-26 12:18 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.