Package org.eclipse.jem.internal.proxy.core

Examples of org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry


     */
    public static ComponentTypeInfo getComponent(final String classType,
            final String className, final IProject project,
            final IConfigurationContributor[] contributors)
    {
        ProxyFactoryRegistry registry = null;
        try
        {
            registry = getProxyFactoryRegistry(project,
                    contributors);
   
            if (registry != null)
            {
                final IStandardBeanTypeProxyFactory factory = registry
                        .getBeanTypeProxyFactory();
                final IBeanTypeProxy classTypeProxy = factory
                        .getBeanTypeProxy(className);
                final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
                        classTypeProxy);
   
                String family = null;
                String renderer = null;
                try
                {
                    classTypeWrapper.init();
                    family = classTypeWrapper.callStringMethod("getFamily"); //$NON-NLS-1$
                    renderer = classTypeWrapper.callStringMethod("getRendererType"); //$NON-NLS-1$
                }
                catch (ProxyException e1)
                {
                    // fall through
                    if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
                    {
                        JSFCoreTraceOptions.log("DTComponentIntrospector.getComponent:", e1); //$NON-NLS-1$
                    }
                }
   
                IType type = null;
   
                try
                {
                    type = JavaCore.create(project).findType(className);
                }
                catch (JavaModelException e)
                {
                    // fall through;
                }
   
                List<String> interfaces = new ArrayList<String>();
                List<String> superClasses = new ArrayList<String>();
   
                if (type != null)
                {
                    TypeInfoCache typeCache = getSharedTypeCache();
   
                    IType[] interfaceTypes = typeCache.cacheInterfaceTypesFor(type);
                    for (IType interfaze : interfaceTypes)
                    {
                        interfaces.add(interfaze.getFullyQualifiedName());
                    }
   
                    IType[] superClassTypes = typeCache.cacheSupertypesFor(type);
   
                    for (IType superClass : superClassTypes)
                    {
                        superClasses.add(superClass.getFullyQualifiedName());
                    }
                }
   
                return new ComponentTypeInfo(classType, className, superClasses
                        .toArray(new String[0]), interfaces.toArray(new String[0]),
                        family, renderer);
            }
        }
        finally
        {
            if (registry != null)
            {
                registry.terminateRegistry(true);
            }
        }
        return null;
    }
View Full Code Here


        final String className = tldDecl.getTagclass();

        final IConfigurationContributor[] contributor = new IConfigurationContributor[]
        { new ServletBeanProxyContributor(project) };

        ProxyFactoryRegistry registry = null;
        try
        {
            registry = getProxyFactoryRegistry(contributor, project);
   
            if (registry != null)
            {

                final IStandardBeanTypeProxyFactory factory = registry
                        .getBeanTypeProxyFactory();
                final IBeanTypeProxy classTypeProxy = factory
                        .getBeanTypeProxy(className);
                final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
                        classTypeProxy);
   
                try
                {
                    classTypeWrapper.init();
                    return classTypeWrapper.callStringMethod("getComponentType"); //$NON-NLS-1$
                }
                catch (final ProxyException tp)
                {
                    if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
                    {
                        JSFCoreTraceOptions.log("TagAnalyzer.findComponentType", tp); //$NON-NLS-1$
                    }
                }
            }
        }
        finally
        {
            if (registry != null)
            {
                registry.terminateRegistry(true);
            }
        }
        return null;
    }
View Full Code Here

        // type finder because the ConverterTag doesn't initialize its type
        // field on construction. Instead, both MyFaces and RI seem to do it
        // based on the doStartTag method. They also don't provide a standard
        // interface for acquiring the id so instead we make some guess on
        // the internal field name.
        ProxyFactoryRegistry registry = null;
        try
        {
            final String className = tldDecl.getTagclass();
   
            final IConfigurationContributor[] contributor = new IConfigurationContributor[]
            { new ServletBeanProxyContributor(project) };
            registry = getProxyFactoryRegistry(
                    contributor, project);
   
            if (registry != null)
            {
                final IStandardBeanTypeProxyFactory factory = registry
                        .getBeanTypeProxyFactory();
                final IBeanTypeProxy classTypeProxy = factory
                        .getBeanTypeProxy(className);
   
                try
                {
                    final IType type = JavaCore.create(project).findType(className);
   
                    if (type != null
                            && DTComponentIntrospector
                                    .isTypeNameInstanceOfClass(
                                            type,
                                            Collections
                                                    .singleton(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG)))
                    {
                        return findConverterType_InELTag(factory, classTypeProxy,project);
                    }
                    // the assumption is that this is a component tag, so we assume
                    // it is one.
                    else if (type != null
                            && DTComponentIntrospector
                                    .isTypeNameInstanceOfClass(
                                            type,
                                            Collections
                                                    .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG)))
                    {
                        return findConverterType_InTag(factory, classTypeProxy, project);
                    }
                }
                catch (final JavaModelException jme)
                {
                    // suppress for now
                }
            }
        }
        finally
        {
            if (registry != null)
            {
                registry.terminateRegistry(true);
            }
        }
        return null;
    }
View Full Code Here

        final String className = tldDecl.getTagclass();

        final IConfigurationContributor[] contributor = new IConfigurationContributor[]
        { new ServletBeanProxyContributor(project) };

        ProxyFactoryRegistry registry = null;

        try
        {
            registry = getProxyFactoryRegistry(contributor, project);
   
            if (registry != null)
            {
                final IStandardBeanTypeProxyFactory factory = registry
                        .getBeanTypeProxyFactory();
                final IBeanTypeProxy classTypeProxy = factory
                        .getBeanTypeProxy(className);
                final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
                        classTypeProxy);
                final IBeanTypeProxy converterProxy = factory
                        .getBeanTypeProxy(JAVAX_FACES_WEBAPP_VALIDATOR_TAG);
                try
                {
                    classTypeWrapper.init();
   
                    callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$
                    callSuppressExceptions(classTypeWrapper, "createValidator"); //$NON-NLS-1$
   
                    // hopefully doStartTag set the converter field before it
                    // failed.
                    // now try to guess what it's called
                    String validatorId = getStringField(classTypeWrapper,
                            converterProxy, "validatorId"); //$NON-NLS-1$
   
                    if (validatorId != null)
                    {
                        return validatorId;
                    }
   
                    validatorId = getStringField(classTypeWrapper, converterProxy,
                            "_validatorId"); //$NON-NLS-1$
   
                    if (validatorId != null)
                    {
                        return validatorId;
                    }
   
                    // no? then see if there's a VALIDATOR_ID field *on the tag*
                    validatorId = getStringField(classTypeWrapper, classTypeProxy,
                            "VALIDATOR_ID"); //$NON-NLS-1$
   
                    if (validatorId != null)
                    {
                        return validatorId;
                    }
                }
                catch (final ProxyException tp)
                {
                    // fall through
                }
            }
        }
        finally
        {
            if (registry != null)
            {
                registry.terminateRegistry(true);
            }
        }
        return null;

    }
View Full Code Here

TOP

Related Classes of org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.