Java 类org.eclipse.core.runtime.IExtension 实例源码

项目:gemoc-studio-modeldebugging    文件:Activator.java   
/**
 * Retrieve all the locators registered with the extension point, and additionally store them in a cache.
 * 
 * @return All locators registered with the extension point.
 */
public List<ILocator> retrieveLocators() {
    if (locators == null) {
        IExtensionRegistry reg = Platform.getExtensionRegistry();
        IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.gemoc.dsl.debug.locator");
        IExtension[] extensions = ep.getExtensions();
        ArrayList<ILocator> contributors = new ArrayList<ILocator>();
        for (int i = 0; i < extensions.length; i++) {
            IExtension ext = extensions[i];
            IConfigurationElement[] ce = ext.getConfigurationElements();
            for (int j = 0; j < ce.length; j++) {
                ILocator locator;
                try {
                    locator = (ILocator)ce[j].createExecutableExtension("class");
                    contributors.add(locator);
                } catch (CoreException e) {
                    e.printStackTrace();
                }
            }
        }
        locators = contributors;
    }
    return locators;
}
项目:gemoc-studio    文件:AbstractNewProjectWizardWithTemplates.java   
public ElementList getAvailableCodegenWizards() {
    ElementList wizards = new ElementList("CodegenWizards"); //$NON-NLS-1$
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint(org.eclipse.gemoc.commons.eclipse.pde.Activator.PLUGIN_ID, PLUGIN_POINT);
    if (point == null)
        return wizards;
    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)) {
                String targetPluginId = elements[j].getAttribute(WizardElement.ATT_TARGETPLUGINID);
                if( targetPluginId == null || targetPluginId.equals(getTargetPluginId())){
                    WizardElement element = createWizardElement(elements[j]);
                    if (element != null) {
                        wizards.add(element);
                    }
                }
            }
        }
    }
    return wizards;
}
项目:OCCI-Studio    文件:OcciRegistry.java   
/**
 * Initializes the extensions map.
 * 
 * @throws CoreException
 *             if the registry cannot be initialized
 */
