Examples of PropertyDef


Examples of org.eclipse.sapphire.PropertyDef

public final class StaticFactsService extends FactsService
{
    @Override
    protected void facts( final SortedSet<String> facts )
    {
        final PropertyDef property = context( PropertyDef.class );
       
        final Fact factAnnotation = property.getAnnotation( Fact.class );
       
        if( factAnnotation != null )
        {
            facts( facts, factAnnotation );
        }
       
        final Facts factsAnnotation = property.getAnnotation( Facts.class );
       
        if( factsAnnotation != null )
        {
            for( Fact a : factsAnnotation.value() )
            {
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final PropertyDef property = context.find( PropertyDef.class );
            return ( property != null && ( property.hasAnnotation( Fact.class ) || property.hasAnnotation( Facts.class ) ) );
        }
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    private Set<ElementType> possible;
   
    @Override
    protected void initPossibleTypesService()
    {
        final PropertyDef property = context( PropertyDef.class );
        final List<Class<?>> possible = new ArrayList<Class<?>>();
       
        final Type typeAnnotation = property.getAnnotation( Type.class );
       
        if( property instanceof ElementProperty || property instanceof ListProperty )
        {
            if( typeAnnotation != null )
            {
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    private Comparable max;
   
    @Override
    protected void initValidationService()
    {
        final PropertyDef property = context( PropertyDef.class );
        final Class<?> type = property.getTypeClass();
        final NumericRange rangeConstraintAnnotation = property.getAnnotation( NumericRange.class );
        final MasterConversionService converter = property.service( MasterConversionService.class );

        final String minStr = rangeConstraintAnnotation.min();
       
        if( minStr != null )
        {
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

            this.connListProperty = this.modelProperty;
        }
        else
        {
            ModelPath.PropertySegment head = (ModelPath.PropertySegment)this.originalEndpoint2Path.head();
            PropertyDef prop = type.property(head.getPropertyName());
            if (prop instanceof ListProperty)
            {
                this.endpoint1Path = new ModelPath("../" + endpt1PropStr);
                this.endpoint2Path = this.originalEndpoint2Path.tail();
                this.connListProperty = (ListProperty)prop;
            }
            else
            {
                throw new RuntimeException("Invaid Model Path:" + this.originalEndpoint2Path);
            }
        }
       
        // initialize the connection parts
        ElementList<?> list = element.property(this.modelProperty);
        for( Element listEntryModelElement : list )
        {
            // check the type of connection: 1x1 connection versus 1xn connection           
            if (getConnectionType() == ConnectionType.OneToOne)
            {   
                // The connection model element specifies a 1x1 connection
                createNewConnectionPart(listEntryModelElement, null);
            }
            else
            {
                ModelPath.PropertySegment head = (ModelPath.PropertySegment)this.originalEndpoint2Path.head();
                PropertyDef connProp = listEntryModelElement.property(head.getPropertyName()).definition();
                if (!(connProp instanceof ListProperty))
                {
                    throw new RuntimeException("Expecting " + connProp.name() + " to be a list property");
                }
                // the connection is of type 1xn
                ElementList<?> connList = listEntryModelElement.property((ListProperty)connProp);                       
                for (Element connElement : connList)
                {
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

                    srcElement = list.insert();
                    setModelProperty(srcElement, srcProperty, endpoint1Value);
                }
               
                ModelPath.PropertySegment head = (ModelPath.PropertySegment)this.originalEndpoint2Path.head();
                PropertyDef connProp = srcElement.property(head.getPropertyName()).definition();
                if (!(connProp instanceof ListProperty))
                {
                    throw new RuntimeException("Expecting " + connProp.name() + " to be a list property");
                }
                // the connection is of type 1xn
                ElementList<?> connList = srcElement.property((ListProperty)connProp);
                Element newElement = connList.insert();
                setModelProperty(newElement, ((ModelPath.PropertySegment)this.endpoint2Path.head()).getPropertyName(), endpoint2Value);
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

                                    String propertyName, Object value)
    {
        if (propertyName != null)
        {
            final ElementType type = modelElement.type();
            final PropertyDef property = type.property( propertyName );
            if( property == null )
            {
                throw new RuntimeException( "Could not find property " + propertyName + " in " + type.getQualifiedName() );
            }
            if (!(property instanceof ValueProperty))
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

        this.endpointPath = new ModelPath(endpointPropStr);
       
        ElementList<Element> srcNodeList = getModelElement().property(nodeProperty);
        for (Element srcNodeModel : srcNodeList)
        {
            PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();
            if (connProp instanceof ListProperty)
            {
                ListProperty connListProperty = (ListProperty)connProp;
                ElementList<?> connList = srcNodeModel.property(connListProperty);
                for (Element endpointModel : connList)
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

        }               
    }
   
    public void refreshConnections(Element srcNodeModel)
    {
      PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();
      handleConnectionListChange(srcNodeModel, (ListProperty)connProp);
    }
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

        }
        Element srcNodeModel = srcNode.getLocalModelElement();
        // check the target node type
        ElementType targetType = targetNode.getLocalModelElement().type();
       
        PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();       
        ElementType connType = connProp.getType();
        PropertyDef endpointProp =
            connType.property(this.bindingDef.getEndpoint2().content().getProperty().content());
        if (endpointProp.getType() == null && endpointProp.hasAnnotation(Reference.class))
        {
            return endpointProp.getAnnotation(Reference.class).target().isAssignableFrom(targetType.getModelElementClass());
        }
        return false;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.