예제 #1
0
 /**
  * Check to see that we have processors for all the steps in the given descriptor
  *
  * @param descriptor the descriptor to check
  * @return whether or not processors for all the descriptor's steps are installed
  */
 public static boolean canProcess(IArtifactDescriptor descriptor) {
   IExtensionRegistry registry = RegistryFactory.getRegistry();
   IExtensionPoint point = registry.getExtensionPoint(PROCESSING_STEPS_EXTENSION_ID);
   if (point == null) return false;
   IProcessingStepDescriptor[] steps = descriptor.getProcessingSteps();
   for (int i = 0; i < steps.length; i++) {
     if (point.getExtension(steps[i].getProcessorId()) == null) return false;
   }
   return true;
 }
 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;
  }