Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Property


        for( final MasterDetailsContentNodePart.NodeFactory factory : node.factories() )
        {
            factory.detach( this.nodeFactoryListener );
           
            final Property property = factory.property();
           
            if( ! property.disposed() )
            {
                final PossibleTypesService possibleTypesService = property.service( PossibleTypesService.class );
                possibleTypesService.detach( this.possibleTypesServiceListener );
            }
        }
    }
View Full Code Here


    public void init( final SapphireAction action,
                      final ActionHandlerDef def )
    {
        super.init( action, def );

        final Property property = property();
       
        final Listener listener = new FilteredListener<PropertyEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyEvent event )
            {
                refreshEnablementState();
            }
        };
       
        property.attach( listener );
       
        attach
        (
            new Listener()
            {
                @Override
                public void handle( final Event event )
                {
                    if( event instanceof DisposeEvent )
                    {
                        property.detach( listener );
                    }
                }
            }
        );
    }
View Full Code Here

    protected static abstract class Condition extends PropertyEditorCondition
    {
        @Override
        protected final boolean evaluate( final PropertyEditorPart part )
        {
            final Property property = part.property();
           
            if( property instanceof Value && property.definition().isOfType( JavaTypeName.class ) )
            {
                final Reference referenceAnnotation = property.definition().getAnnotation( Reference.class );
               
                return
                (
                    referenceAnnotation != null &&
                    referenceAnnotation.target() == JavaType.class &&
                    evaluate( property.service( JavaTypeConstraintService.class ) ) &&
                    property.element().adapt( IJavaProject.class ) != null
                );
            }
           
            return false;
        }
View Full Code Here

   
    @Override
    public void contribute( final PropertyEditorAssistContext context )
    {
      SapphirePart part = context.getPart();
        Property property0 = null;
        boolean propertyReadOnly = false;
        if (part instanceof PropertyEditorPart)
        {
          property0 = ((PropertyEditorPart)part).property();
          propertyReadOnly = ( (PropertyEditorPart) part ).isReadOnly();
         
        }
        else if (part instanceof WithPart)
        {
          property0 = ((WithPart)part).property();
          propertyReadOnly = property0.definition().isReadOnly();
        }
       
             
        if( property0 == null || property0.empty() || propertyReadOnly  )
        {
            return;
        }
       
        final Property property = property0;
        if( property instanceof Value<?> )
        {
         
            final DefaultValueService defaultValueService = property.service( DefaultValueService.class );
            final boolean hasDefaultValue = ( defaultValueService == null ? false : defaultValueService.value() != null );
            final boolean isBooleanType = property.definition().getTypeClass().equals( Boolean.class );
           
            final String actionText
                = ( hasDefaultValue || isBooleanType ? restoreDefaultValue.text() : clear.text() );
           
            final PropertyEditorAssistContribution.Factory contribution = PropertyEditorAssistContribution.factory();
           
            contribution.text( "<p><a href=\"action\" nowrap=\"true\">" + escapeForXml( actionText ) + "</a></p>" );
           
            contribution.link
            (
                "action",
                new Runnable()
                {
                    public void run()
                    {
                        property.clear();
                    }
                }
            );
           
            final PropertyEditorAssistSection section = context.getSection( SECTION_ID_ACTIONS );
            section.addContribution( contribution.create() );
        }
        else if( property.definition() instanceof ListProperty )
        {
            final PropertyEditorAssistContribution.Factory contribution = PropertyEditorAssistContribution.factory();
           
            contribution.text( "<p><a href=\"action\" nowrap=\"true\">" + escapeForXml( clear.text() ) + "</a></p>" );
           
            contribution.link
            (
                "action",
                new Runnable()
                {
                    public void run()
                    {
                        property.clear();
                    }
                }
            );
           
            final PropertyEditorAssistSection section = context.getSection( SECTION_ID_ACTIONS );
            section.addContribution( contribution.create() );
        }
        else if( property instanceof ElementHandle<?> )
        {
            final PropertyEditorAssistContribution.Factory contribution = PropertyEditorAssistContribution.factory();
           
            contribution.text( "<p><a href=\"action\" nowrap=\"true\">" + escapeForXml( clear.text() ) + "</a></p>" );
           
            contribution.link
            (
                "action",
                new Runnable()
                {
                    public void run()
                    {
                        property.clear();
                    }
                }
            );
           
            final PropertyEditorAssistSection section = context.getSection( SECTION_ID_ACTIONS );
View Full Code Here

    @Override
    public void contribute( final PropertyEditorAssistContext context )
    {
      SapphirePart part = context.getPart();
        final Element element = part.getLocalModelElement();
        Property property = null;
        if (part instanceof PropertyEditorPart)
        {
          property = ((PropertyEditorPart)part).property();
        }
        else if (part instanceof WithPart)
        {
          property = ((WithPart)part).property();
        }
       
        boolean contribute = false;
       
        if( property == null )
        {
          contribute = ! element.validation().ok();
        }
        else if( ! property.validation().ok() )
        {
            contribute = true;
        }
        else
        {
            contribute = ! property.empty();
        }
       
        if( contribute )
        {
          final Set<String> facts;
         
          if( property != null )
          {
            facts = property.service( FactsAggregationService.class ).facts();
          }
          else
          {
            FactsAggregationService service = element.service( FactsAggregationService.class );
            facts = service != null ? service.facts() : new TreeSet<String>();       
View Full Code Here

   
    @Override
    public void contribute( final PropertyEditorAssistContext context )
    {
      SapphirePart part = context.getPart();
        Property property0 = null;
        if (part instanceof PropertyEditorPart)
        {
          property0 = ((PropertyEditorPart)part).property();
         
        }
        else if (part instanceof WithPart)
        {
          property0 = ((WithPart)part).property();
        }
        final Element element = part.getLocalModelElement();
       
        final SourceEditorService sourceEditorService = element.adapt( SourceEditorService.class );
       
        if( sourceEditorService == null )
        {
            return;
        }
       
        boolean contribute = false;
       
        if( property0 == null )
        {
          contribute = true;
        }
        else if( ! property0.definition().isDerived() )
        {
            contribute = ! property0.empty();
        }
       
        if( ! contribute )
        {
            return;
        }

        final Property property = property0;
        final PropertyEditorAssistContribution.Factory contribution = PropertyEditorAssistContribution.factory();
       
        contribution.text( "<p><a href=\"action\" nowrap=\"true\">" + escapeForXml( action.text() ) + "</a></p>" );
       
        contribution.link
        (
            "action",
            new Runnable()
            {
                public void run()
                {
                    sourceEditorService.show( element, property != null ? property.definition() : null);
                }
            }
        );
       
        final PropertyEditorAssistSection section = context.getSection( SECTION_ID_ACTIONS );
View Full Code Here

            {
                part = new WithImpliedPart();
            }
            else
            {
                final Property property = element.property( path );
               
                if( property.definition() instanceof ImpliedElementProperty )
                {
                    part = new WithImpliedPart();
                }
                else
                {
View Full Code Here

   
    @Override
    public void contribute( final PropertyEditorAssistContext context )
    {
      SapphirePart part = context.getPart();
        Property property = null;
        if (part instanceof PropertyEditorPart)
        {
          property = ((PropertyEditorPart)part).property();
         
        }
        else if (part instanceof WithPart)
        {
          property = ((WithPart)part).property();
        }
       
        if( property == null || property.definition().isReadOnly() )
        {
            return;
        }
       
        if( property instanceof Value<?> )
View Full Code Here

            final PartFunctionContext fc = (PartFunctionContext) context;
            final SapphirePart part = fc.part();
           
            if( part instanceof PropertyEditorPart )
            {
                final Property property = ( (PropertyEditorPart) part ).property();
               
                return new FunctionResult( this, fc )
                {
                    private Listener listener;
                   
                    @Override
                    protected void init()
                    {
                        this.listener = new FilteredListener<PropertyEnablementEvent>()
                        {
                            @Override
                            protected void handleTypedEvent( final PropertyEnablementEvent event )
                            {
                                refresh();
                            }
                        };
                       
                        property.attach( this.listener );
                    }

                    @Override
                    protected Object evaluate()
                    {
                        return property.enabled();
                    }
                   
                    @Override
                    public void dispose()
                    {
                        super.dispose();
                       
                        property.detach( this.listener );
                        this.listener = null;
                    }
                };
            }
        }
View Full Code Here

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final Property property = context.find( Property.class );
           
            if( property.definition() instanceof ValueProperty )
            {
                final Reference referenceAnnotation = property.definition().getAnnotation( Reference.class );
   
                if( referenceAnnotation != null && referenceAnnotation.target() == JavaType.class )
                {
                    final IProject project = property.element().adapt( IProject.class );
                   
                    if( project != null )
                    {
                        try
                        {
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Property

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.