Package org.eclipse.sapphire.modeling.el

Examples of org.eclipse.sapphire.modeling.el.Function


   
    @Override
    protected void initCollationService()
    {
        final Collation annotation = context( PropertyDef.class ).getAnnotation( Collation.class );
        Function ignoreCaseDifferencesFunction;
       
        try
        {
            ignoreCaseDifferencesFunction = ExpressionLanguageParser.parse( annotation.ignoreCaseDifferences() );
            ignoreCaseDifferencesFunction = FailSafeFunction.create( ignoreCaseDifferencesFunction, Boolean.class, false );
        }
        catch( Exception e )
        {
            Sapphire.service( LoggingService.class ).log( e );
            ignoreCaseDifferencesFunction = Literal.FALSE;
        }
       
        final Element element = context( Element.class );
        final FunctionContext context = ( element == null ? new FunctionContext() : new ModelElementFunctionContext( element ) );
       
        this.ignoreCaseDifferencesFunctionResult = ignoreCaseDifferencesFunction.evaluate( context );
       
        this.ignoreCaseDifferencesFunctionResult.attach
        (
            new Listener()
            {
View Full Code Here


            }
        };
       
        for( Enablement annotation : context( PropertyDef.class ).getAnnotations( Enablement.class ) )
        {
            Function function = null;
           
            try
            {
                function = ExpressionLanguageParser.parse( annotation.expr() );
            }
            catch( Exception e )
            {
                Sapphire.service( LoggingService.class ).log( e );
                function = null;
            }
           
            if( function != null )
            {
                function = FailSafeFunction.create( function, Literal.create( Boolean.class ), Literal.create( Boolean.FALSE ) );
               
                final FunctionResult functionResult = function.evaluate( fnContext );
               
                functionResult.attach( functionResultListener );
                this.functionResults.add( functionResult );
            }
        }
View Full Code Here

                     final Status.Severity severity )
        {
            this.element = element;
            this.severity = severity;

            Function messageFunction = ExpressionLanguageParser.parse( message );
            messageFunction = FailSafeFunction.create( messageFunction, String.class, false );
           
            this.messageFunction = messageFunction;
           
            Function ruleFunction = ExpressionLanguageParser.parse( rule );
            ruleFunction = FailSafeFunction.create( ruleFunction, Boolean.class, false );
           
            this.ruleFunctionResult = ruleFunction.evaluate( new ModelElementFunctionContext( element ) );
        }
View Full Code Here

    }

    @Override
    public Function convert( final String string )
    {
        Function result = null;
       
        try
        {
            result = ExpressionLanguageParser.parse( string );
        }
        catch( Exception e )
        {
            // Intentionally ignored.
        }
       
        if( result != null )
        {
            result.initOrigin( context( Element.class ), true );
        }
       
        return result;
    }
