@Override
  public void processElement(IExtension extension, IConfigurationElement element) throws Exception {
    if (Login.LOGIN_DELEGATE_ELEMENT.equals(element.getName())) {
      ILoginDelegate loginDelegate;
      try {
        loginDelegate = (ILoginDelegate) element.createExecutableExtension("class"); // $NON-NLS-1$
      } catch (Exception e) {
        throw new EPProcessorException(e.getMessage(), extension, e);
      }

      if (this.loginDelegate != null)
        throw new EPProcessorException(
            "More than one plugin provide an extension to \""
                + getExtensionPointID()
                + "\": The plugin \""
                + contributingPluginId
                + "\" did already initialize loginDelegate and the plugin \""
                + extension.getNamespaceIdentifier()
                + "\" collides with this previous contribution!",
            extension); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

      this.contributingPluginId = extension.getNamespaceIdentifier();
      this.loginDelegate = loginDelegate;
    }
  }
 public static List<ICheckNodesService> getCheckNodesService() {
   if (checkNodeServices == null) {
     checkNodeServices = new ArrayList<ICheckNodesService>();
     IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
     IExtensionPoint extensionPoint =
         extensionRegistry.getExtensionPoint(
             "org.talend.designer.core.check_nodes"); //$NON-NLS-1$
     if (extensionPoint != null) {
       IExtension[] extensions = extensionPoint.getExtensions();
       for (IExtension extension : extensions) {
         IConfigurationElement[] configurationElements = extension.getConfigurationElements();
         for (IConfigurationElement configurationElement : configurationElements) {
           try {
             Object service =
                 configurationElement.createExecutableExtension("class"); // $NON-NLS-1$
             if (service instanceof ICheckNodesService) {
               checkNodeServices.add((ICheckNodesService) service);
             }
           } catch (CoreException e) {
             ExceptionHandler.process(e);
           }
         }
       }
     }
   }
   return checkNodeServices;
 }
Example #3
0
  /** see if any extra right click handlers are defined */
  private static void loadLoaderExtensions() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();

    if (registry != null) {
      final IExtensionPoint point = registry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);

      final IExtension[] extensions = point.getExtensions();
      for (int i = 0; i < extensions.length; i++) {
        final IExtension iExtension = extensions[i];
        final IConfigurationElement[] confE = iExtension.getConfigurationElements();
        for (int j = 0; j < confE.length; j++) {
          final IConfigurationElement iConfigurationElement = confE[j];
          RightClickContextItemGenerator newInstance;
          try {
            newInstance =
                (RightClickContextItemGenerator)
                    iConfigurationElement.createExecutableExtension("class");
            addRightClickGenerator(newInstance);
          } catch (final CoreException e) {
            CorePlugin.logError(
                Status.ERROR, "Trouble whilst loading right-click handler extensions", e);
          }
        }
      }
    }
  }
Example #4
0
 /** @param viewer */
 private void addDndSupport(GraphicalViewer viewer, String type) {
   IExtensionPoint point =
       Platform.getExtensionRegistry().getExtensionPoint(UMLPlugin.PLUGIN_ID, "dnd");
   IExtension[] extensions = point.getExtensions();
   for (int i = 0; i < extensions.length; i++) {
     IExtension extension = extensions[i];
     IConfigurationElement[] elements = extension.getConfigurationElements();
     for (int j = 0; j < elements.length; j++) {
       IConfigurationElement element = elements[j];
       try {
         Object object = element.createExecutableExtension("class");
         if (object instanceof UMLDropTargetListenerFactory) {
           UMLDropTargetListenerFactory factory = (UMLDropTargetListenerFactory) object;
           if (factory.accept(type)) {
             TransferDropTargetListener targetListener = factory.getDropTargetListener(viewer);
             viewer.addDropTargetListener(targetListener);
           }
         }
       } catch (CoreException e) {
         e.printStackTrace();
       } finally {
       }
     }
   }
 }
