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

项目:n4js    文件:TesterRegistry.java   
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
    if (isInitialized)
        throw new IllegalStateException("may invoke method initialize() only once");
    isInitialized = true;

    final IExtensionRegistry registry = RegistryFactory.getRegistry();
    if (registry != null) {
        final IConfigurationElement[] configElems = registry
                .getConfigurationElementsFor(TESTERS_EXTENSION_POINT_ID);

        for (IConfigurationElement elem : configElems) {
            try {
                final EclipseTesterDescriptor descriptor = new EclipseTesterDescriptor(elem);
                injector.injectMembers(descriptor);
                register(descriptor);
            } catch (Exception ex) {
                log.error("Error while reading extensions for extension point " + TESTERS_EXTENSION_POINT_ID, ex);
            }
        }
    }
}
项目:n4js    文件:RunnerRegistry.java   
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
    if (isInitialized)
        throw new IllegalStateException("may invoke method initialize() only once");
    isInitialized = true;

    final IExtensionRegistry registry = RegistryFactory.getRegistry();
    if (registry != null) {
        final IConfigurationElement[] configElems = registry
                .getConfigurationElementsFor(RUNNERS_EXTENSION_POINT_ID);

        for (IConfigurationElement elem : configElems) {
            try {
                final EclipseRunnerDescriptor descriptor = new EclipseRunnerDescriptor(elem);
                injector.injectMembers(descriptor);
                register(descriptor);
            } catch (Exception ex) {
                log.error("Error while reading extensions for extension point " + RUNNERS_EXTENSION_POINT_ID, ex);
            }
        }
    }
}
项目:n4js    文件:WorkingSetManagerBrokerImpl.java   
private Supplier<Map<String, WorkingSetManager>> initContributions() {

        return memoize(() -> {

            if (!isRunning()) {
                return emptyMap();
            }

            final Builder<String, WorkingSetManager> builder = ImmutableMap.builder();
            final IConfigurationElement[] elements = getExtensionRegistry()
                    .getConfigurationElementsFor(EXTENSION_POINT_ID);
            for (final IConfigurationElement element : elements) {
                try {
                    final WorkingSetManager manager = (WorkingSetManager) element
                            .createExecutableExtension(CLASS_ATTRIBUTE);
                    injector.injectMembers(manager);
                    builder.put(manager.getId(), manager);
                } catch (final CoreException e) {
                    LOGGER.error("Error while trying to instantiate working set manager.", e);
                }
            }

            return builder.build();
        });
    }
项目:n4js    文件:DelegatingQuickfixProvider.java   
private static Builder<DefaultQuickfixProvider> collectRegisteredProviders() {
    final Builder<DefaultQuickfixProvider> builder = ImmutableList.<DefaultQuickfixProvider> builder();
    if (Platform.isRunning()) {
        final IConfigurationElement[] elements = getQuickfixSupplierElements();
        for (final IConfigurationElement element : elements) {
            try {
                final Object extension = element.createExecutableExtension(CLAZZ_PROPERTY_NAME);
                if (extension instanceof QuickfixProviderSupplier) {
                    builder.add(((QuickfixProviderSupplier) extension).get());
                }
            } catch (final CoreException e) {
                LOGGER.error("Error while instantiating quickfix provider supplier instance.", e);
            }
        }
    }
    return builder;
}
项目:AgentWorkbench    文件:EvaluateContributionsHandler.java   
/**
 * Execute.
 * @param registry the registry
 */
@Execute
   public void execute() {

    System.out.println("Start evaluating available extensions");
    IConfigurationElement[] config = this.getExtensionRegistry().getConfigurationElementsFor(PLUGIN_ID);

       try {

           for (IConfigurationElement e : config) {
               System.out.println("Evaluating extension " + e.getName());
               final Object object = e.createExecutableExtension("class");
               if (object instanceof PlugIn) {
                   executeExtension(object);
               }
           }
       } catch (CoreException ex) {
           System.err.println(ex.getMessage());
       }
   }
项目: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-modeldebugging    文件:MelangeHelper.java   
/**
 * Return a bundle with a .melange declaring 'language'
 */
public static Bundle getMelangeBundle(String languageName){

    IConfigurationElement[] melangeLanguages = Platform
            .getExtensionRegistry().getConfigurationElementsFor(
                    "fr.inria.diverse.melange.language");
    String melangeBundleName = "";

    for (IConfigurationElement lang : melangeLanguages) {
        if(lang.getAttribute("id").equals(languageName)){
            melangeBundleName = lang.getContributor().getName();
            return Platform.getBundle(melangeBundleName);
        }
    }

    return null;
}
项目:gemoc-studio-modeldebugging    文件:MelangeHelper.java   
/**
 * Return all ModelTypes matching 'language'
 */
