Package org.eclipse.sapphire.services

Examples of org.eclipse.sapphire.services.ValueNormalizationService


    {
        final int index = this.combo.getSelectionIndex();
       
        if( index == -1 )
        {
            final ValueNormalizationService valueNormalizationService = this.property.service( ValueNormalizationService.class );
            final String value = valueNormalizationService.normalize( this.combo.getText() );
           
            if( value.length() > 0 )
            {
                return value;
            }
View Full Code Here


            addControl( toolbar );
            decorator.addEditorControl( toolbar );
        }
       
        final PossibleValuesService possibleValuesService = property.service( PossibleValuesService.class );
        final ValueNormalizationService valueNormalizationService = property.service( ValueNormalizationService.class );
       
        final MutableReference<List<PossibleValue>> possibleValuesRef = new MutableReference<List<PossibleValue>>();
       
        final Runnable updateComboSelectionOp = new Runnable()
        {
            public void run()
            {
                if( PopUpListFieldPropertyEditorPresentation.this.updatingModel || combo.isDisposed() )
                {
                    return;
                }
               
                final String text = valueNormalizationService.normalize( property.text() );
               
                try
                {
                    PopUpListFieldPropertyEditorPresentation.this.updatingEditor = true;

                    combo.setData( DATA_DEFAULT_VALUE, property.empty() );
                   
                    if( text == null )
                    {
                        combo.deselectAll();
                        combo.setText( EMPTY_STRING );
                    }
                    else
                    {
                        final List<PossibleValue> possibleValues = possibleValuesRef.get();
                        final int possibleValuesCount = possibleValues.size();
                        int possibleValueIndex = -1;
                       
                        for( int i = 0; i < possibleValuesCount && possibleValueIndex == -1; i++ )
                        {
                            if( equal( possibleValues.get( i ).value(), text ) )
                            {
                                possibleValueIndex = i;
                            }
                        }
   
                        if( PopUpListFieldPropertyEditorPresentation.this.style == PopUpListFieldStyle.STRICT )
                        {
                            if( possibleValueIndex == -1 )
                            {
                                if( possibleValues.size() == combo.getItemCount() )
                                {
                                    combo.add( text );
                                }
                                else
                                {
                                    final String existingNonConformingValue = combo.getItem( possibleValuesCount );
                                   
                                    if( ! existingNonConformingValue.equals( text ) )
                                    {
                                        combo.setItem( possibleValuesCount, text );
                                    }
                                }
                               
                                possibleValueIndex = possibleValuesCount;
                            }
                            else if( possibleValuesCount < combo.getItemCount() )
                            {
                                combo.remove( possibleValuesCount );
                            }
                        }
                       
                        if( possibleValueIndex != -1 )
                        {
                            if( combo.getSelectionIndex() != possibleValueIndex )
                            {
                                combo.setText( EMPTY_STRING );
                                combo.select( possibleValueIndex );
                            }
                        }
                        else
                        {
                            if( ! equal( valueNormalizationService.normalize( combo.getText() ), text ) )
                            {
                                combo.deselectAll();
                                combo.setText( text );
                            }
                        }
View Full Code Here

        {
            final int index = this.combo.getSelectionIndex();
           
            if( index == -1 )
            {
                final ValueNormalizationService valueNormalizationService = this.property.service( ValueNormalizationService.class );
                final String value = valueNormalizationService.normalize( this.combo.getText() );
               
                if( value.length() > 0 )
                {
                    return value;
                }
View Full Code Here

    @Override
    protected void doSetValue( final Object value )
    {
        final Value<?> val = (Value<?>) value;
       
        final ValueNormalizationService valueNormalizationService = this.property.service( ValueNormalizationService.class );
       
        final String text = valueNormalizationService.normalize( val.text() );
        int index = -1;
       
        for( int i = 0, n = this.possibleValues.size(); index == -1 && i < n; i++ )
        {
            if( this.possibleValues.get( i ).value().equals( text ) )
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.services.ValueNormalizationService

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.