Examples of PropertyDef


Examples of org.eclipse.sapphire.PropertyDef

    @Override
    public StandardDiagramConnectionPart createNewDiagramConnection(DiagramNodePart srcNode,
            DiagramNodePart targetNode)
    {
        Element srcNodeModel = srcNode.getLocalModelElement();
        PropertyDef modelProperty = this.nodeTemplate.getModelProperty();
        boolean found = false;
        if (modelProperty instanceof ListProperty)
        {
            ListProperty listProperty = (ListProperty)modelProperty;
            ElementList<?> list = getModelElement().property(listProperty);
            for (Element listEntryModelElement : list)
            {
                if (listEntryModelElement == srcNodeModel)
                {
                    found = true;
                    break;
                }               
            }
        }
        else if (modelProperty instanceof ElementProperty)
        {
            ElementProperty elementProperty = (ElementProperty)modelProperty;
            if (getModelElement().property(elementProperty) != null)
            {
                Element localModelElement = getModelElement().property(elementProperty).content();
                if (localModelElement == srcNodeModel)
                {
                    found = true;
                }
            }
        }
        if (!found)
        {
            throw new RuntimeException( "Cannot locate the source node element");
        }
       
        PropertyDef connProp = srcNodeModel.property(this.propertyName).definition();
        Element newEndpoint = null;
        if (connProp instanceof ListProperty)
        {
            ListProperty listProperty = (ListProperty)connProp;
            ElementList<?> list = srcNodeModel.property(listProperty);
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    }

    @Override
    protected void handleModelPropertyChange(final PropertyEvent event)
    {
        final PropertyDef property = event.property().definition();
        if (property.name().equals(this.endpointDef.getProperty().content()))
        {
          this.endpointModel = resolveEndpoint(this.modelElement, this.endpointPath);
            notifyConnectionEndpointUpdate();
        }               
    }   
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    protected Element resolveEndpoint(Element modelElement, ModelPath endpointPath)
    {
        if (endpointPath.length() == 1)
        {
            String propertyName = ((ModelPath.PropertySegment)endpointPath.head()).getPropertyName();
            PropertyDef modelProperty = resolve(modelElement, propertyName);
            if (!(modelProperty instanceof ValueProperty))
            {
                throw new RuntimeException( "Property " + propertyName + " not a ValueProperty");
            }
            ValueProperty property = (ValueProperty)modelProperty;
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    protected ReferenceValue<?, ?> resolveEndpointReferenceValue(Element modelElement, ModelPath endpointPath)
    {
        if (endpointPath.length() == 1)
        {
            String propertyName = ((ModelPath.PropertySegment)endpointPath.head()).getPropertyName();
            PropertyDef modelProperty = resolve(modelElement, propertyName);
            if (!(modelProperty instanceof ValueProperty))
            {
                throw new RuntimeException( "Property " + propertyName + " not a ValueProperty");
            }
            ValueProperty property = (ValueProperty)modelProperty;
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

      return null;
    }
   
    protected void handleModelPropertyChange(final PropertyEvent event)
    {
        final PropertyDef property = event.property().definition();
               
        if (property.name().equals(this.endpoint1Property.name()) ||
                property.name().equals(this.endpoint2Property.name()))
        {
            boolean sourceChange = property.name().equals(this.endpoint1Property.name()) ? true : false;
            if (sourceChange)
            {
              this.srcNodeModel = resolveEndpoint(this.modelElement, this.endpoint1Path);
            }
            else
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

    public static final class Factory extends PropertyEditorPresentationFactory
    {
        @Override
        public PropertyEditorPresentation create( final PropertyEditorPart part, final SwtPresentation parent, final Composite composite )
        {
            final PropertyDef property = part.property().definition();
           
            if( property instanceof ValueProperty && property.hasAnnotation( NamedValues.class ) )
            {
                return new NamedValuesPropertyEditorPresentation( part, parent, composite );
            }
           
            return null;
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 instanceof ValueProperty || ( property instanceof ElementProperty && ! ( property instanceof ImpliedElementProperty ) ) );
        }
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

        {
            final SortedSet<PropertyDef> properties = property.definition().getType().properties();
           
            if( properties.size() == 1 )
            {
                final PropertyDef memberProperty = properties.first();
               
                if( memberProperty instanceof ValueProperty && memberProperty.hasAnnotation( Unique.class ) )
                {
                    return true;
                }
            }
        }
View Full Code Here

Examples of org.eclipse.sapphire.PropertyDef

                catch( Exception e )
                {
                    final ServiceContext context = context();
                    final String contextLabel;
                   
                    final PropertyDef property = context.find( PropertyDef.class );
   
                    if( property != null )
                    {
                        contextLabel = property.getModelElementType().getSimpleName() + "." + property.name();
                    }
                    else
                    {
                        final ElementType type = context.find( ElementType.class );
                       
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.