Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.ElementType


                   
        String endpt1PropStr = this.bindingDef.getEndpoint1().content().getProperty().content();
        String endpt2PropStr = this.bindingDef.getEndpoint2().content().getProperty().content();
        this.originalEndpoint2Path = new ModelPath(endpt2PropStr);
       
        ElementType type = this.modelProperty.getType();
        this.endpoint1Property = type.property(endpt1PropStr);
        this.endpoint2Property = type.property(this.originalEndpoint2Path);
               
        if (getConnectionType() == ConnectionType.OneToOne)
        {
            this.endpoint1Path = new ModelPath(endpt1PropStr);
            this.endpoint2Path = new ModelPath(endpt2PropStr);
            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;
View Full Code Here


    }
   
    public boolean canStartNewConnection(DiagramNodePart srcNode)
    {
        boolean canStart = false;
        ElementType srcType = srcNode.getModelElement().type();
        if (this.endpoint1Property.getType() == null && this.endpoint1Property.hasAnnotation(Reference.class))
        {
            canStart = this.endpoint1Property.getAnnotation(Reference.class).target().isAssignableFrom(srcType.getModelElementClass());
        }
        return canStart;
    }
View Full Code Here

       
        canCreate = canStartNewConnection(srcNode);
        if (!canCreate)
            return false;
       
        ElementType targetType = targetNode.getModelElement().type();
       
        if (this.endpoint2Property.getType() == null && this.endpoint2Property.hasAnnotation(Reference.class))
        {
            canCreate = this.endpoint2Property.getAnnotation(Reference.class).target().isAssignableFrom(targetType.getModelElementClass());
        }
        return canCreate;
    }
View Full Code Here

    protected void setModelProperty(final Element modelElement,
                                    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))
            {
                throw new RuntimeException( "Property " + propertyName + " not a ValueProperty");
            }
View Full Code Here

    @Override
    public boolean canStartNewConnection(DiagramNodePart srcNode)
    {
        Element srcNodeModel = srcNode.getLocalModelElement();
        // check the source node type
        ElementType srcNodeType = srcNodeModel.type();
        ElementType desiredsrcNodeType = this.nodeTemplate.getNodeType();
       
        if (!srcNodeType.equals(desiredsrcNodeType))
        {
            return false;
        }
View Full Code Here

        {
            return false;
        }
        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

    protected void setModelProperty(final Element modelElement,
            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))
            {
                throw new RuntimeException( "Property " + propertyName + " not a ValueProperty");
            }
View Full Code Here

    {
        private ValueProperty listEntryProperty;
       
        public DefaultListEntryResource()
        {
            final ElementType listEntryType = property().definition().getType();
           
            for( PropertyDef prop : listEntryType.properties() )
            {
                if( this.listEntryProperty != null )
                {
                    throw new IllegalStateException();
                }
View Full Code Here

            final Property property = context.find( Property.class );
           
            if( property != null && property.definition() instanceof ListProperty &&
                property.service( PossibleTypesService.class ).types().size() == 1 )
            {
                final ElementType memberType = property.definition().getType();
                final SortedSet<PropertyDef> properties = memberType.properties();
               
                if( properties.size() == 1 )
                {
                    final PropertyDef memberProperty = properties.first();
                   
View Full Code Here

                    {
                        contextLabel = property.getModelElementType().getSimpleName() + "." + property.name();
                    }
                    else
                    {
                        final ElementType type = context.find( ElementType.class );
                       
                        if( type != null )
                        {
                            contextLabel = type.getSimpleName();
                        }
                        else
                        {
                            contextLabel = context.getClass().getSimpleName();
                        }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ElementType

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.