/**
   * Returns all extension elements.
   *
   * @return all extension elements.
   * @throws FrameworkException
   */
  private void initLoaders() throws FrameworkException {

    IExtensionRegistry registry = Platform.getExtensionRegistry();

    if (registry == null) {
      return;
    }

    IExtensionPoint extensionPoint =
        registry.getExtensionPoint(EXTENSION_CONFIG_LOADER_CONTRIBUTOR);

    if (extensionPoint == null) {
      return;
    }

    for (IExtension extension : extensionPoint.getExtensions()) {
      if (extension != null) {
        IConfigurationElement[] elements = extension.getConfigurationElements();

        if (elements != null) {
          for (IConfigurationElement element : elements) {
            if (element != null) {
              IDefaultConfigLoader loader =
                  (IDefaultConfigLoader) element.createExecutableExtension("class");
              loaders.add(loader);
            }
          }
        }
      }
    }

    Collections.sort(
        loaders,
        new Comparator<IDefaultConfigLoader>() {

          public int compare(IDefaultConfigLoader arg0, IDefaultConfigLoader arg1) {
            return arg0.getPriority() - arg1.getPriority();
          }
        });
  }
示例#2
0
  /** @throws DataException */
  private void populateAggregations() throws DataException {
    IExtensionRegistry extReg = Platform.getExtensionRegistry();
    IExtensionPoint extPoint = extReg.getExtensionPoint(EXTENSION_POINT);

    if (extPoint == null) return;

    IExtension[] exts = extPoint.getExtensions();
    if (exts == null) return;

    for (int e = 0; e < exts.length; e++) {
      IConfigurationElement[] configElems = exts[e].getConfigurationElements();
      if (configElems == null) continue;

      for (int i = 0; i < configElems.length; i++) {
        if (configElems[i].getName().equals(ELEMENT_AGGREGATIONS)) {
          IConfigurationElement[] subElems =
              configElems[i].getChildren(ELEMENT_AGGREGATION_FACTORY);
          populateFactoryAggregations(subElems);
          subElems = configElems[i].getChildren(ELEMENT_AGGREGATION);
          populateDeprecatedAggregations(subElems);
        }
      }
    }
  }