Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Context$ClassContext


            {
                if( adapterType == Context.class )
                {
                    final Bundle bundle = Platform.getBundle( "org.eclipse.core.resources" );
                   
                    return (A) new Context()
                    {
                        @Override
                        public Class<?> findClass( final String name )
                        {
                            try
View Full Code Here


            this.reference = reference;
           
            if( reference != null )
            {
                final Context context = context( Element.class ).adapt( Context.class );
               
                try
                {
                    this.handle = DefinitionLoader.context( context ).sdef( reference ).root();
                }
View Full Code Here

    }

    public static Class<?> resolveClass( final ISapphireUiDef def,
                                         final String className )
    {
        final Context context = def.adapt( Context.class );
       
        for( IPackageReference packageRef : def.getImportedPackages() )
        {
            final String packageName = packageRef.getName().text();
           
            if( packageName != null )
            {
                final String fullClassName = packageName + "." + className;
                final Class<?> cl = context.findClass( fullClassName );
               
                if( cl != null )
                {
                    return cl;
                }
View Full Code Here

    @Override
    public ImageData convert( final String string )
    {
        final Element element = context( Element.class );
        final Context ctxt = element.adapt( Context.class );
       
        InputStream stream = null;
       
        if( string != null && ! string.contains( "/" ) )
        {
            final ISapphireUiDef sdef = element.nearest( ISapphireUiDef.class );
           
            if( sdef != null )
            {
                for( IPackageReference p : sdef.getImportedPackages() )
                {
                    final String pname = p.getName().content();
                   
                    if( pname != null )
                    {
                        final String possibleFullPath = pname.replace( '.', '/' ) + "/" + string;
                        stream = ctxt.findResource( possibleFullPath );
                       
                        if( stream != null )
                        {
                            break;
                        }
                    }
                }
            }
        }
       
        if( stream == null )
        {
            stream = ctxt.findResource( string );
        }
       
        if( stream != null )
        {
            try
View Full Code Here

    public JavaType resolve( final String name )
    {
        if( name != null )
        {
            final ISapphireUiDef sdef = context( ISapphireUiDef.class );
            final Context context = sdef.adapt( Context.class );
           
            if( context != null )
            {
                Class<?> cl = context.findClass( name );
               
                if( cl == null && name.indexOf( '.' ) == -1 )
                {
                    for( IPackageReference packageRef : sdef.getImportedPackages() )
                    {
                        final String packageName = packageRef.getName().text();
                       
                        if( packageName != null )
                        {
                            cl = context.findClass( packageName + "." + name );
                           
                            if( cl != null )
                            {
                                break;
                            }
View Full Code Here

                final Element root = parse( handle.extension() );

                if( root != null )
                {
                    final NodeList nodes = root.getChildNodes();
                    final Context context = handle.context();

                    for( int i = 0, n = nodes.getLength(); i < n; i++ )
                    {
                        final Node node = nodes.item( i );

                        if( node instanceof Element )
                        {
                            final Element el = (Element) node;
                            final String elname = el.getLocalName();

                            try
                            {
                                if( elname.equals( EL_SERVICE ) )
                                {
                                    final String id = value( el, EL_ID ).required();
                                    final Set<String> contexts = SetFactory.unmodifiable( values( el, EL_CONTEXT ) );
                                    final Set<String> overrides = SetFactory.unmodifiable( values( el, EL_OVERRIDES ) );
                                   
                                    final Class<? extends Service> implementation = context.findClass( value( el, EL_IMPLEMENTATION ).required() );
                                   
                                    final String conditionClassName = value( el, EL_CONDITION ).optional();
                                    Class<? extends ServiceCondition> condition = null;
                                   
                                    if( conditionClassName != null )
                                    {
                                        condition = context.findClass( conditionClassName );
                                    }
                                   
                                    if( implementation != null )
                                    {
                                        serviceExtensionsFactory.add( new ServiceExtension( id, implementation, condition, contexts, overrides ) );
                                    }
                                }
                                else if( elname.equals( EL_FUNCTION ) )
                                {
                                    final String name = value( el, EL_NAME ).required().toLowerCase();
                                    final Class<? extends Function> impl = context.findClass( value( el, EL_IMPL ).required() );
                                   
                                    final Element signatureElement = element( el, EL_SIGNATURE ).optional();
                                    final List<Class<?>> signature;
                                   
                                    if( signatureElement == null )
                                    {
                                        signature = null;
                                    }
                                    else
                                    {
                                        final ListFactory<Class<?>> parameters = ListFactory.start();
                                       
                                        for( String string : values( signatureElement, EL_PARAMETER ) )
                                        {
                                            final Class<?> parameter;
                                           
                                            try
                                            {
                                                parameter = context.findClass( string );
                                            }
                                            catch( IllegalArgumentException e )
                                            {
                                                throw new InvalidExtensionException();
                                            }
View Full Code Here

                                       final Object data )
    {
        if( definition() == null )
        {
            final String bundleId = config.getContributor().getName();
            final Context context = BundleBasedContext.adapt( bundleId );
            final Map<?,?> properties = (Map<?,?>) data;
   
            final String sdef = (String) properties.get( "sdef" );
            final DefinitionLoader.Reference<WizardDef> definition = DefinitionLoader.context( context ).sdef( sdef ).wizard();
           
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Context$ClassContext

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.