public void initialize() {
  try {
    if (Platform.isRunning()) {
        registry.clear();
        final IExtension[] extensions = Platform.getExtensionRegistry()
                .getExtensionPoint(OCCIE_EXTENSION_POINT).getExtensions();
        for (int i = 0; i < extensions.length; i++) {
            final IConfigurationElement[] configElements = extensions[i]
                    .getConfigurationElements();
            for (int j = 0; j < configElements.length; j++) {
                String scheme = configElements[j].getAttribute("scheme"); //$NON-NLS-1$
                String uri = "platform:/plugin/" + extensions[i].getContributor().getName() + "/" + configElements[j].getAttribute("file"); //$NON-NLS-1$
                registerExtension(scheme, uri);
            }
        }
    }
  } catch(NoClassDefFoundError ncdfe) {
      LOGGER.info("  Running out of an Eclipse Platform...");
  }
}
项目:M2Doc    文件:DeclaredServicesListener.java   
@Override
public void removed(IExtension[] extensions) {
    for (IExtension extension : extensions) {
        if (SERVICE_REGISTERY_EXTENSION_POINT.equals(extension.getExtensionPointUniqueIdentifier())) {
            for (IConfigurationElement element : extension.getConfigurationElements()) {
                if (TOKEN_ELEMENT_NAME.equals(element.getName())) {
                    final String tokenName = element.getAttribute(SERVICE_TOKEN_ATTR_NAME);
                    final String bundleName = extension.getContributor().getName();
                    final List<String> services = new ArrayList<String>();
                    for (IConfigurationElement child : element.getChildren()) {
                        final String className = child.getAttribute(SERVICE_CLASS_ATTR_NAME);
                        services.add(className);
                    }
                    ServiceRegistry.INSTANCE.remove(tokenName, bundleName, services);
                }
            }
        }
    }
}
项目:team-explorer-everywhere    文件:DataProviderActionCache.java   
private void populate() {
    dataProviderActions = new HashMap();

    final IExtension[] extensions =
        SupportManager.getExtensions(Constants.DATA_PROVIDER_ACTIONS_EXTENSION_POINT_NAME);

    for (int i = 0; i < extensions.length; i++) {
        final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
        for (int j = 0; j < configElements.length; j++) {
            final DataProviderActionInfo dataProviderAction = getDataProviderAction(configElements[j]);
            if (dataProviderAction != null) {
                if (dataProviderActions.containsKey(dataProviderAction.getID())) {
                    final String messageFormat = "data provider action [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
                    final String message = MessageFormat.format(
                        messageFormat,
                        dataProviderAction.getID(),
                        Utils.messageFor(configElements[j], Constants.DATA_PROVIDER_ACTIONS_EXTENSION_POINT_NAME));

                    SupportManager.log(IStatus.WARNING, message);
                }

                dataProviderActions.put(dataProviderAction.getID(), dataProviderAction);
            }
        }
    }
}
项目:team-explorer-everywhere    文件:DataCategoryCache.java   
private void populate() {
    categories = new HashMap();

    final IExtension[] extensions = SupportManager.getExtensions(Constants.DATA_CATEGORIES_EXTENSION_POINT_NAME);

    for (int i = 0; i < extensions.length; i++) {
        final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
        for (int j = 0; j < configElements.length; j++) {
            final DataCategory dataCategory = getDataCategory(configElements[j]);
            if (dataCategory != null) {
                if (categories.containsKey(dataCategory.getID())) {
                    final String messageFormat = "data category [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
                    final String message = MessageFormat.format(
                        messageFormat,
                        dataCategory.getID(),
                        Utils.messageFor(configElements[j], Constants.DATA_CATEGORIES_EXTENSION_POINT_NAME));

                    SupportManager.log(IStatus.WARNING, message);
                }

                categories.put(dataCategory.getID(), dataCategory);
            }
        }
    }
}
项目:team-explorer-everywhere    文件:ExportHandlerCache.java   
private void populate() {
    exportHandlers = new HashMap();

    final IExtension[] extensions = SupportManager.getExtensions(Constants.EXPORT_HANDLERS_EXTENSION_POINT_NAME);

    for (int i = 0; i < extensions.length; i++) {
        final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
        for (int j = 0; j < configElements.length; j++) {
            final ExportHandlerInfo exportHandler = getExportHandler(configElements[j]);
            if (exportHandler != null) {
                if (exportHandlers.containsKey(exportHandler.getID())) {
                    final String messageFormat = "export handler [{0}] has been defined multiple times {1}"; //$NON-NLS-1$
                    final String message = MessageFormat.format(
                        messageFormat,
                        exportHandler.getID(),
                        Utils.messageFor(configElements[j], Constants.EXPORT_HANDLERS_EXTENSION_POINT_NAME));

                    SupportManager.log(IStatus.WARNING, message);
                }

                exportHandlers.put(exportHandler.getID(), exportHandler);
            }
        }
    }
}
项目:subclipse    文件:SVNFileModificationValidator.java   
private IFileModificationValidator loadUIValidator() {
      IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ID, DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION);
if (extension != null) {
    IExtension[] extensions =  extension.getExtensions();
    if (extensions.length > 0) {
        IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
        if (configElements.length > 0) {
            try {
                      Object o = configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
                      if (o instanceof IFileModificationValidator) {
                          return (IFileModificationValidator)o;
                      }
                  } catch (CoreException e) {
                      SVNProviderPlugin.log(e.getStatus().getSeverity(), e.getMessage(), e);
                  }
        }
    }
}
return null;
  }
项目:ermasterr    文件:ExtendPopupMenu.java   
/**
 * plugin.xmlからタグを読み込む.
 * 
 * @throws CoreException
 * @throws CoreException
 */
