當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。