Exemple #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);
 }
  public IdentityRepository[] getPluggedInIdentityRepositries() {

    IExtension[] extensions =
        Platform.getExtensionRegistry()
            .getExtensionPoint(JSchCorePlugin.ID, JSchCorePlugin.PT_IDENTITYREPOSITORY)
            .getExtensions();

    if (extensions.length == 0) return new IdentityRepository[0];

    ArrayList tmp = new ArrayList();
    for (int i = 0; i < extensions.length; i++) {
      IExtension extension = extensions[i];
      IConfigurationElement[] configs = extension.getConfigurationElements();
      if (configs.length == 0) {
        JSchCorePlugin.log(
            IStatus.ERROR,
            NLS.bind(
                "IdentityRepository {0} is missing required fields",
                (new Object[] {extension.getUniqueIdentifier()})),
            null); //$NON-NLS-1$
        continue;
      }
      try {
        IConfigurationElement config = configs[0];
        AbstractIdentityRepositoryFactory iirf =
            (AbstractIdentityRepositoryFactory)
                config.createExecutableExtension("run"); // $NON-NLS-1$
        tmp.add(iirf.create());
      } catch (CoreException ex) {
        JSchCorePlugin.log(
            IStatus.ERROR,
            NLS.bind(
                "Unable to instantiate identity repository {0}",
                (new Object[] {extension.getUniqueIdentifier()})),
            ex); //$NON-NLS-1$
      }
    }

    IdentityRepository[] repositories = new IdentityRepository[tmp.size()];
    for (int i = 0; i < tmp.size(); i++) {
      repositories[i] = (IdentityRepository) tmp.get(i);
    }
    return repositories;
  }
 protected void lazyInitialize() {
   if (descriptors != null) return;
   IExtensionPoint point =
       Platform.getExtensionRegistry()
           .getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_MODEL_PROVIDERS);
   IExtension[] extensions = point.getExtensions();
   descriptors = new HashMap(extensions.length * 2 + 1);
   for (int i = 0, imax = extensions.length; i < imax; i++) {
     IModelProviderDescriptor desc = null;
     try {
       desc = new ModelProviderDescriptor(extensions[i]);
     } catch (CoreException e) {
       Policy.log(e);
     }
     if (desc != null) descriptors.put(desc.getId(), desc);
   }
   // do cycle detection now so it only has to be done once
   // cycle detection on a graph subset is a pain
   detectCycles();
 }
  /**
   * 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;
  }
 public void unregister() {
   Platform.getExtensionRegistry().removeListener(this);
 }
 public void register(String id) {
   extPointId = id; // used for verification in callbacks
   if (extPointId != null) Platform.getExtensionRegistry().addListener(this, extPointId);
   else Platform.getExtensionRegistry().addListener(this);
 }