public static List<ExtendPopupMenu> loadExtensions(final ERDiagramEditor editor) throws CoreException {
    final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();

    final IExtensionRegistry registry = Platform.getExtensionRegistry();
    final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (final IExtension extension : extensionPoint.getExtensions()) {
            for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {

                final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);

                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }

    return extendPopupMenuList;
}
项目:mesfavoris    文件:PluginBookmarkTypes.java   
public synchronized List<PluginBookmarkType> getBookmarkTypes() {
    if (bookmarkTypes != null) {
        return bookmarkTypes;
    }
    bookmarkTypes = new ArrayList<>();
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
    if (extensionPoint == null) {
        StatusHelper.logError(MessageFormat.format("no {0} extension point", EXTENSION_POINT), null);
        return bookmarkTypes;
    }
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (IConfigurationElement element : elements) {
            if ("bookmarkType".equals(element.getName())) {
                PluginBookmarkType bookmarkType = new PluginBookmarkType(element);
                bookmarkTypes.add(bookmarkType);
            }
        }
    }
    return bookmarkTypes;
}
项目:mesfavoris    文件:BookmarkProblemDescriptors.java   
private synchronized Map<String, IBookmarkProblemDescriptor> getBookmarkProblemDescriptors() {
    if (bookmarkProblemDescriptors != null) {
        return bookmarkProblemDescriptors;
    }
    bookmarkProblemDescriptors = new HashMap<>();
    IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
    if (extensionPoint == null) {
        StatusHelper.logError(MessageFormat.format("no {0} extension point", EXTENSION_POINT), null);
        return bookmarkProblemDescriptors;
    }
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (IConfigurationElement element : elements) {
            IBookmarkProblemDescriptor bookmarkProblemDescriptor = getBookmarkProblemDescriptor(element);
            if (bookmarkProblemDescriptor != null) {
                bookmarkProblemDescriptors.put(bookmarkProblemDescriptor.getProblemType(),
                        bookmarkProblemDescriptor);
            }
        }
    }
    return bookmarkProblemDescriptors;
}
项目:ermaster-k    文件:ExtendPopupMenu.java   
/**
 * plugin.xmlからタグを読み込む.
 * 
 * @throws CoreException
 * 
 * @throws CoreException
 */
public static List<ExtendPopupMenu> loadExtensions(ERDiagramEditor editor)
        throws CoreException {
    List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry
            .getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (IExtension extension : extensionPoint.getExtensions()) {
            for (IConfigurationElement configurationElement : extension
                    .getConfigurationElements()) {

                ExtendPopupMenu extendPopupMenu = ExtendPopupMenu
                        .createExtendPopupMenu(configurationElement, editor);

                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }

    return extendPopupMenuList;
}
项目:dsl-devkit    文件:ValidExtensionPointManager.java   
/**
 * Returns proxies for all registered extensions; does not cause the extension plug-ins to be loaded.
 * The proxies contain -- and can therefore be queried for -- all the XML attribute values that the
 * extensions provide in their <i>plugin.xml</i> file. Throws IllegalArgumentException
 * if extension point is unknown
 *
 * @return array of proxies
 */
public static ValidExtension[] getExtensions() {
  IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_NAME);
  if (point == null) {
    throw new IllegalArgumentException(MessageFormat.format(UNKNOWN_EXTENSION_POINT, PLUGIN_ID, EXTENSION_POINT_NAME));
  }
  IExtension[] extensions = point.getExtensions();
  List<ValidExtension> found = new ArrayList<ValidExtension>();
  for (IExtension e : extensions) {
    ValidExtension obj = ValidExtension.parseExtension(e);
    if (obj != null) {
      found.add(obj);
    }
  }
  return found.toArray(new ValidExtension[found.size()]);
}
项目:dsl-devkit    文件:ValidExtension.java   
/**
 * Parses the extension's XML data and returns a proxy that now contains the static (=XML) attribute
 * values of the extension.
 *
 * @param extension
 *          the extension to parse
 * @return <i>null</i> on failure to parse
 */
