Beispiel #1
0
 /** The default constructor. */
 public SampleWizard() {
   PDEPlugin.getDefault().getLabelProvider().connect(this);
   setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWEXP_WIZ);
   samples =
       Platform.getExtensionRegistry()
           .getConfigurationElementsFor("org.eclipse.pde.ui.samples"); // $NON-NLS-1$
   namesPage = new ProjectNamesPage(this);
   lastPage = new ReviewPage(this);
   setNeedsProgressMonitor(true);
   setWindowTitle(PDEUIMessages.ShowSampleAction_title);
 }
  /**
   * Creates a WizardElement representing the template extension to be used by this wizard.
   *
   * @return element representing the template or <code>null</code> if the extension could not be
   *     loaded
   */
  private WizardElement getTemplateWizard() {
    String templateID = getTemplateID();
    if (templateID == null) {
      return null;
    }

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint(PDEPlugin.getPluginId(), PLUGIN_POINT);
    if (point == null) {
      return null;
    }
    IExtension[] extensions = point.getExtensions();
    for (int i = 0; i < extensions.length; i++) {
      IConfigurationElement[] elements = extensions[i].getConfigurationElements();
      for (int j = 0; j < elements.length; j++) {
        if (elements[j].getName().equals(TAG_WIZARD)) {
          if (templateID.equals(elements[j].getAttribute(WizardElement.ATT_ID))) {
            return WizardElement.create(elements[j]);
          }
        }
      }
    }
    return null;
  }