Example #5
0
 EngineExtensionManager() {
   IExtensionRegistry registry = Platform.getExtensionRegistry();
   IExtensionPoint extensionPoint =
       registry.getExtensionPoint("org.eclipse.birt.core.FactoryService");
   IExtension[] extensions = extensionPoint.getExtensions();
   for (IExtension extension : extensions) {
     IConfigurationElement[] elements = extension.getConfigurationElements();
     for (IConfigurationElement element : elements) {
       String type = element.getAttribute("type");
       if ("org.eclipse.birt.report.engine.extension".equals(type)) {
         try {
           Object factoryObject = element.createExecutableExtension("class");
           if (factoryObject instanceof IReportEngineExtensionFactory) {
             IReportEngineExtensionFactory factory =
                 (IReportEngineExtensionFactory) factoryObject;
             IReportEngineExtension engineExtension = factory.createExtension(ReportEngine.this);
             exts.put(engineExtension.getExtensionName(), engineExtension);
           }
         } catch (CoreException ex) {
           logger.log(Level.WARNING, "can not load the engine extension factory", ex);
         }
       }
     }
   }
 }
Example #6
0
 void processingExtensionPointByHand() {
   String xpid = "net.refractions.udig.project.ui.tool";
   IExtensionRegistry registry = Platform.getExtensionRegistry();
   IExtensionPoint extensionPoint = registry.getExtensionPoint(xpid);
   if (extensionPoint == null) {
     throw new NullPointerException("Could not find extensionPoint:" + xpid);
   }
   for (IExtension extension : extensionPoint.getExtensions()) {
     for (IConfigurationElement element : extension.getConfigurationElements()) {
       String name = element.getName();
       System.out.println(name);
       if ("modalTool".equals(name)) {
         try {
           ModalTool tool = (ModalTool) element.createExecutableExtension("class");
           System.out.println(tool);
         } catch (CoreException e) {
           // Perhaps an error in the constructor?
           String message = "Could not create Modal tool " + element.getAttribute("class");
           Status status =
               new Status(IStatus.ERROR, extension.getContributor().getName(), message, e);
           Activator.getDefault().getLog().log(status);
         }
       }
     }
   }
 }