static ValidExtension parseExtension(final IExtension extension) {
  String sid = extension.getSimpleIdentifier();
  String name = extension.getLabel();
  String id = !Strings.isNullOrEmpty(sid.trim()) ? sid : (!Strings.isNullOrEmpty(name.trim()) ? name : "Unknown"); //$NON-NLS-1$
  ValidExtension validExtension = new ValidExtension(extension);
  try {
    validExtension.getTopLevelElements(); // force parsing of first level of element containment
    return validExtension;
    // CHECKSTYLE:OFF
  } catch (Exception e) {
    // CHECKSTYLE:ON
    final String message = MessageFormat.format(FAILED_TO_LOAD_EXTENSION, new Object[] {ValidExtension.class.getSimpleName(), id,
        extension.getNamespaceIdentifier()});
    AbstractValidElementBase.logException(e, message);
    return null;
  }
}
项目:cft    文件:CloudFoundryArchiverRegistry.java   
public ICloudFoundryArchiver createArchiver(CloudFoundryApplicationModule appModule, CloudFoundryServer cloudServer)
        throws CoreException {
    final String ARCHIVER_DELEGATE = "org.eclipse.cft.server.standalone.core.archiverDelegate"; //$NON-NLS-1$
    final String ARCHIVER_ELEMENT = "archiver"; //$NON-NLS-1$
    final String CLASS_ATTR = "class"; //$NON-NLS-1$

    // At present it just picks the first archiver extension

    IExtensionPoint archiverExtnPoint = Platform.getExtensionRegistry().getExtensionPoint(ARCHIVER_DELEGATE);
    if (archiverExtnPoint != null) {
        for (IExtension extension : archiverExtnPoint.getExtensions()) {
            for (IConfigurationElement config : extension.getConfigurationElements()) {
                if (ARCHIVER_ELEMENT.equals(config.getName())) {
                    ICloudFoundryArchiver archiver = (ICloudFoundryArchiver) config
                            .createExecutableExtension(CLASS_ATTR);
                    return archiver;
                }
            }
        }
    }

    throw CloudErrorUtil.toCoreException("Could not locate archivers"); //$NON-NLS-1$
}
项目:cft    文件:CloudFoundryBrandingUIExtensionPoint.java   
private static void readBrandingUIDefinitions() {
    IExtensionPoint brandingUIExtPoint = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
    if (brandingUIExtPoint != null) {

        // Ensure core branding is initialized first
        CloudFoundryBrandingExtensionPoint.readBrandingDefinitions();

        brandingUIServerTypeIds.clear();
        for (IExtension extension : brandingUIExtPoint.getExtensions()) {
            for (IConfigurationElement config : extension.getConfigurationElements()) {
                String serverId = config.getAttribute(ATTR_SERVER_TYPE_ID);
                String name = config.getAttribute(ATTR_NAME);
                if (serverId != null && serverId.trim().length() > 0 && name != null && name.trim().length() > 0) {
                    brandingUIDefinitions.put(serverId, config);
                    brandingUIServerTypeIds.add(serverId);
                }
            }
        }
        read = true;
    }
}
项目:cft    文件:CloudFoundryBrandingExtensionPoint.java   
protected static void readBrandingDefinitions() {
    IExtensionPoint brandingExtPoint = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
    if (brandingExtPoint != null) {
        brandingServerTypeIds.clear();
        for (IExtension extension : brandingExtPoint.getExtensions()) {
            for (IConfigurationElement config : extension.getConfigurationElements()) {
                String serverId = config.getAttribute(ATTR_SERVER_TYPE_ID);
                String name = config.getAttribute(ATTR_NAME);
                if (serverId != null && serverId.trim().length() > 0 && name != null && name.trim().length() > 0) {
                    // For the vendor neutral branding extension, the default / cloud urls / url provider class
                    // is not needed anymore.
                    brandingDefinitions.put(serverId, config);
                    brandingServerTypeIds.add(serverId);
                }
            }
        }
    }
    read = true;
}
项目:Source    文件:IdeMappingRegistryListener.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtension[])
 */
public void added(IExtension[] extensions) {
    for (IExtension extension : extensions) {
        if (LOCATION_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseLocationExtension(extension);
        } else if (FILE_CONNECTOR_DELEGATE_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseFileConnectorDelegateExtension(extension);
        } else if (BASE_PROVIDER_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseBaseProviderExtension(extension);
        } else if (CONNECTOR_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseConnectorProviderExtension(extension);
        } else if (MARKER_TO_LOCATION_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseMarkerToLocationExtension(extension);
        } else if (CONTAINER_PROVIDER_EXTENSION_POINT.equals(extension.getUniqueIdentifier())) {
            parseContainerProviderExtension(extension);
        }
    }
}
项目:Source    文件:IdeMappingRegistryListener.java   
/**
 * Parses a single {@link ILocation} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry
 */
