/** Loads combo choices fromt he platform and from PDE core preferences */
  private void initializeChoices() {
    IEclipsePreferences node = new InstanceScope().getNode(PDECore.PLUGIN_ID);

    fOSChoices = new TreeSet<String>();
    String[] os = Platform.knownOSValues();
    for (int i = 0; i < os.length; i++) {
      fOSChoices.add(os[i]);
    }
    String pref = node.get(ICoreConstants.OS_EXTRA, EMPTY_STRING);
    if (!EMPTY_STRING.equals(pref)) {
      addExtraChoices(fOSChoices, pref);
    }

    fWSChoices = new TreeSet<String>();
    String[] ws = Platform.knownWSValues();
    for (int i = 0; i < ws.length; i++) {
      fWSChoices.add(ws[i]);
    }
    pref = node.get(ICoreConstants.WS_EXTRA, EMPTY_STRING);
    if (!EMPTY_STRING.equals(pref)) {
      addExtraChoices(fWSChoices, pref);
    }

    fArchChoices = new TreeSet<String>();
    String[] arch = Platform.knownOSArchValues();
    for (int i = 0; i < arch.length; i++) {
      fArchChoices.add(arch[i]);
    }
    pref = node.get(ICoreConstants.ARCH_EXTRA, EMPTY_STRING);
    if (!EMPTY_STRING.equals(pref)) {
      addExtraChoices(fArchChoices, pref);
    }

    fNLChoices = new TreeSet<String>();
    String[] nl = LocaleUtil.getLocales();
    for (int i = 0; i < nl.length; i++) {
      fNLChoices.add(nl[i]);
    }
    pref = node.get(ICoreConstants.NL_EXTRA, EMPTY_STRING);
    if (!EMPTY_STRING.equals(pref)) {
      addExtraChoices(fNLChoices, pref);
    }
  }
Esempio n. 2
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;
  }