View Full Code Here

        {
            final String expr = annotation.text();
           
            if( expr.length() > 0 )
            {
                Function function = null;
               
                try
                {
                    function = ExpressionLanguageParser.parse( expr );
                }
                catch( Exception e )
                {
                    Sapphire.service( LoggingService.class ).log( e );
                    function = null;
                }
               
                if( function != null )
                {
                    function = FailSafeFunction.create( function, Literal.create( String.class ) );
                   
                    final ModelElementFunctionContext context = new ModelElementFunctionContext( context( Element.class ) );
                   
                    this.functionResult = function.evaluate( context );
                   
                    final Listener listener = new Listener()
                    {
                        @Override
                        public void handle( final Event event )
View Full Code Here

        {
            final String expr = annotation.text();
           
            if( expr.length() > 0 )
            {
                Function function = null;
               
                try
                {
                    function = ExpressionLanguageParser.parse( expr );
                }
                catch( Exception e )
                {
                    Sapphire.service( LoggingService.class ).log( e );
                    function = null;
                }
               
                if( function != null )
                {
                    function = FailSafeFunction.create( function, Literal.create( String.class ) );
                   
                    final ModelElementFunctionContext context = new ModelElementFunctionContext( context( Element.class ) );
                   
                    this.functionResult = function.evaluate( context );
                   
                    final Listener listener = new Listener()
                    {
                        @Override
                        public void handle( final Event event )
View Full Code Here

            }
        };
       
        this.versionCompatibilityTargetService.attach( this.versionCompatibilityTargetServiceListener );
       
        Function function = null;
       
        final VersionCompatibility versionCompatibilityAnnotation = property.getAnnotation( VersionCompatibility.class );

        if( versionCompatibilityAnnotation != null )
        {
            try
            {
                function = ExpressionLanguageParser.parse( versionCompatibilityAnnotation.value() );
            }
            catch( Exception e )
            {
                Sapphire.service( LoggingService.class ).log( e );
            }
        }
        else
        {
            final Since sinceAnnotation = property.getAnnotation( Since.class );
           
            try
            {
                function = ExpressionLanguageParser.parse( sinceAnnotation.value() );
            }
            catch( Exception e )
            {
                Sapphire.service( LoggingService.class ).log( e );
            }
           
            if( function != null )
            {
                function = ConcatFunction.create( "[", function );
            }
        }
       
        if( function == null )
        {
            function = Literal.NULL;
        }
        else
        {
            function = FailSafeFunction.create( function, Literal.create( VersionConstraint.class ), null );
           
            this.functionResult = function.evaluate( new ModelElementFunctionContext( element ) );
           
            this.functionResult.attach
            (
                new Listener()
                {
View Full Code Here

        else
        {
            versionCompatibilityTargetAnnotation = element.type().getAnnotation( VersionCompatibilityTarget.class );
        }
       
        Function versionFunction = null;
       
        try
        {
            versionFunction = ExpressionLanguageParser.parse( versionCompatibilityTargetAnnotation.version() );
        }
        catch( Exception e )
        {
            Sapphire.service( LoggingService.class ).log( e );
        }
       
        if( versionFunction == null )
        {
            versionFunction = Literal.NULL;
            this.versionedFunctionResult = versionFunction.evaluate( new FunctionContext() );
        }
        else
        {
            versionFunction = FailSafeFunction.create( versionFunction, Literal.create( Version.class ), null );
           
            this.versionFunctionResult = versionFunction.evaluate( new ModelElementFunctionContext( element ) );
           
            this.versionFunctionResult.attach
            (
                new Listener()
                {
                    @Override
                    public void handle( final Event event )
                    {
                        refresh();
                    }
                }
            );
        }

        Function versionedFunction = null;
       
        try
        {
            versionedFunction = ExpressionLanguageParser.parse( versionCompatibilityTargetAnnotation.versioned() );
        }
        catch( Exception e )
        {
            Sapphire.service( LoggingService.class ).log( e );
        }
       
        if( versionedFunction == null )
        {
            versionedFunction = Literal.NULL;
            this.versionedFunctionResult = versionedFunction.evaluate( new FunctionContext() );
        }
        else
        {
            versionedFunction = FailSafeFunction.create( versionedFunction, Literal.create( String.class ), null );
           
            this.versionedFunctionResult = versionedFunction.evaluate( new ModelElementFunctionContext( element ) );
           
            this.versionedFunctionResult.attach
            (
                new Listener()
                {
View Full Code Here

        {
            final String expr = annotation.text();
           
            if( expr.length() > 0 )
            {
                Function function = null;
               
                try
                {
                    function = ExpressionLanguageParser.parse( expr );
                }
                catch( Exception e )
                {
                    Sapphire.service( LoggingService.class ).log( e );
                    function = null;
                }
               
                if( function != null )
                {
                    function = FailSafeFunction.create( function, Literal.create( String.class ) );
                   
                    final ModelElementFunctionContext context = new ModelElementFunctionContext( context( Element.class ) );
                   
                    this.functionResult = function.evaluate( context );
                   
                    final Listener listener = new Listener()
                    {
                        @Override
                        public void handle( final Event event )
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.modeling.el.Function

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.