@SuppressWarnings("unchecked")
private void parseLocationExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (BASE_TAG_EXTENSION.equals(elem.getName())) {
            final Bundle contributor = Platform.getBundle(elem.getContributor().getName());
            final String baseClassName = elem.getAttribute(BASE_ATTRIBUTE_CLASS);
            try {
                Class<? extends IBase> baseClass = (Class<? extends IBase>)contributor.loadClass(
                        baseClassName);
                for (IConfigurationElement locationElem : elem.getChildren(LOCATION_TAG_EXTENSION)) {
                    final String interfaceClassName = locationElem.getAttribute(
                            LOCATION_ATTRIBUTE_INTERFACE);
                    Class<ILocation> interfaceClass = (Class<ILocation>)contributor.loadClass(
                            interfaceClassName);
                    MappingUtils.registerLocationImplementation(baseClass, interfaceClass,
                            new ExtensionFactoryDescriptor<ILocation>(locationElem));
                }
            } catch (ClassNotFoundException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:Source    文件:IdeMappingRegistryListener.java   
/**
 * Parses a single {@link IFileConnectorDelegate} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry
 */
private void parseFileConnectorDelegateExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (FILE_CONNECTOR_DELEGATE_TAG_EXTENSION.equals(elem.getName())) {
            try {
                final IFileConnectorDelegate delegate = (IFileConnectorDelegate)elem
                        .createExecutableExtension(FILE_CONNECTOR_DELEGATE_ATTRIBUTE_CLASS);
                IdeMappingUtils.getFileConectorDelegateRegistry().register(delegate);
            } catch (CoreException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:Source    文件:IdeMappingRegistryListener.java   
/**
 * Parses a single {@link IConnector} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry
 */
private void parseConnectorProviderExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (CONNECTOR_TAG_EXTENSION.equals(elem.getName())) {
            try {
                final IConnector connector = (IConnector)elem.createExecutableExtension(
                        CONNECTOR_ATTRIBUTE_CLASS);
                MappingUtils.getConnectorRegistry().register(connector);
            } catch (CoreException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:Source    文件:IdeMappingRegistryListener.java   
/**
 * Parses a single {@link IMarkerToLocationDescriptor} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry
 */
private void parseMarkerToLocationExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (MARKER_TO_LOCATION_TAG_EXTENSION.equals(elem.getName())) {
            try {
                final String marterType = elem.getAttribute(MARKER_TO_LOCATION_ATTRIBUTE_MARKER_TYPE);
                final IMarkerToLocationDescriptor adapter = (IMarkerToLocationDescriptor)elem
                        .createExecutableExtension(MARKER_TO_LOCATION_ATTRIBUTE_CLASS);
                MarkerToLocationDescriptorAdapterFactory.register(adapter, marterType);
            } catch (CoreException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:Source    文件:IdeSemanticRegistryListener.java   
/**
 * Parses a single {@link ISemanticProvider} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry.
 */
private void parseSemanticProviderExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (SEMANTIC_PROVIDER_TAG_EXTENSION.equals(elem.getName())) {
            try {
                final ISemanticProvider provider = (ISemanticProvider)elem.createExecutableExtension(
                        SEMANTIC_PROVIDER_ATTRIBUTE_CLASS);
                SemanticUtils.getSemanticProviderRegistry().register(provider);
            } catch (CoreException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:Source    文件:IdeSemanticRegistryListener.java   
/**
 * Parses a single {@link ISemanticSimilarityProvider} extension contribution.
 * 
 * @param extension
 *            Parses the given extension and adds its contribution to the registry.
 */
private void parseSemanticSimilarityProviderExtension(IExtension extension) {
    final IConfigurationElement[] configElements = extension.getConfigurationElements();
    for (IConfigurationElement elem : configElements) {
        if (SEMANTIC_SIMILARITY_PROVIDER_TAG_EXTENSION.equals(elem.getName())) {
            try {
                final ISemanticSimilarityProvider provider = (ISemanticSimilarityProvider)elem
                        .createExecutableExtension(SEMANTIC_SIMILARITY_PROVIDER_ATTRIBUTE_CLASS);
                SemanticUtils.getSemanticSimilarityProviderRegistry().register(provider);
            } catch (CoreException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                        .getMessage(), e));
            }
        }
    }
}
项目:dockerfoundry    文件:DockerFoundryBrandingExtensionPoint.java   
private static void readBrandingDefinitions() {
    IExtensionPoint brandingExtPoint = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
    if (brandingExtPoint != null) {
        brandingServerTypeIds.clear();
        for (IExtension extension : brandingExtPoint.getExtensions()) {
            for (IConfigurationElement config : extension.getConfigurationElements()) {
                String serverId = config.getAttribute(ATTR_SERVER_TYPE_ID);
                String name = config.getAttribute(ATTR_NAME);
                if (serverId != null && serverId.trim().length() > 0 && name != null && name.trim().length() > 0) {
                    brandingDefinitions.put(serverId, config);
                    brandingServerTypeIds.add(serverId);
                    /*IConfigurationElement[] urls = config.getChildren(ELEM_DEFAULT_URL);
                    if (urls != null && urls.length > 0) {

                    }*/
                }
            }
        }
    }

    read = true;
}
项目:agui_eclipse_plugin    文件:BuildFatJar.java   
/**
 * @param jarfile
 */
private void testExtensionPoints(String jarfile) {

    try {
        System.out
                .println("dumping contents in jar using extension net.sf.fjep.fatjar.fatjarJarUtil");
        System.out.println("--- " + jarfile + " ---");
        IExtensionRegistry reg = Platform.getExtensionRegistry();
        IExtensionPoint exp = reg
                .getExtensionPoint("net.sf.fjep.fatjar.jarutil");
        IExtension[] extensions = exp.getExtensions();
        IConfigurationElement[] elements = extensions[0]
                .getConfigurationElements();
        IJarUtilFactory ju = (IJarUtilFactory) elements[0]
                .createExecutableExtension("class");
        IFileSystemSource fss = ju.createJARFileSystemSource(jarfile, "");
        while (fss.hasMoreElements()) {
            IFileSystemElement fse = fss.nextElement();
            System.out.println(fse.getFullName());
        }
        System.out.println("--- finished ---");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:mondo-integration    文件:OfflineCollaborationHandler.java   
private String getRAPPathFromExtensionRegistry() {

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

        String rapPath = null;

        if (reg != null) {
            poi = reg.getExtensionPoint("org.eclipse.rap.ui.entrypoint");
            if (poi != null) {
                IExtension[] exts = poi.getExtensions();

                for (IExtension ext : exts) {
                    IConfigurationElement[] els = ext.getConfigurationElements();
                    for (IConfigurationElement el : els) {
                        String pathAttribute = el.getAttribute("path");
                        if(pathAttribute != null){
                            rapPath = pathAttribute;
                            break;
                        }
                    }
                }
            }
        }
        return rapPath;
    }
项目:gwt-eclipse-plugin    文件:BundleUtilities.java   
/**
 * Returns <code>true</code> if this bundle implements the extension point
 * with the given <code>extensionPointId</code>.
 * 
 * @param bundle the bundle to test
 * @param extensionSimpleId the simple id of the extension point
 * @param extensionPointId extension id to search for
 * 
 * @return <code>true</code> if this bundle implements the extension point
 *         with the given <code>extensionPointId</code>
 */
public static boolean contributesToExtensionPoint(Bundle bundle,
    String extensionSimpleId, String extensionPointId) {
  IExtensionRegistry registry = RegistryFactory.getRegistry();
  IContributor contributor = ContributorFactoryOSGi.createContributor(bundle);
  for (IExtension extension : registry.getExtensions(contributor.getName())) {
    if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId)) {
      if (extensionSimpleId != null
          && !extensionSimpleId.equals(extension.getSimpleIdentifier())) {
        continue;
      }

      return true;
    }
  }

  return false;
}
项目:gwt-eclipse-plugin    文件:WebAppProjectCreator.java   
private void includeExtensionPartipants() throws CoreException {
  IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
  IExtensionPoint extensionPoint = extensionRegistry
      .getExtensionPoint("com.gwtplugins.gdt.eclipse.suite.webAppCreatorParticipant");
  if (extensionPoint == null) {
    return;
  }
  IExtension[] extensions = extensionPoint.getExtensions();
  for (IExtension extension : extensions) {
    IConfigurationElement[] configurationElements = extension.getConfigurationElements();
    for (IConfigurationElement configurationElement : configurationElements) {
      Object createExecutableExtension = configurationElement.createExecutableExtension("class");
      Participant participant = (Participant) createExecutableExtension;
      participant.updateWebAppProjectCreator(this);
    }
  }
}
项目:chromedevtools    文件:IPredefinedSourceWrapProvider.java   
/**
* Provides a standard mean of getting an instances of interface. It uses
* Eclipse/OSGI extension registry.
  */
 private static Collection<IPredefinedSourceWrapProvider> getProviders() {
   List<IPredefinedSourceWrapProvider> result = new ArrayList<IPredefinedSourceWrapProvider>();
   IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
       EXTENSION_POINT_ID);
   IExtension[] extensions = extensionPoint.getExtensions();

   for (IExtension extension : extensions) {
     for (IConfigurationElement element : extension.getConfigurationElements()) {
       if (!ELEMENT_NAME.equals(element.getName())) {
         continue;
       }
       Object obj;
       try {
         obj = element.createExecutableExtension(CLASS_PROPERTY);
       } catch (CoreException e) {
         throw new RuntimeException(e);
       }
       IPredefinedSourceWrapProvider provider = (IPredefinedSourceWrapProvider) obj;
       result.add(provider);
     }
   }
   return result;
 }
项目:chromedevtools    文件:JavaScriptFormatter.java   
/**
 * @return an instance of (any random) implementation of {@link JavaScriptFormatter} or null
 */
public static JavaScriptFormatter getInstance() {
  IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
      EXTENSION_POINT_ID);
  IExtension[] extensions = extensionPoint.getExtensions();

  for (IExtension extension : extensions) {
    for (IConfigurationElement element : extension.getConfigurationElements()) {
      if (!ELEMENT_NAME.equals(element.getName())) {
        continue;
      }
      Object obj;
      try {
        obj = element.createExecutableExtension(CLASS_PROPERTY);
      } catch (CoreException e) {
        throw new RuntimeException(e);
      }
      return (JavaScriptFormatter) obj;
    }
  }
  return null;
}
项目:chromedevtools    文件:BackendRegistry.java   
public List<? extends WipBackend> getBackends() {
  IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
      WipBackExtensionPoint.ID);
  IExtension[] extensions = extensionPoint.getExtensions();

  List<WipBackend> result = new ArrayList<WipBackend>(extensions.length);

  for (IExtension extension : extensions) {
    for (IConfigurationElement element : extension.getConfigurationElements()) {
      if (!WipBackExtensionPoint.ELEMENT_NAME.equals(element.getName())) {
        continue;
      }
      Object obj;
      try {
        obj = element.createExecutableExtension(WipBackExtensionPoint.CLASS_PROPERTY);
      } catch (CoreException e) {
        throw new RuntimeException(e);
      }
      WipBackend backend = (WipBackend) obj;
      result.add(backend);
    }
  }
  return result;
}
项目:APICloud-Studio    文件:ContributionExtensionManager.java   
private void loadExtensionPoints()
{
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtension[] extensions = registry.getExtensionPoint(getExtensionPoint()).getExtensions();

    for (int i = 0; i < extensions.length; i++)
    {
        IExtension extension = extensions[i];
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (IConfigurationElement main : elements)
        {
            if (isContentTypeContribution(main))
            {
                String natureId = main.getAttribute(CONTENT_TYPE);
                IConfigurationElement[] innerElements = main.getChildren();
                loadChildren(natureId, innerElements);
            }
        }
    }
}
项目:APICloud-Studio    文件:SVNFileModificationValidator.java   
private IFileModificationValidator loadUIValidator() {
      IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ID, DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION);
if (extension != null) {
    IExtension[] extensions =  extension.getExtensions();
    if (extensions.length > 0) {
        IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
        if (configElements.length > 0) {
            try {
                      Object o = configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
                      if (o instanceof IFileModificationValidator) {
                          return (IFileModificationValidator)o;
                      }
                  } catch (CoreException e) {
                      SVNProviderPlugin.log(e.getStatus().getSeverity(), e.getMessage(), e);
                  }
        }
    }
}
return null;
  }
项目:erflute    文件:ExtendPopupMenu.java   
public static List<ExtendPopupMenu> loadExtensions(MainDiagramEditor editor) throws CoreException {
    final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<>();

    final IExtensionRegistry registry = Platform.getExtensionRegistry();
    final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (final IExtension extension : extensionPoint.getExtensions()) {
            for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {
                final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);
                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }
    return extendPopupMenuList;
}
项目:mytourbook    文件:GeoclipseExtensions.java   
public static void registerOverlays(final Map map) {

        final IExtensionRegistry registry = RegistryFactory.getRegistry();
        final IExtensionPoint point = registry.getExtensionPoint("net.tourbook.mapOverlay"); //$NON-NLS-1$
        final IExtension[] extensions = point.getExtensions();

        for (final IExtension extension : extensions) {
            final IConfigurationElement[] elements = extension.getConfigurationElements();

            final IConfigurationElement element = elements[elements.length - 1];

            Object o = null;
            try {
                o = element.createExecutableExtension("class"); //$NON-NLS-1$
            } catch (final CoreException e) {
                e.printStackTrace();
            }

            if (o != null && o instanceof MapPainter) {
                map.addOverlayPainter((MapPainter) o);
            }
        }
    }
项目:mytourbook    文件:GeoclipseExtensions.java   
public static void registerOverlays(final Map map) {

        final IExtensionRegistry registry = RegistryFactory.getRegistry();
        final IExtensionPoint point = registry.getExtensionPoint("de.byteholder.geoclipse.mapOverlay"); //$NON-NLS-1$
        final IExtension[] extensions = point.getExtensions();

        for (final IExtension extension : extensions) {
            final IConfigurationElement[] elements = extension.getConfigurationElements();

            final IConfigurationElement element = elements[elements.length - 1];

            Object o = null;
            try {
                o = element.createExecutableExtension("class"); //$NON-NLS-1$
            } catch (final CoreException e) {
                e.printStackTrace();
            }

            if (o != null && o instanceof MapPainter) {
                map.addOverlayPainter((MapPainter) o);
            }
        }
    }
项目:ModelDebugging    文件:Activator.java   
/**
 * Retrieve all the locators registered with the extension point, and additionally store them in a cache.
 * 
 * @return All locators registered with the extension point.
 */
public List<ILocator> retrieveLocators() {
    if (locators == null) {
        IExtensionRegistry reg = Platform.getExtensionRegistry();
        IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.gemoc.dsl.debug.locator");
        IExtension[] extensions = ep.getExtensions();
        ArrayList<ILocator> contributors = new ArrayList<ILocator>();
        for (int i = 0; i < extensions.length; i++) {
            IExtension ext = extensions[i];
            IConfigurationElement[] ce = ext.getConfigurationElements();
            for (int j = 0; j < ce.length; j++) {
                ILocator locator;
                try {
                    locator = (ILocator)ce[j].createExecutableExtension("class");
                    contributors.add(locator);
                } catch (CoreException e) {
                    e.printStackTrace();
                }
            }
        }
        locators = contributors;
    }
    return locators;
}
项目:cmake-eclipse-helper    文件:CMakeLauncher.java   
private String retrieveEclipseVersionString() {
    String product = System.getProperty("eclipse.product");
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint("org.eclipse.core.runtime.products");
    if (point != null) {
        IExtension[] extensions = point.getExtensions();
        for (IExtension ext : extensions) {
            if (product.equals(ext.getUniqueIdentifier())) {
                IContributor contributor = ext.getContributor();
                if (contributor != null) {
                    Bundle bundle = Platform.getBundle(contributor.getName());
                    if (bundle != null) {
                        Version version = bundle.getVersion();
                        return version.getMajor() + "." + version.getMinor();
                    }
                }
            }
        }
    }
    return null;
}
项目:OpenSPIFe    文件:PlanStateRegistry.java   
private static List<PlanState> buildPlanStateRegistry() {
    List<PlanState> l = new ArrayList<PlanState>();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
       IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT_ID);
       for (IExtension extension : point.getExtensions()) {
        for (IConfigurationElement planState : extension.getConfigurationElements()) {
            String name = planState.getAttribute("name");
            int sort = Integer.valueOf(planState.getAttribute("sortkey"));
            PlanState type = new PlanState(name, sort);
            l.add(type);
           }
       }
       Collections.sort(l, new Comparator<PlanState>() {
        @Override
        public int compare(PlanState o1, PlanState o2) {
            return o1.sortKey - o2.sortKey;
        }
    });
    return Collections.unmodifiableList(l);
}