Package org.eclipse.sapphire.modeling.el

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


    }

    @Override
    public FunctionResult evaluate( final FunctionContext context )
    {
        return new FunctionResult( this, context )
        {
            @Override
            protected Object evaluate()
            {
                final String string = cast( operand( 0 ), String.class );
View Full Code Here


    }

    @Override
    public FunctionResult evaluate( final FunctionContext context )
    {
        return new FunctionResult( this, context )
        {
            private ElementList<?> list;
            private Listener listener;
           
            @Override
View Full Code Here

    public void testMessageFunction()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        final FunctionResult fr = ExpressionLanguageParser.parse( "${ IntegerValue.Validation.Message }" ).evaluate( context );
       
        try
        {
            assertEquals( "ok", fr.value() );
           
            element.setIntegerValue( 3 );
            assertEquals( "ok", fr.value() );
           
            element.setIntegerValue( "abc" );
            assertEquals( "\"abc\" is not a valid integer", fr.value() );
           
            element.setIntegerValue( 4 );
            assertEquals( "ok", fr.value() );
        }
        finally
        {
            fr.dispose();
        }
    }
View Full Code Here

    public void testMessageFunctionNull()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        final FunctionResult fr = ExpressionLanguageParser.parse( "${ Message( null ) }" ).evaluate( context );
       
        try
        {
            final Status st = fr.status();
           
            assertEquals( Status.Severity.ERROR, st.severity() );
            assertEquals( "Function Message does not accept nulls in position 0.", st.message() );
        }
        finally
        {
            fr.dispose();
        }
    }
View Full Code Here

    public void testMessageFunctionWrongType()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        final FunctionResult fr = ExpressionLanguageParser.parse( "${ Message( 'abc' ) }" ).evaluate( context );
       
        try
        {
            final Status st = fr.status();
           
            assertEquals( Status.Severity.ERROR, st.severity() );
            assertEquals( "Function Message( java.lang.String ) is undefined.", st.message() );
        }
        finally
        {
            fr.dispose();
        }
    }
View Full Code Here

    public String getSerializedEndpoint1(DiagramNodePart srcNode)
    {
        String endpoint1Value = null;
        IDiagramConnectionEndpointBindingDef srcAnchorDef = this.bindingDef.getEndpoint1().content();
        Value<Function> srcFunc = srcAnchorDef.getValue();
        FunctionResult srcFuncResult = getNodeReferenceFunction(srcNode, srcFunc,
                                this.bindingDef.adapt( LocalizationService.class ));
        if (srcFuncResult != null)
        {
            endpoint1Value = (String)srcFuncResult.value();
            srcFuncResult.dispose();           
        }
        if (endpoint1Value == null || endpoint1Value.length() == 0)
        {
            endpoint1Value = srcNode.getId();
        }
View Full Code Here

    public String getSerializedEndpoint2(DiagramNodePart targetNode)
    {
        String endpoint2Value = null;
        IDiagramConnectionEndpointBindingDef targetAnchorDef = this.bindingDef.getEndpoint2().content();
        Value<Function> targetFunc = targetAnchorDef.getValue();;
        FunctionResult targetFuncResult = getNodeReferenceFunction(targetNode, targetFunc,
                                this.bindingDef.adapt( LocalizationService.class ));
       
        if (targetFuncResult != null)
        {
            endpoint2Value = (String)targetFuncResult.value();
            targetFuncResult.dispose();
        }
        if (endpoint2Value == null || endpoint2Value.length() == 0)
        {
            endpoint2Value = targetNode.getId();
        }
View Full Code Here

    protected FunctionResult getNodeReferenceFunction(final DiagramNodePart nodePart,
                                                final Value<Function> function,
                                                LocalizationService ls)
    {
        Function f = null;
        FunctionResult fr = null;
       
        if( function != null )
        {
            f = function.content();
        }
View Full Code Here

          List<ToolPaletteImageDef> imageDefs = connectionDef.getToolPaletteImages();
          List<FunctionResult> frs = new ArrayList<FunctionResult>();
         
          for (ToolPaletteImageDef imageDef : imageDefs)
          {
              FunctionResult imageResult = initExpression
              (
                imageDef.getToolPaletteImage().content(),
                  ImageData.class,
                  null,
                  new Runnable()
View Full Code Here

        this.toolPaletteImageFunctionResults = new ArrayList<FunctionResult>();
        List<ToolPaletteImageDef> imageDefs = this.definition.getToolPaletteImages();
        for (ToolPaletteImageDef imageDef : imageDefs)
        {
          FunctionResult fr = initExpression
          (
              imageDef.getToolPaletteImage().content(),
              ImageData.class,
              null,
              new Runnable()
View Full Code Here

TOP

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

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.