当前位置: 首页>>代码示例>>Java>>正文


Java IConfigurationElement.getChildren方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.IConfigurationElement.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java IConfigurationElement.getChildren方法的具体用法?Java IConfigurationElement.getChildren怎么用?Java IConfigurationElement.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.IConfigurationElement的用法示例。


在下文中一共展示了IConfigurationElement.getChildren方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getModelTypes

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:MelangeHelper.java

示例2: isTargetMatch

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ValidationRunner.java

示例3: fillFactories

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
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 ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:Activator.java

示例4: isMatch

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:WorldRunner.java

示例5: convertCommand

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static ParameterizedCommand convertCommand ( final IConfigurationElement commandElement ) throws NotDefinedException, InvalidRegistryObjectException
{
    final ICommandService commandService = (ICommandService)PlatformUI.getWorkbench ().getService ( ICommandService.class );
    final Command command = commandService.getCommand ( commandElement.getAttribute ( "id" ) ); //$NON-NLS-1$
    final List<Parameterization> parameters = new ArrayList<Parameterization> ();
    for ( final IConfigurationElement parameter : commandElement.getChildren ( "parameter" ) ) //$NON-NLS-1$
    {
        final IParameter name = command.getParameter ( parameter.getAttribute ( "name" ) ); //$NON-NLS-1$
        final String value = parameter.getAttribute ( "value" ); //$NON-NLS-1$
        parameters.add ( new Parameterization ( name, value ) );
    }
    return new ParameterizedCommand ( command, parameters.toArray ( new Parameterization[] {} ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:14,代码来源:ConfigurationHelper.java

示例6: getContextList

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public LoginContext[] getContextList ()
{
    final List<LoginContext> result = new LinkedList<LoginContext> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.core.ui.connection.login.context" ) ) //$NON-NLS-1$
    {
        if ( !"context".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

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

        // get properties
        final Map<String, String> properties = new HashMap<String, String> ();
        for ( final IConfigurationElement child : ele.getChildren ( "property" ) )//$NON-NLS-1$
        {
            final String key = child.getAttribute ( "key" );//$NON-NLS-1$
            final String value = child.getAttribute ( "value" );//$NON-NLS-1$
            if ( key != null && value != null )
            {
                properties.put ( key, value );
            }
        }

        final Collection<LoginFactory> factories = new LinkedList<LoginFactory> ();
        fillFactories ( factories, ele );

        if ( id != null && name != null && !factories.isEmpty () )
        {
            result.add ( new LoginContext ( id, name, factories, properties ) );
        }

    }

    return result.toArray ( new LoginContext[result.size ()] );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:39,代码来源:Activator.java

示例7: createFactory

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public static ViewElementFactory createFactory ( final EObject modelObject ) throws CoreException
{
    if ( modelObject == null )
    {
        return null;
    }

    final String requestedClass = modelObject.eClass ().getInstanceClassName ();

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

        for ( final IConfigurationElement child : ele.getChildren ( "supports" ) )
        {
            final String modelClass = child.getAttribute ( "modelClass" );
            if ( modelClass == null || modelClass.isEmpty () )
            {
                continue;
            }

            if ( modelClass.equals ( requestedClass ) )
            {
                return (ViewElementFactory)ele.createExecutableExtension ( "class" );
            }
        }

    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:34,代码来源:Activator.java

示例8: runElement

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
protected boolean runElement ( final EObject element, final DiagnosticChain diagnostics, final Map<Object, Object> context )
{
    if ( element == null )
    {
        return true;
    }

    if ( isCached ( element, context ) )
    {
        return true;
    }

    final String packageUri = element.eClass ().getEPackage ().getNsURI ();
    if ( packageUri == null )
    {
        return false;
    }

    boolean result = true;

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.utils.ecore.validation.handler" ) )
    {
        if ( !ele.getName ().equals ( "validationContext" ) )
        {
            continue;
        }

        final String uri = ele.getAttribute ( "packageUri" );
        if ( !packageUri.equals ( uri ) )
        {
            continue;
        }

        final String contextId = ele.getAttribute ( "contextId" );

        for ( final IConfigurationElement child : ele.getChildren ( "validator" ) )
        {
            if ( !child.getName ().equals ( "validator" ) )
            {
                continue;
            }

            if ( !isTargetMatch ( element.getClass (), child ) )
            {
                continue;
            }

            try
            {
                final Object o = child.createExecutableExtension ( "class" );
                if ( o instanceof Validator )
                {
                    final Validator v = (Validator)o;
                    final ValidationContextImpl validationContext = new ValidationContextImpl ( contextId, element );
                    v.validate ( validationContext );
                    if ( !validationContext.apply ( diagnostics ) )
                    {
                        result = false;
                    }
                }
            }
            catch ( final CoreException e )
            {
                ValidationPlugin.getDefault ().getLog ().log ( e.getStatus () );
                throw new IllegalStateException ( e );
            }
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:72,代码来源:ValidationRunner.java

示例9: fillColumnInformation

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
private static void fillColumnInformation ( final List<ColumnLabelProviderInformation> columnInformation, final IConfigurationElement ele )
{
    // load definition

    final String definitionId = ele.getAttribute ( "columnInformationDefinition" );
    if ( definitionId != null && !definitionId.isEmpty () )
    {
        for ( final IConfigurationElement defEle : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_CFG_ID ) )
        {
            if ( !"columnInformationDefinition".equals ( defEle.getName () ) ) //$NON-NLS-1$
            {
                continue;
            }
            fillColumnInformation ( columnInformation, defEle );
        }
    }

    // load direct elements

    for ( final IConfigurationElement child : ele.getChildren ( "columnInformation" ) )
    {
        final String type = child.getAttribute ( "type" );
        final String label = child.getAttribute ( "label" );

        int initialSize = DEFAULT_INITIAL_SIZE;
        try
        {
            initialSize = Integer.parseInt ( child.getAttribute ( "initialSize" ) );
        }
        catch ( final Exception e )
        {
        }

        final boolean sortable = Boolean.parseBoolean ( child.getAttribute ( "sortable" ) );

        final Map<String, String> parameters = new HashMap<String, String> ();

        for ( final IConfigurationElement param : child.getChildren ( "columnParameter" ) )
        {
            final String key = param.getAttribute ( "key" );
            final String value = param.getAttribute ( "value" );
            if ( key != null )
            {
                parameters.put ( key, value );
            }
        }

        if ( type != null )
        {
            columnInformation.add ( new ColumnLabelProviderInformation ( label, type, sortable, initialSize, parameters ) );
        }
    }

    if ( columnInformation.isEmpty () )
    {
        fillWithDefault ( columnInformation );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:59,代码来源:ConfigurationHelper.java

示例10: loadConnections

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
protected Set<LoginConnection> loadConnections ( final String contextId )
{
    final Set<LoginConnection> result = new HashSet<LoginConnection> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( "org.eclipse.scada.core.ui.connection.login.context" ) ) //$NON-NLS-1$
    {
        if ( !"context".equals ( ele.getName () ) ) //$NON-NLS-1$
        {
            continue;
        }

        if ( !contextId.equals ( ele.getAttribute ( "id" ) ) )
        {
            continue;
        }

        for ( final IConfigurationElement child : ele.getChildren ( "connection" ) )
        {
            final ConnectionInformation ci = ConnectionInformation.fromURI ( child.getAttribute ( "uri" ) );

            if ( ci == null )
            {
                throw new IllegalArgumentException ( String.format ( "Unable to parse connection uri: %s", child.getAttribute ( "uri" ) ) );
            }

            final Set<String> servicePids = new HashSet<String> ();

            final String modeString = child.getAttribute ( "mode" );
            final LoginConnection.Mode mode = modeString == null ? Mode.NORMAL : Mode.valueOf ( modeString );

            // load single service pid
            addServicePid ( servicePids, child.getAttribute ( "servicePid" ) );

            // load multi service pids
            for ( final IConfigurationElement registrationElement : child.getChildren ( "registration" ) )
            {
                addServicePid ( servicePids, registrationElement.getAttribute ( "servicePid" ) );
            }

            final Integer servicePriority;
            if ( child.getAttribute ( "servicePriority" ) != null )
            {
                servicePriority = Integer.parseInt ( child.getAttribute ( "servicePriority" ) );
            }
            else
            {
                servicePriority = null;
            }

            final Integer autoReconnectDelay;
            if ( child.getAttribute ( "autoReconnectDelay" ) != null )
            {
                autoReconnectDelay = Integer.parseInt ( child.getAttribute ( "autoReconnectDelay" ) );
            }
            else
            {
                autoReconnectDelay = null;
            }

            final boolean useCallbacks = Boolean.parseBoolean ( child.getAttribute ( "authUseCallbacks" ) );

            final LoginConnection lc = new LoginConnection ( ci, servicePids, autoReconnectDelay, servicePriority, mode, useCallbacks );
            result.add ( lc );
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:69,代码来源:ConnectionLoginFactory.java

示例11: getFactories

import org.eclipse.core.runtime.IConfigurationElement; //导入方法依赖的package包/类
public Map<Class<?>, Set<GeneratorFactory>> getFactories ()
{
    if ( this.cache == null )
    {
        logger.info ( "Rebuild factory cache" );

        this.cache = new HashMap<> ();
        for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_GENERATOR_FACTORY ) )
        {
            if ( !ELE_FACTORY.equals ( ele.getName () ) )
            {
                continue;
            }

            logger.debug ( "Checking factory - factory: {}", ele.getAttribute ( ATTR_CLASS ) );

            GeneratorFactory factory;
            try
            {
                factory = (GeneratorFactory)ele.createExecutableExtension ( ATTR_CLASS );
            }
            catch ( final CoreException e )
            {
                this.log.log ( e.getStatus () );
                logger.warn ( "Failed to create factory", e );
                continue;
            }

            for ( final IConfigurationElement child : ele.getChildren ( ELE_GENERATE_FOR ) )
            {
                logger.debug ( "Checking for -> {}", child.getAttribute ( ATTR_CLASS ) );

                final Class<?> sourceClass = makeSourceClass ( child );
                if ( sourceClass != null )
                {
                    addCacheEntry ( sourceClass, factory );
                }
            }
        }
    }
    return this.cache;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:43,代码来源:GeneratorLocator.java


注:本文中的org.eclipse.core.runtime.IConfigurationElement.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。