public static List<String> getModelTypes(String language){
    List<String> modelTypeNames = new ArrayList<String>();
    IConfigurationElement[] melangeLanguages = Platform
            .getExtensionRegistry().getConfigurationElementsFor(
                    "fr.inria.diverse.melange.language");
    for (IConfigurationElement lang : melangeLanguages) {
        if (lang.getAttribute("id").equals(language)) {
            IConfigurationElement[] adapters = lang
                    .getChildren("adapter");
            for (IConfigurationElement adapter : adapters) {
                modelTypeNames.add(adapter
                        .getAttribute("modeltypeId"));
            }
        }
    }
    return modelTypeNames;
}
项目:gemoc-studio-modeldebugging    文件:ExtensionPoint.java   
protected Collection<T> internal_getSpecifications()
{
    IConfigurationElement[] confElements = getExtensions(getExtensionPointName());
    ArrayList<T> specs = new ArrayList<T>();
    for (int i = 0; i < confElements.length; i++) 
    {                       
        try 
        {
            T s = createInstance();
            s.setSpecification(confElements[i]);
            specs.add(s);
        } 
        catch (InstantiationException | IllegalAccessException e) 
        {
            // silent catch
            e.printStackTrace();
            //throw new ExtensionPointException(e.getMessage(), e);
        } 
    }   
    return specs;
}
项目:neoscada    文件:ValidationRunner.java   
private boolean isTargetMatch ( final Class<? extends EObject> clazz, final IConfigurationElement ele )
{
    if ( isTargetClass ( ele.getAttribute ( "filterClass" ), ele.getContributor (), clazz ) )
    {
        return true;
    }

    for ( final IConfigurationElement child : ele.getChildren ( "filterClass" ) )
    {
        if ( isTargetClass ( child.getAttribute ( "class" ), ele.getContributor (), clazz ) )
        {
            return true;
        }
    }

    return false;
}
项目:neoscada    文件:ConnectionCreatorHelper.java   
public static ConnectionService createConnection ( final ConnectionInformation info, final Integer autoReconnectDelay, final boolean lazyActivation )
{
    if ( info == null )
    {
        return null;
    }

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( Activator.EXTP_CONNECTON_CREATOR ) )
    {
        final String interfaceName = ele.getAttribute ( "interface" );
        final String driverName = ele.getAttribute ( "driver" );
        if ( interfaceName == null || driverName == null )
        {
            continue;
        }
        if ( interfaceName.equals ( info.getInterface () ) && driverName.equals ( info.getDriver () ) )
        {
            final ConnectionService service = createConnection ( info, ele, autoReconnectDelay, lazyActivation );
            if ( service != null )
            {
                return service;
            }
        }
    }
    return null;
}
项目: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...");
  }
}
项目:neoscada    文件:Helper.java   
public static KeyProviderFactory findFactory ( final String id )
{
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
    {
        if ( !ELE_FACTORY.equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            return (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        }
    }

    return null;
}
项目:neoscada    文件:Helper.java   
public static Collection<KeyProviderFactory> createFactories ()
{
    final Collection<KeyProviderFactory> result = new LinkedList<KeyProviderFactory> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
    {
        if ( !ELE_FACTORY.equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            result.add ( (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS ) );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        }
    }

    return result;
}
项目:neoscada    文件:Activator.java   
public static List<ExtensionDescriptor> getExtensionDescriptors ()
{
    final List<ExtensionDescriptor> result = new LinkedList<ExtensionDescriptor> ();

    for ( final IConfigurationElement element : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEWER ) )
    {
        if ( !"viewerExtension".equals ( element.getName () ) )
        {
            continue;
        }

        result.add ( new ExtensionDescriptor ( element ) );
    }

    return result;
}
项目:neoscada    文件:Activator.java   
protected static List<ViewInstanceDescriptor> loadDescriptors ()
{
    final List<ViewInstanceDescriptor> result = new LinkedList<ViewInstanceDescriptor> ();
    for ( final IConfigurationElement element : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEW ) )
    {
        if ( !ELE_VIEW_INSTANCE.equals ( element.getName () ) )
        {
            continue;
        }

        final ViewInstanceDescriptor descriptor = convert ( element );
        if ( descriptor != null )
        {
            result.add ( descriptor );
        }
    }
    return result;
}
项目:neoscada    文件:PreferenceSelectorStyleGenerator.java   
private StyleGenerator create ( final IConfigurationElement ele )
{
    if ( ele == null )
    {
        return null;
    }

    try
    {
        final Object o = ele.createExecutableExtension ( Messages.PreferenceSelectorStyleGenerator_2 );
        if ( o instanceof StyleGenerator )
        {
            return (StyleGenerator)o;
        }
        logger.warn ( "Class referenced in 'generatorClass' did not implement {}", StyleGenerator.class ); //$NON-NLS-1$
        return null;
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        return null;
    }
}
项目:neoscada    文件:StyleGeneratorInformation.java   
public static List<StyleGeneratorInformation> list ()
{
    final List<StyleGeneratorInformation> result = new LinkedList<StyleGeneratorInformation> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_STYLE_GENERATOR ) )
    {
        if ( !ELE_STYLE_GENERATOR.equals ( ele.getName () ) )
        {
            continue;
        }

        final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
        final String name = ele.getAttribute ( "name" ); //$NON-NLS-1$
        final String description = getText ( ele.getChildren ( "description" ) ); //$NON-NLS-1$

        result.add ( new StyleGeneratorInformation ( id, name, description ) );
    }

    return result;
}
项目:neoscada    文件:EventHistorySearchDialog.java   
protected List<FilterTab> getFilterTabs ()
{
    final List<FilterTab> result = new LinkedList<FilterTab> ();

    result.add ( new QueryByExampleTab () );
    result.add ( new FreeFormTab () );

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_FILTER_TAB ) )
    {
        if ( !"filterTab".equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            result.add ( (FilterTab)ele.createExecutableExtension ( "class" ) );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e.getStatus () );
        }
    }

    return result;
}
项目:neoscada    文件:ConfigurationHelper.java   
public static List<MonitorViewConfiguration> loadAllMonitorConfigurations ()
{
    final List<MonitorViewConfiguration> result = new ArrayList<MonitorViewConfiguration> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
    {
        if ( !"monitorView".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        final MonitorViewConfiguration cfg = convertMonitor ( ele );
        if ( cfg != null )
        {
            result.add ( cfg );
        }
    }

    return result;
}
项目:neoscada    文件:ConfigurationHelper.java   
private static MonitorViewConfiguration convertMonitor ( final IConfigurationElement ele )
{
    try
    {
        final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
        final String monitorQueryId = ele.getAttribute ( "monitorQueryId" ); //$NON-NLS-1$
        final String connectionString = ele.getAttribute ( "connectionString" ); //$NON-NLS-1$
        final ConnectionType connectionType = ConnectionType.valueOf ( ele.getAttribute ( "connectionType" ) ); //$NON-NLS-1$
        final String label = ele.getAttribute ( "label" ); //$NON-NLS-1$
        final List<ColumnProperties> columns = parseColumnSettings ( ele.getAttribute ( "columns" ) ); //$NON-NLS-1$

        return new MonitorViewConfiguration ( id, monitorQueryId, connectionString, connectionType, label, columns );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to convert monitor configuration: {}", ele ); //$NON-NLS-1$
        return null;
    }
}
项目:neoscada    文件:ConfigurationHelper.java   
public static List<EventPoolViewConfiguration> loadAllEventPoolConfigurations ()
{
    final List<EventPoolViewConfiguration> result = new ArrayList<EventPoolViewConfiguration> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
    {
        if ( !"eventPoolView".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        final EventPoolViewConfiguration cfg = convertEventPool ( ele );
        if ( cfg != null )
        {
            result.add ( cfg );
        }
    }

    return result;
}
项目:neoscada    文件:ConfigurationHelper.java   
public static List<EventHistoryViewConfiguration> loadAllEventHistoryConfigurations ()
{
    final List<EventHistoryViewConfiguration> result = new ArrayList<EventHistoryViewConfiguration> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
    {
        if ( !"eventHistoryView".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        final EventHistoryViewConfiguration cfg = convertEventHistory ( ele );
        if ( cfg != null )
        {
            result.add ( cfg );
        }
    }

    return result;
}
项目:neoscada    文件:ConfigurationHelper.java   
private static EventHistoryViewConfiguration convertEventHistory ( final IConfigurationElement ele )
{
    try
    {
        final String id = ele.getAttribute ( "id" ); //$NON-NLS-1$
        final String connectionString = ele.getAttribute ( "connectionString" ); //$NON-NLS-1$
        final ConnectionType connectionType = ConnectionType.valueOf ( ele.getAttribute ( "connectionType" ) ); //$NON-NLS-1$
        final String label = ele.getAttribute ( "label" ); //$NON-NLS-1$

        final List<ColumnLabelProviderInformation> columnInformation = new LinkedList<ColumnLabelProviderInformation> ();
        fillColumnInformation ( columnInformation, ele );

        return new EventHistoryViewConfiguration ( id, connectionString, connectionType, label, columnInformation );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to convert event history configuration: {}", ele ); //$NON-NLS-1$
        return null;
    }
}
项目:neoscada    文件:ConfigurationHelper.java   
public static AlarmNotifierConfiguration findAlarmNotifierConfiguration ()
{
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
    {
        if ( !"alarmNotifier".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        final AlarmNotifierConfiguration cfg = convertAlarmNotifier ( ele );
        if ( cfg != null )
        {
            return cfg;
        }
    }
    return null;
}
项目:neoscada    文件:ConfigurationHelper.java   
private static AlarmNotifierConfiguration convertAlarmNotifier ( final IConfigurationElement ele )
{
    try
    {
        final String connectionId = ele.getAttribute ( "connectionId" ); //$NON-NLS-1$
        final String prefix = ele.getAttribute ( "prefix" ) == null ? "ae.server.info" : ele.getAttribute ( "prefix" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ $NON-NLS-2$
        final URL soundFile = Platform.getBundle ( ele.getContributor ().getName () ).getEntry ( ele.getAttribute ( "soundFile" ) ); //$NON-NLS-1$
        final ParameterizedCommand ackAlarmsAvailableCommand = convertCommand ( ele.getChildren ( "ackAlarmsAvailableCommand" )[0] ); //$NON-NLS-1$
        final ParameterizedCommand alarmsAvailableCommand = convertCommand ( ele.getChildren ( "alarmsAvailableCommand" )[0] ); //$NON-NLS-1$
        return new AlarmNotifierConfiguration ( connectionId, prefix, soundFile, ackAlarmsAvailableCommand, alarmsAvailableCommand );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to convert alarm notifier configuration: {}", ele ); //$NON-NLS-1$
        return null;
    }
}
项目:neoscada    文件:AbstractItemExtension.java   
@Override
public void setInitializationData ( final IConfigurationElement config, final String propertyName, final Object data ) throws CoreException
{

    if ( data instanceof String )
    {
        final String str = (String)data;
        if ( str.contains ( "#" ) )
        {
            final String[] tok = str.split ( "\\#", 2 );
            this.connectionId = tok[0];
            this.itemId = tok[1];
        }
    }
    if ( data instanceof Hashtable<?, ?> )
    {
        final Hashtable<?, ?> props = (Hashtable<?, ?>)data;

        this.connectionId = "" + props.get ( "connectionId" );
        this.itemId = "" + props.get ( "itemId" );
    }

}
项目:neoscada    文件:ImageExtension.java   
@Override
public void setInitializationData ( final IConfigurationElement config, final String propertyName, final Object data ) throws CoreException
{
    try
    {
        if ( data instanceof String )
        {
            this.imageUrl = new URL ( (String)data );
        }
        if ( data instanceof Hashtable<?, ?> )
        {
            this.imageUrl = new URL ( (String) ( (Hashtable<?, ?>)data ).get ( "url" ) );
        }
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to parse URL", e );
    }
}
项目:neoscada    文件:ConfigurationFormInformation.java   
public Set<String> getFactoryIds ()
{
    final Set<String> result = new HashSet<String> ();

    // by attribute
    final String factoryId = this.configuration.getAttribute ( "factoryId" );
    if ( factoryId != null && !factoryId.isEmpty () )
    {
        result.add ( factoryId );
    }

    // by child element
    for ( final IConfigurationElement ele : this.configuration.getChildren ( "factory" ) )
    {
        if ( ele.getValue () != null && !ele.getValue ().isEmpty () )
        {
            result.add ( ele.getValue () );
        }
    }

    return result;
}
项目:neoscada    文件:Activator.java   
public static List<ConfigurationFormInformation> findMatching ( final String factoryId )
{
    final List<ConfigurationFormInformation> result = new LinkedList<ConfigurationFormInformation> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_FORM ) )
    {
        if ( !"form".equals ( ele.getName () ) )
        {
            continue;
        }
        final ConfigurationFormInformation info = new ConfigurationFormInformation ( ele );
        if ( info.getFactoryIds () == null )
        {
            continue;
        }

        if ( info.getFactoryIds ().contains ( "*" ) || info.getFactoryIds ().contains ( factoryId ) )
        {
            result.add ( info );
        }
    }

    return result;
}
项目:neoscada    文件:Activator.java   
private void fillFactories ( final Collection<LoginFactory> factories, final IConfigurationElement ele )
{
    for ( final IConfigurationElement child : ele.getChildren ( "factory" ) ) //$NON-NLS-1$
    {
        try
        {
            final LoginFactory factory = (LoginFactory)child.createExecutableExtension ( "class" );//$NON-NLS-1$
            if ( factory != null )
            {
                factories.add ( factory );
            }
        }
        catch ( final Exception e )
        {
            getLog ().log ( new Status ( IStatus.WARNING, PLUGIN_ID, Messages.Activator_ErrorParse, e ) );
        }
    }
}
项目:neoscada    文件:DetailViewManager.java   
public static DetailView openView ( final String id, final Map<String, String> properties ) throws CoreException
{
    logger.info ( "Searching view: {}", id ); //$NON-NLS-1$

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_DETAIL_VIEW ) )
    {
        final String cfgId = ele.getAttribute ( "id" ); //$NON-NLS-1$

        logger.debug ( "Checking: {}", cfgId ); //$NON-NLS-1$

        if ( cfgId != null && cfgId.equals ( id ) )
        {
            return createDetailView ( id, ele, properties );
        }
    }
    return null;
}
项目:neoscada    文件:WorldRunner.java   
private boolean isMatch ( final BundleContext ctx, final IConfigurationElement ele, final Object element )
{
    if ( isMatch ( Factories.loadClass ( ctx, ele, ATTR_FOR_CLASS ), element ) )
    {
        return true;
    }

    for ( final IConfigurationElement child : ele.getChildren ( ELE_FOR_CLASS ) )
    {
        if ( isMatch ( Factories.loadClass ( ctx, child, ATTR_CLASS ), element ) )
        {
            return true;
        }
    }
    return false;
}
项目:neoscada    文件:Activator.java   
public static Collection<OscarProcessor> createProcessors ()
{
    final Collection<OscarProcessor> result = new LinkedList<> ();
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_GENERATOR ) )
    {
        if ( !ele.getName ().equals ( ELE_OSCAR_PROCESSOR ) )
        {
            continue;
        }
        try
        {
            result.add ( (OscarProcessor)ele.createExecutableExtension ( "class" ) );
        }
        catch ( final CoreException e )
        {
            logger.warn ( "Failed to create oscar processor", e );
            getDefault ().getLog ().log ( e.getStatus () );
            throw new IllegalStateException ( "Failed to create OSCAR processor", e );
        }
    }
    return result;
}
项目:neoscada    文件:ForwardingDanglingReferenceResolver.java   
private void buildCache ()
{
    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXPT_DANGLING_RESOLVER ) )
    {
        if ( !ele.getName ().equals ( ELE_RESOLVER ) )
        {
            continue;
        }
        try
        {
            final DanglingReferenceResolver resolver = (DanglingReferenceResolver)ele.createExecutableExtension ( ATTR_CLASS );
            logger.debug ( "Adding resolver: {}", resolver ); //$NON-NLS-1$
            this.cache.add ( resolver );
        }
        catch ( final Exception e )
        {
            Activator.getDefault ().getLog ().log ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, "Failed to create resolver instance", e ) );
        }
    }
}
项目:scanning    文件:PointGeneratorService.java   
private static void readExtensions(Map<Class<? extends IScanPathModel>, Class<? extends IPointGenerator<?>>> gens,
                                   Map<String,   GeneratorInfo> tids) throws CoreException {

    if (Platform.getExtensionRegistry()!=null) {
        final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.generator");
        for (IConfigurationElement e : eles) {
            final IPointGenerator<?>    generator = (IPointGenerator<?>)e.createExecutableExtension("class");
            final IScanPathModel     model = (IScanPathModel)e.createExecutableExtension("model");

            final Class<? extends IScanPathModel> modelClass = model.getClass();
            @SuppressWarnings("unchecked")
            final Class<? extends IPointGenerator<?>> generatorClass = (Class<? extends IPointGenerator<?>>) generator.getClass();
            gens.put(modelClass, generatorClass);

            final GeneratorInfo info = new GeneratorInfo();
            info.setModelClass(model.getClass());
            info.setGeneratorClass(generator.getClass());
            info.setLabel(e.getAttribute("label"));
            info.setDescription(e.getAttribute("description"));

            String id = e.getAttribute("id");
            tids.put(id, info);
        }
    }
}
项目:scanning    文件:StatusQueueView.java   
private List<IResultHandler> getResultsHandlers() {
    if (resultsHandlers == null) {
        final IConfigurationElement[] configElements = Platform.getExtensionRegistry()
                .getConfigurationElementsFor(RESULTS_HANDLER_EXTENSION_POINT_ID);
        final List<IResultHandler> handlers = new ArrayList<>(configElements.length + 1);
        for (IConfigurationElement configElement : configElements) {
            try {
                final IResultHandler handler = (IResultHandler) configElement.createExecutableExtension("class");
                handler.init(service, createConsumerConfiguration());
                handlers.add(handler);
            } catch (Exception e) {
                ErrorDialog.openError(getSite().getShell(), "Internal Error",
                        "Could not create results handler for class " + configElement.getAttribute("class") +
                        ".\n\nPlease contact your support representative.",
                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
            }
        }
        handlers.add(new DefaultResultsHandler());
        resultsHandlers = handlers;
    }
    return resultsHandlers;
}
项目:codelens-eclipse    文件:CodeLensControllerRegistry.java   
/**
 * Load the SourceMap language supports.
 */
private synchronized void loadFactories() {
    if (loaded) {
        return;
    }

    try {
        IExtensionRegistry registry = Platform.getExtensionRegistry();
        if (registry == null) {
            return;
        }
        IConfigurationElement[] cf = registry.getConfigurationElementsFor(CodeLensEditorPlugin.PLUGIN_ID,
                EXTENSION_CODELENS_CONTROLLER_FACTORIES);
        loadCodeLensProvidersFromExtension(cf);
    } finally {
        loaded = true;
    }
}
项目:gemoc-studio    文件:MessagingSystemManager.java   
/**
 * 
 * @return a new MessagingSystem that is supposed to be the best implementation for the current platform
 * @param baseMessageGroup id for the messaging system, if two instances of MessagingSystem use the same id, the platform may decide to group the messages in a single console
 * @param userFriendlyName, name for the console, if several instances use the same  baseMessageGroup, it will use one of the userFriendlyName (the first that is created) 
 */
public MessagingSystem createBestPlatformMessagingSystem(String baseMessageGroup, String userFriendlyName ){
    MessagingSystem result = null;
    IConfigurationElement[] confElements = Platform.getExtensionRegistry()
            .getConfigurationElementsFor(MESSAGINGSYSTEM_EXTENSION_POINT_NAME);
    for (int i = 0; i < confElements.length; i++) {
        // get first working contribution
        // TODO find some criterion or properties allowing to have better selection in case of multiple definitions
        //String name = confElements[i].getAttribute(MESSAGINGSYSTEM_EXTENSION_POINT_CONTRIB_NAME_ATT);
        try {
            result = (MessagingSystem) confElements[i].createExecutableExtension(MESSAGINGSYSTEM_EXTENSION_POINT_CONTRIB_MESSAGINGSYSTEM_ATT);
            result.initialize(baseMessageGroup, userFriendlyName);
            if(result != null)  break;
        } catch (Throwable e) {;
        }
    }
    if (result == null){
        // still not created, either due to exception or to missing extension contributor
        // fallback to default constructor
        result = new StdioSimpleMessagingSystem();
    }

    return result;
}
项目:gemoc-studio    文件:AbstractNewProjectWizardWithTemplates.java   
protected WizardElement createWizardElement(IConfigurationElement config) {
    String name = config.getAttribute(WizardElement.ATT_NAME);
    String id = config.getAttribute(WizardElement.ATT_ID);
    String className = config.getAttribute(WizardElement.ATT_CLASS);
    if (name == null || id == null || className == null)
        return null;
    WizardElement element = new WizardElement(config);
    element.id = id;
    String imageName = config.getAttribute(WizardElement.ATT_ICON);
    if (imageName != null) {
        String pluginID = config.getNamespaceIdentifier();
        Image image = PDEPlugin.getDefault().getLabelProvider().getImageFromPlugin(pluginID, imageName);
        element.setImage(image);
    }
    return element;
}