Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.ValueProperty


    }
   
    protected void createContents( final Composite parent )
    {
        final PropertyEditorPart part = part();
        final ValueProperty property = (ValueProperty) part.property().definition();
       
        this.rootComposite = new Composite( parent, SWT.NONE )
        {
            @Override
            public void setEnabled( final boolean enabled )
            {
                super.setEnabled( enabled );
               
                NamedValuesPropertyEditorPresentation.this.overallLabelControl.setEnabled( enabled );
                NamedValuesPropertyEditorPresentation.this.arbitraryValueRadioButton.setEnabled( enabled );
                NamedValuesPropertyEditorPresentation.this.arbitraryValueTextField.setEnabled( enabled && ( NamedValuesPropertyEditorPresentation.this.arbitraryValueRadioButton.getSelection() == true ) );
               
                for( Button b : NamedValuesPropertyEditorPresentation.this.namedValuesRadioButtons )
                {
                    b.setEnabled( enabled );
                }
            }
        };
       
        this.rootComposite.setLayout( glayout( 1, 0, 0 ) );
       
        final int baseIndent = part.getMarginLeft();
        this.rootComposite.setLayoutData( gdvindent( gdhindent( gdhspan( gdhfill(), 2 ), baseIndent ), 5 ) );
       
        final NamedValues namedValuesAnnotation = property.getAnnotation( NamedValues.class );
        final NamedValue[] namedValueAnnotations = namedValuesAnnotation.namedValues();
       
        this.namedValues = new NamedValueLocal[ namedValueAnnotations.length ];
       
        for( int i = 0, n = namedValueAnnotations.length; i < n; i++ )
        {
            final NamedValue x = namedValueAnnotations[ i ];
           
            final String namedValueLabel
                = property.getLocalizationService().text( x.label(), CapitalizationType.FIRST_WORD_ONLY, true );
           
            this.namedValues[ i ] = new NamedValueLocal( x.value(), namedValueLabel );
        }
       
        this.updating = false;
       
        this.defaultArbitraryValue = namedValuesAnnotation.defaultArbitraryValue();
        this.defaultArbitraryValue = property.encodeKeywords( this.defaultArbitraryValue );
       
        final Composite composite = new Composite( this.rootComposite, SWT.NONE );
        composite.setLayoutData( gdhfill() );
        composite.setLayout( glspacing( glayout( 2, 0, 0 ), 2 ) );
       
        final PropertyEditorAssistDecorator decorator = new PropertyEditorAssistDecorator( part, composite );
       
        decorator.control().setLayoutData( gdvalign( gd(), SWT.CENTER ) );
        decorator.addEditorControl( this.rootComposite );
        decorator.addEditorControl( composite );
       
        this.overallLabelControl = new Label( composite, SWT.WRAP );
        this.overallLabelControl.setLayoutData( gd() );
        this.overallLabelControl.setText( property.getLabel( true, CapitalizationType.FIRST_WORD_ONLY, true ) );
        decorator.addEditorControl( this.overallLabelControl );
       
        final SelectionListener selectionListener = new SelectionAdapter()
        {
            @Override
            public void widgetSelected( final SelectionEvent event )
            {
                handleRadioButtonSelectedEvent( event );
            }
        };
       
        final Composite radioButtonsComposite = new Composite( this.rootComposite, SWT.NONE );
        radioButtonsComposite.setLayoutData( gdhindent( gdhfill(), 20 ) );
        radioButtonsComposite.setLayout( glayout( 2, 0, 0, 0, 0 ) );
        decorator.addEditorControl( radioButtonsComposite );
       
        this.radioButtonGroup = new ArrayList<Button>();
       
        final String arbitraryValueLabel
            = property.getLocalizationService().text( namedValuesAnnotation.arbitraryValueLabel(), CapitalizationType.FIRST_WORD_ONLY, true ) + ":";
   
        this.arbitraryValueRadioButton = createRadioButton( radioButtonsComposite, arbitraryValueLabel );
        this.arbitraryValueRadioButton.setLayoutData( gd() );
        this.arbitraryValueRadioButton.addSelectionListener( selectionListener );
        this.radioButtonGroup.add( this.arbitraryValueRadioButton );
View Full Code Here


    public static final class GlobalCondition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                final Collation collation = property.getAnnotation( Collation.class );
               
                if( collation != null )
                {
                    return collation.global() ||
                           collation.ignoreCaseDifferences().equalsIgnoreCase( "true" ) ||
View Full Code Here

    public static final class InstanceCondition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                final Collation collation = property.getAnnotation( Collation.class );
               
                if( collation != null )
                {
                    return ! collation.global() &&
                           ! collation.ignoreCaseDifferences().equalsIgnoreCase( "true" ) &&
View Full Code Here

            final String text = value.text();
            final String def = value.getDefaultText();
           
            if( def != null && ! def.equals( text ) )
            {
                final ValueProperty p = value.definition();
                final String msg = message.format( p.getLabel( true, CapitalizationType.FIRST_WORD_ONLY, false ), new ValueSnapshot( p, def ) );
                return Status.createWarningStatus( msg );
            }
        }
       
        return Status.createOkStatus();
View Full Code Here

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                return property.hasAnnotation( PreferDefaultValue.class );
            }
           
            return false;
        }
View Full Code Here

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

   
    @Override
    protected void initPossibleValuesService()
    {
        final ListProperty listProperty = context( ListProperty.class );
        final ValueProperty listMemberValueProperty = (ValueProperty) listProperty.getType().properties().first();
       
        this.base = listMemberValueProperty.service( PossibleValuesService.class );
       
        this.listener = new Listener()
        {
            @Override
            public void handle( final Event event )
View Full Code Here

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                return property.hasAnnotation( PreferDefaultValue.class );
            }
           
            return false;
        }
View Full Code Here

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
            return ( property != null && property.isOfType( FileName.class ) );
        }
View Full Code Here

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                final ElementType type = property.getModelElementType();
               
                if( type.properties().size() == 1 )
                {
                    final Property parent = context.find( Element.class ).parent();
                   
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ValueProperty

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.