Example #7
0
  public ProcessingStep create(
      IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
    IExtensionRegistry registry = RegistryFactory.getRegistry();
    IExtension extension =
        registry.getExtension(PROCESSING_STEPS_EXTENSION_ID, descriptor.getProcessorId());
    Exception error;
    if (extension != null) {
      IConfigurationElement[] config = extension.getConfigurationElements();
      try {
        Object object = config[0].createExecutableExtension("class"); // $NON-NLS-1$
        ProcessingStep step = (ProcessingStep) object;
        step.initialize(agent, descriptor, context);
        return step;
      } catch (Exception e) {
        error = e;
      }
    } else
      error =
          new ProcessingStepHandlerException(
              NLS.bind(
                  Messages.cannot_get_extension,
                  PROCESSING_STEPS_EXTENSION_ID,
                  descriptor.getProcessorId()));

    int severity = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
    ProcessingStep result = new EmptyProcessingStep();
    result.setStatus(
        new Status(
            severity,
            Activator.ID,
            Messages.cannot_instantiate_step + descriptor.getProcessorId(),
            error));
    return result;
  }
  public static List<ContextComputationStrategy> readContextComputationStrategies() {
    List<ContextComputationStrategy> strategies = new ArrayList<ContextComputationStrategy>();

    IExtensionPoint extensionPoint =
        Platform.getExtensionRegistry().getExtensionPoint(STRATEGIES_EXTENSION_POINT_ID);
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
      IConfigurationElement[] configurationElements = extension.getConfigurationElements();
      for (IConfigurationElement element : configurationElements) {
        if (element.getName().equals(CONTEXT_COMPUTATION_STRATEGY)) {
          try {
            ContextComputationStrategy strategy =
                (ContextComputationStrategy) element.createExecutableExtension(ATTRIBUTE_CLASS);
            strategies.add(strategy);
          } catch (Throwable t) {
            StatusHandler.log(
                new Status(
                    IStatus.ERROR,
                    ContextCorePlugin.ID_PLUGIN,
                    NLS.bind(
                        "Cannot instantiate {0} from bundle {1}: {2}", //$NON-NLS-1$
                        new Object[] {
                          element.getAttribute(ATTRIBUTE_CLASS),
                          extension.getContributor().getName(),
                          t.getMessage()
                        }),
                    t));
          }
        }
      }
    }
    return strategies;
  }
  private static void initializeClientContextIDs() {
    registeredClientContextIds = new java.util.HashSet<String>();

    IExtensionPoint extPoint =
        Platform.getExtensionRegistry().getExtensionPoint(EP_UI_REGISTERED_CLIENT_CONTEXTS);

    for (IExtension extension : extPoint.getExtensions()) {
      for (IConfigurationElement next : extension.getConfigurationElements()) {

        registeredClientContextIds.add(next.getAttribute(A_ID));
      }
    }

    IExtensionTracker extTracker = ValidationUIPlugin.getExtensionTracker();

    if (extTracker != null) {
      IExtensionChangeHandler extensionHandler =
          new IExtensionChangeHandler() {

            public void addExtension(IExtensionTracker tracker, IExtension extension) {

              addClientContextIDs(extension.getConfigurationElements());
            }

            public void removeExtension(IExtension extension, Object[] objects) {
              // client-context IDs cannot be undefined
            }
          };

      extTracker.registerHandler(
          extensionHandler, ExtensionTracker.createExtensionPointFilter(extPoint));
    }
  }
  /** Called by IncQueryBasePlugin. */
  public static void initRegistry() {
    getContributedWellbehavingDerivedFeatures().clear();
    getContributedWellbehavingDerivedClasses().clear();
    getContributedWellbehavingDerivedPackages().clear();

    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint poi;

    poi = reg.getExtensionPoint(IncQueryBasePlugin.WELLBEHAVING_DERIVED_FEATURE_EXTENSION_POINT_ID);
    if (poi != null) {
      IExtension[] exts = poi.getExtensions();

      for (IExtension ext : exts) {

        IConfigurationElement[] els = ext.getConfigurationElements();
        for (IConfigurationElement el : els) {
          if (el.getName().equals("wellbehaving-derived-feature")) {
            processWellbehavingExtension(el);
          } else {
            throw new UnsupportedOperationException(
                "Unknown configuration element "
                    + el.getName()
                    + " in plugin.xml of "
                    + el.getDeclaringExtension().getUniqueIdentifier());
          }
        }
      }
    }
  }
 private List<OpenWizardDescr> loadDataProviders() {
   List<OpenWizardDescr> res = new LinkedList<>();
   IExtensionRegistry registry = Platform.getExtensionRegistry();
   if (registry == null) {
     return res;
   }
   IExtensionPoint point = registry.getExtensionPoint(OPENWIZARD_EXTENSION_POINT);
   if (point == null) {
     return res;
   }
   for (IExtension extension : point.getExtensions()) {
     if (null != extension) {
       for (IConfigurationElement element : extension.getConfigurationElements()) {
         if (null != element) {
           try {
             res.add(createDescr(element));
           } catch (CoreException e) {
             // just ignore
           }
         }
       }
     }
   }
   return res;
 }
  public void testExtensionContributionExpression() throws Exception {
    IAction a =
        new Action() {
          @Override
          public void run() {
            System.out.println("Hello action");
          }
        };
    final MenuManager manager = new MenuManager();
    final ActionContributionItem aci = new ActionContributionItem(a);

    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint menusExtension = reg.getExtensionPoint("org.eclipse.ui.menus");
    IExtension extension = menusExtension.getExtension(EXTENSION_ID);

    IConfigurationElement[] mas = extension.getConfigurationElements();
    final Expression activeContextExpr[] = new Expression[1];
    for (IConfigurationElement ma : mas) {
      IConfigurationElement[] items = ma.getChildren();
      for (IConfigurationElement item : items) {
        String id = item.getAttribute("id");
        if (id != null && id.equals("org.eclipse.ui.tests.menus.itemX1")) {
          IConfigurationElement visibleWhenElement = item.getChildren("visibleWhen")[0];
          activeContextExpr[0] =
              ExpressionConverter.getDefault().perform(visibleWhenElement.getChildren()[0]);
        }
      }
    }
    assertNotNull("Failed to find expression", activeContextExpr[0]);
    AbstractContributionFactory factory =
        new AbstractContributionFactory(LOCATION, TestPlugin.PLUGIN_ID) {
          @Override
          public void createContributionItems(
              IServiceLocator menuService, IContributionRoot additions) {
            additions.addContributionItem(aci, activeContextExpr[0]);
          }
        };

    menuService.addContributionFactory(factory);
    menuService.populateContributionManager(manager, LOCATION);

    assertFalse("starting state", aci.isVisible());

    activeContext = contextService.activateContext(MenuContributionHarness.CONTEXT_TEST1_ID);
    final Menu menu = manager.createContextMenu(window.getShell());
    menu.notifyListeners(SWT.Show, new Event());
    assertTrue("active context", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    contextService.deactivateContext(activeContext);
    activeContext = null;

    menu.notifyListeners(SWT.Show, new Event());
    assertFalse("after deactivation", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    menuService.releaseContributions(manager);
    menuService.removeContributionFactory(factory);
    manager.dispose();
  }
Example #13
0
 /**
  * Returns the {@link INamespaceLabelProvider} for the given {@link ISourceModelElement}'s
  * namespace.
  */
 public static INamespaceLabelProvider getLabelProvider(ISourceModelElement element) {
   IExtensionPoint point =
       Platform.getExtensionRegistry().getExtensionPoint(NAMESPACES_EXTENSION_POINT);
   if (point != null) {
     String namespaceURI = getNameSpaceURI(element);
     for (IExtension extension : point.getExtensions()) {
       for (IConfigurationElement config : extension.getConfigurationElements()) {
         if (namespaceURI.equals(config.getAttribute("uri"))) {
           if (config.getAttribute("labelProvider") != null) {
             try {
               Object provider = config.createExecutableExtension("labelProvider");
               if (provider instanceof INamespaceLabelProvider) {
                 return (INamespaceLabelProvider) provider;
               }
             } catch (CoreException e) {
               BeansUIPlugin.log(e);
             }
           }
           return null;
         }
       }
     }
   }
   return null;
 }
 /**
  * This gets the selection processor which in this case is a composite selection processor that
  * consists of all the extension point providers.
  *
  * @return a selection processor.
  */
 public static ISelectionProcessor getSelectionProcessor() {
   final CompositeSelectionProcessor processors = new CompositeSelectionProcessor();
   final IExtension[] extensions =
       Platform.getExtensionRegistry()
           .getExtensionPoint(SELECTION_PROCESSOR_EXTENSION_POINT_ID)
           .getExtensions();
   for (final IExtension extension : extensions) {
     final IConfigurationElement[] configurationElements = extension.getConfigurationElements();
     try {
       for (final IConfigurationElement configurationElement : configurationElements) {
         if (configurationElement.getName().equals(SELECTION_PROCESSOR)) {
           processors.addProcessor(
               (ISelectionProcessor) configurationElement.createExecutableExtension(CLASS));
         }
       }
     } catch (final CoreException e) {
       OpenInActivator.getDefault()
           .getLog()
           .log(
               Messages.error(
                   "selectionprocessor.error.message", new Object[] {}, e)); // $NON-NLS-1$
     }
   }
   return processors;
 }
  /** Loads the extension for the source code view. */
  public void loadExtensions() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT_ID);
    if (point == null) {
      return;
    }

    IExtension[] extensions = point.getExtensions();
    if (extensions.length > 0) {
      IExtension ex = extensions[0];
      IConfigurationElement[] elems = ex.getConfigurationElements();
      for (IConfigurationElement h : elems) {
        Object obj = null;
        if (h.getName().compareTo("sourcecodeview") == 0) {

          try {
            obj = h.createExecutableExtension("class");
          } catch (CoreException e) {
            e.printStackTrace();
          }
          if (obj instanceof SourceCodeView) {
            sourceCodeView = (SourceCodeView) obj;
          }
        }
      }
    }
  }
 private static QvtTransformationInterpreterFactory getInterpreterFactory() throws MdaException {
   if (implFactory != null) {
     return implFactory;
   }
   IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
   IExtensionPoint extensionPoint =
       pluginRegistry.getExtensionPoint(
           QvtTransformationInterpreterFactory.Descriptor.FACTORY_POINT_ID);
   if (extensionPoint != null) {
     IExtension[] allExtensions = extensionPoint.getExtensions();
     // take only first suitable factory
     for (IExtension ext : allExtensions) {
       IConfigurationElement[] elements = ext.getConfigurationElements();
       Object factoryObj = null;
       try {
         factoryObj =
             elements[0].createExecutableExtension(
                 QvtTransformationInterpreterFactory.Descriptor.CLASS_ATTR);
       } catch (CoreException e) {
         throw new MdaException(e);
       }
       return implFactory = (QvtTransformationInterpreterFactory) factoryObj;
     }
   }
   throw new MdaException(Messages.NoQvtImplementorFactoryRegistered);
 }
 /** @return true if some extensions were found */
 protected boolean configure(String extensionPointId) {
   IExtensionPoint extPoint = registry.getExtensionPoint(extensionPointId);
   if (extPoint == null) {
     return false;
   }
   IExtension[] extensions = extPoint.getExtensions();
   if (extensions.length == 0) {
     return false;
   }
   Map<String, Map<String, ICSSPropertyHandler>> handlersMap =
       new HashMap<String, Map<String, ICSSPropertyHandler>>();
   for (IExtension e : extensions) {
     for (IConfigurationElement ce : e.getConfigurationElements()) {
       if (ce.getName().equals(ATTR_HANDLER)) {
         // a single handler may implement a number of properties
         String name = ce.getAttribute(ATTR_COMPOSITE);
         String adapter = ce.getAttribute(ATTR_ADAPTER);
         // if (className.equals(adapter)) {
         IConfigurationElement[] children = ce.getChildren();
         String[] names = new String[children.length];
         String[] deprecated = new String[children.length];
         for (int i = 0; i < children.length; i++) {
           if (children[i].getName().equals(ATTR_PROPERTY_NAME)) {
             names[i] = children[i].getAttribute(ATTR_NAME);
             deprecated[i] = children[i].getAttribute(ATTR_DEPRECATED);
             if (deprecated[i] != null) {
               hasDeprecatedProperties = true;
             }
           }
         }
         try {
           Map<String, ICSSPropertyHandler> adaptersMap = handlersMap.get(adapter);
           if (adaptersMap == null) {
             handlersMap.put(adapter, adaptersMap = new HashMap<String, ICSSPropertyHandler>());
           }
           if (!adaptersMap.containsKey(name)) {
             Object t = ce.createExecutableExtension(ATTR_HANDLER);
             if (t instanceof ICSSPropertyHandler) {
               for (int i = 0; i < names.length; i++) {
                 adaptersMap.put(
                     names[i],
                     deprecated[i] == null
                         ? (ICSSPropertyHandler) t
                         : new DeprecatedPropertyHandlerWrapper(
                             (ICSSPropertyHandler) t, deprecated[i]));
               }
             } else {
               logError("invalid property handler for " + name);
             }
           }
         } catch (CoreException e1) {
           logError("invalid property handler for " + name + ": " + e1);
         }
       }
     }
   }
   propertyHandlerMap.putAll(handlersMap);
   return true;
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtension[])
  * @param extensions IExtension
  */
 public void added(IExtension[] extensions) {
   for (IExtension extension : extensions) {
     final IConfigurationElement[] configElements = extension.getConfigurationElements();
     for (IConfigurationElement elem : configElements) {
       RegisteredItemProviderAdapterFactoryRegistry.addExtension(elem);
     }
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[])
  */
 public void removed(IExtension[] extensions) {
   for (IExtension extension : extensions) {
     final IConfigurationElement[] configElements = extension.getConfigurationElements();
     for (IConfigurationElement elem : configElements) {
       DifferenceFilterRegistry.INSTANCE.removeExtension(elem);
     }
   }
 }
 private void printExtensionPoints(String pointId) {
   System.out.println("Point [" + pointId + "] search results:");
   IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(pointId);
   if (point != null) {
     for (IExtension ex : point.getExtensions()) {
       System.out.println("   " + ex.getNamespaceIdentifier() + "/" + ex.getUniqueIdentifier());
     }
   }
 }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[])
  * @param extensions IExtension
  */
 public void removed(IExtension[] extensions) {
   for (IExtension extension : extensions) {
     final IConfigurationElement[] configElements = extension.getConfigurationElements();
     for (IConfigurationElement elem : configElements) {
       RegisteredItemProviderAdapterFactoryRegistry.removeExtension(elem);
       RegisteredItemProviderAdapterFactoryRegistry.removeFromComposedAdapterFactory(elem);
     }
   }
 }
  /** key is the plugin id, value is the plugin library path */
  public static synchronized SortedMap<String, String> getContributedDetectors() {
    if (contributedDetectors != null) {
      return contributedDetectors;
    }
    TreeMap<String, String> set = new TreeMap<String, String>();

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT_ID);
    if (point == null) {
      return set;
    }
    IExtension[] extensions = point.getExtensions();
    for (IExtension extension : extensions) {
      IConfigurationElement[] elements = extension.getConfigurationElements();
      for (IConfigurationElement configElt : elements) {
        String libPathAsString;
        String pluginId;
        IContributor contributor = null;
        try {
          contributor = configElt.getContributor();
          if (contributor == null) {
            throw new IllegalArgumentException("Null contributor");
          }
          pluginId = configElt.getAttribute(PLUGIN_ID);
          if (pluginId == null) {
            throw new IllegalArgumentException("Missing '" + PLUGIN_ID + "'");
          }
          libPathAsString = configElt.getAttribute(LIBRARY_PATH);
          if (libPathAsString == null) {
            throw new IllegalArgumentException("Missing '" + LIBRARY_PATH + "'");
          }
          libPathAsString = resolveRelativePath(contributor, libPathAsString);
          if (libPathAsString == null) {
            throw new IllegalArgumentException("Failed to resolve library path for: " + pluginId);
          }
          if (set.containsKey(pluginId)) {
            throw new IllegalArgumentException("Duplicated '" + pluginId + "' contribution.");
          }
          set.put(pluginId, libPathAsString);
        } catch (Throwable e) {
          String cName = contributor != null ? contributor.getName() : "unknown contributor";
          String message =
              "Failed to read contribution for '"
                  + EXTENSION_POINT_ID
                  + "' extension point from "
                  + cName;
          FindbugsPlugin.getDefault().logException(e, message);
          continue;
        }
      }
    }
    contributedDetectors = set;
    return contributedDetectors;
  }
 /**
  * Logs the error in the workbench log using the provided text and the information in the
  * configuration element.
  */
 protected void logError(IConfigurationElement element, String text) {
   IExtension extension = element.getDeclaringExtension();
   StringBuffer buf = new StringBuffer();
   buf.append(
       "Plugin "
           + extension.getNamespace()
           + ", extension "
           + extension.getExtensionPointUniqueIdentifier()); // $NON-NLS-2$//$NON-NLS-1$
   buf.append("\n" + text); // $NON-NLS-1$
   Logger.log(Logger.ERROR, buf.toString());
 }
  /**
   * Creates a new descriptor.
   *
   * @param element the configuration element to read
   * @param registry the computer registry creating this descriptor
   */
  CompletionProposalComputerDescriptor(
      IConfigurationElement element,
      CompletionProposalComputerRegistry registry,
      List<CompletionProposalCategory> categories)
      throws InvalidRegistryObjectException {
    Assert.isLegal(registry != null);
    Assert.isLegal(element != null);

    fRegistry = registry;
    fElement = element;
    IExtension extension = element.getDeclaringExtension();
    fId = extension.getUniqueIdentifier();
    checkNotNull(fId, "id"); // $NON-NLS-1$

    String name = extension.getLabel();
    if (name.length() == 0) fName = fId;
    else fName = name;

    Set<String> partitions = new HashSet<String>();
    IConfigurationElement[] children = element.getChildren(PARTITION);
    if (children.length == 0) {
      fPartitions = PARTITION_SET; // add to all partition types if no partition is configured
    } else {
      for (int i = 0; i < children.length; i++) {
        String type = children[i].getAttribute(TYPE);
        checkNotNull(type, TYPE);
        partitions.add(type);
      }
      fPartitions = Collections.unmodifiableSet(partitions);
    }

    String activateAttribute = element.getAttribute(ACTIVATE);
    fActivate = Boolean.valueOf(activateAttribute).booleanValue();

    fClass = element.getAttribute(CLASS);
    checkNotNull(fClass, CLASS);

    String categoryId = element.getAttribute(CATEGORY_ID);
    if (categoryId == null) categoryId = DEFAULT_CATEGORY_ID;
    CompletionProposalCategory category = null;
    for (CompletionProposalCategory cat : categories) {
      if (cat.getId().equals(categoryId)) {
        category = cat;
        break;
      }
    }
    if (category == null) {
      // create a category if it does not exist
      fCategory = new CompletionProposalCategory(categoryId, fName, registry);
      categories.add(fCategory);
    } else {
      fCategory = category;
    }
  }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[])
  */
 public void removed(IExtension[] extensions) {
   for (IExtension extension : extensions) {
     final IConfigurationElement[] configElements = extension.getConfigurationElements();
     for (IConfigurationElement elem : configElements) {
       if (VIEW_LABELPROVIDER_TAG.equals(elem.getName())) {
         final String extensionClassName =
             elem.getAttribute(ViewLabelProviderIDEExtensionDescriptor.ATTRIBUTE_CLASS);
         ViewLabelProviderExtensionRegistry.removeExtension(extensionClassName);
       }
     }
   }
 }
 private static void dumpExtensions(final IExtension[] extensions, final int depth) {
   for (final IExtension extension : extensions) {
     System.out.println(
         indent(0)
             + "uid="
             + extension.getUniqueIdentifier()
             + " bundle=" //$NON-NLS-1$ //$NON-NLS-2$
             + extension.getContributor().getName()
             + " "); //$NON-NLS-1$
     dumpConfigurationElements(1, depth, extension.getConfigurationElements());
   }
 }
 public Image getImage() {
   if (pageImage == null) {
     String imageName = fConfigElement.getAttribute(ATT_ICON);
     if (imageName != null) {
       IExtension extension = fConfigElement.getDeclaringExtension();
       String plugin = extension.getContributor().getName();
       Image image = getImageFromPlugin(plugin, imageName);
       pageImage = image;
     }
   }
   return pageImage;
 }
 private static void getExtensionsPaths(
     final Set<String> result, final String path, final IExtension[] extensions) {
   for (final IExtension extension : extensions) {
     final String subPath =
         path
             + "uid="
             + extension.getUniqueIdentifier()
             + " bundle=" //$NON-NLS-1$ //$NON-NLS-2$
             + extension.getContributor().getName()
             + " "; //$NON-NLS-1$
     getConfigurationElementsPaths(result, subPath, extension.getConfigurationElements());
   }
 }
  private void extensionsToString(IExtension[] extensions) {
    extensionIDs = new ArrayList(extensions.length);
    for (int i = 0; i < extensions.length; i++) {
      IExtension extension = extensions[i];
      extensionIDs.add(extension.getUniqueIdentifier());

      // test navigation: to extension point
      String ownerId = extension.getExtensionPointUniqueIdentifier();
      if (extPointId != null) assertTrue(extPointId.equals(ownerId));
      // test navigation: all children
      assertTrue(validContents(extension.getConfigurationElements()));
    }
  }
 public static void runStartupExtensions() {
   IExtensionRegistry registry = Platform.getExtensionRegistry();
   IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_ID_STARTUP);
   IExtension[] extensions = extensionPoint.getExtensions();
   for (IExtension extension : extensions) {
     IConfigurationElement[] elements = extension.getConfigurationElements();
     for (IConfigurationElement element : elements) {
       if (element.getName().compareTo(ELEMENT_STARTUP) == 0) {
         runStartupExtension(element);
       }
     }
   }
 }