Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Listener


    {
        this.invalidValueMessage = message.text();
       
        final Address address = context( Address.class );
       
        final Listener listener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                refresh();
View Full Code Here


    {
        this.invalidValueMessage = message.text();
       
        final Address address = context( Address.class );
       
        final Listener listener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                refresh();
View Full Code Here

    {
        this.invalidValueMessage = message.text();
       
        final Address address = context( Address.class );
       
        final Listener listener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                refresh();
View Full Code Here

               
                actionPresentationKeyboard.render();
               
                updateUserInterfaceOp.run();
               
                final Listener modelPropertyListener = new FilteredListener<PropertyEvent>()
                {
                    @Override
                    protected void handleTypedEvent( final PropertyEvent event )
                    {
                        updateUserInterfaceOp.run();
                    }
                };
               
                property.attach( modelPropertyListener );
               
                typeSelectorComposite.layout( true, true );
               
                typeSelectorComposite.getChildren()[ 0 ].addDisposeListener
                (
                    new DisposeListener()
                    {
                        public void widgetDisposed( final DisposeEvent event )
                        {
                            property.detach( modelPropertyListener );
                            actionPresentationManager.dispose();
                            actionPresentationKeyboard.dispose();
                        }
                    }
                );
            }
        };
       
        renderTypeSelectorOp.run();
       
        final Listener possibleTypesServiceListener = new Listener()
        {
            @Override
            public void handle( final Event event )
            {
                renderTypeSelectorOp.run();
View Full Code Here

                    this.running = false;
                }
            }
        };
       
        final Listener listener = new FilteredListener<PropertyContentEvent>()
        {
            @Override
            protected void handleTypedEvent( final PropertyContentEvent event )
            {
                TablePropertyEditorPresentation.this.refreshOperation.run();
            }
        };
       
        property.attach( listener );
       
        addOnDisposeOperation
        (
            new Runnable()
            {
                public void run()
                {
                    property.detach( listener );
                }
            }
        );
       
        boolean showImages = true;
       
        final String columnWidthsHint = part.getRenderingHint( PropertyEditorDef.HINT_COLUMN_WIDTHS, "" );
        final StringTokenizer columnWidthsHintTokenizer = new StringTokenizer( columnWidthsHint, "," );
       
        for( final ModelPath childPropertyPath : part.getChildProperties() )
        {
            final PropertyDef childProperty = property.definition().getType().property( childPropertyPath );
            final PropertyEditorDef childPropertyEditorDef = part.definition().getChildPropertyEditor( childPropertyPath );
            final TableViewerColumn tableViewerColumn = new TableViewerColumn( this.tableViewer, SWT.NONE );
           
            if( childPropertyEditorDef == null )
            {
                final String label = childProperty.getLabel( false, CapitalizationType.TITLE_STYLE, false );
                tableViewerColumn.getColumn().setText( label );
            }
            else
            {
                final MutableReference<FunctionResult> labelFunctionResultRef = new MutableReference<FunctionResult>();
               
                final Runnable updateLabelOp = new Runnable()
                {
                    public void run()
                    {
                        String label = (String) labelFunctionResultRef.get().value();
                        label = LabelTransformer.transform( label, CapitalizationType.TITLE_STYLE, false );
                        tableViewerColumn.getColumn().setText( label );
                    }
                };
               
                final FunctionResult labelFunctionResult = part.initExpression
                (
                    childPropertyEditorDef.getLabel().content(),
                    String.class,
                    Literal.create( childProperty.getLabel( false, CapitalizationType.NO_CAPS, true ) ),
                    updateLabelOp
                );
               
                labelFunctionResultRef.set( labelFunctionResult );
               
                updateLabelOp.run();
               
                addOnDisposeOperation
                (
                    new Runnable()
                    {
                        public void run()
                        {
                            labelFunctionResult.dispose();
                        }
                    }
                );
            }
           
            ColumnWeightData columnWeightData = null;
           
            if( columnWidthsHintTokenizer.hasMoreTokens() )
            {
                final String columnWidthHint = columnWidthsHintTokenizer.nextToken();
                final String[] columnWidthHintSplit = columnWidthHint.split( ":" );
               
                if( columnWidthHintSplit.length == 1 || columnWidthHintSplit.length == 2 )
                {
                    try
                    {
                        final int minColumnWidth = Integer.parseInt( columnWidthHintSplit[ 0 ].trim() );
                        final int columnWeight;
                       
                        if( columnWidthHintSplit.length == 2 )
                        {
                            columnWeight = Integer.parseInt( columnWidthHintSplit[ 1 ].trim() );
                        }
                        else
                        {
                            columnWeight = 0;
                        }
                       
                        columnWeightData = new ColumnWeightData( columnWeight, minColumnWidth, true );
                    }
                    catch( NumberFormatException e ) {}
                }
            }
           
            if( columnWeightData == null )
            {
                columnWeightData = new ColumnWeightData( 1, 100, true );
            }
           
            tableColumnLayout.setColumnData( tableViewerColumn.getColumn(), columnWeightData );
           
            final ColumnHandler columnHandler = createColumnHandler( this.columnHandlers, childPropertyPath, showImages, childPropertyEditorDef );
           
            showImages = false; // Only the first column should ever show the image.
           
            tableViewerColumn.setLabelProvider( columnHandler.getLabelProvider() );
            tableViewerColumn.setEditingSupport( columnHandler.getEditingSupport() );
           
            final TableColumn tableColumn = tableViewerColumn.getColumn();
           
            tableColumn.addSelectionListener
            (
                new SelectionAdapter()
                {
                    @Override
                    public void widgetSelected( final SelectionEvent event )
                    {
                        final TableColumn currentSortColumn = TablePropertyEditorPresentation.this.table.getSortColumn();
                       
                        if( currentSortColumn != tableColumn )
                        {
                            TablePropertyEditorPresentation.this.table.setSortColumn( tableColumn );
                            TablePropertyEditorPresentation.this.table.setSortDirection( SWT.DOWN );
                            TablePropertyEditorPresentation.this.tableViewer.setComparator( new TableSorter( columnHandler, SWT.DOWN ) );
                        }
                        else
                        {
                            final int currentSortDirection = TablePropertyEditorPresentation.this.table.getSortDirection();
                           
                            if( currentSortDirection == SWT.DOWN )
                            {
                                TablePropertyEditorPresentation.this.table.setSortDirection( SWT.UP );
                                TablePropertyEditorPresentation.this.tableViewer.setComparator( new TableSorter( columnHandler, SWT.UP ) );
                            }
                            else
                            {
                                TablePropertyEditorPresentation.this.table.setSortColumn( null );
                                TablePropertyEditorPresentation.this.tableViewer.setComparator( null );
                            }
                        }
                       
                        for( SapphireAction action : actions.getActions() )
                        {
                            for( SapphireActionHandler handler : action.getActiveHandlers() )
                            {
                                if( handler instanceof PropertyEditorActionHandler )
                                {
                                    ( (PropertyEditorActionHandler) handler ).refreshEnablementState();
                                }
                            }
                        }
                    }
                }
            );
        }
       
        final IStructuredContentProvider contentProvider = new IStructuredContentProvider()
        {
            public Object[] getElements( final Object inputElement )
            {
                final ElementList<?> list = property();
                final Map<Element,TableRow> rows = new LinkedHashMap<Element,TableRow>();
               
                for( Element element : list )
                {
                    TableRow row = null;
                   
                    if( TablePropertyEditorPresentation.this.rows != null )
                    {
                        row = TablePropertyEditorPresentation.this.rows.remove( element );
                    }
                   
                    if( row == null )
                    {
                        ImageProvider imageProvider = null;
                       
                        final ImageService imageService = element.service( ImageService.class );
                       
                        if( imageService != null )
                        {
                            imageProvider = new ImageProvider()
                            {
                                private Listener imageServiceListener;
                               
                                @Override
                                public ImageData image()
                                {
                                    if( this.imageServiceListener == null )
                                    {
                                        this.imageServiceListener = new Listener()
                                        {
                                            @Override
                                            public void handle( final Event event )
                                            {
                                                update( row() );
View Full Code Here

       
        button.setEnabled( part.enabled() );
       
        attachPartListener
        (
            new Listener()
            {
                @Override
                public void handle( final Event event )
                {
                    if( event instanceof EnablementChangedEvent )
View Full Code Here

            @Override
            protected void init()
            {
                super.init();
               
                this.lastPropertyValueListener = new Listener()
                {
                    @Override
                    public void handle( final Event event )
                    {
                        refresh();
View Full Code Here

                addImage( typeSpecificAddImage );
            }
           
            this.contentTree = ( (MasterDetailsContentNodePart) getPart() ).getContentTree();
           
            final Listener contentTreeListener = new Listener()
            {
                @Override
                public void handle( final Event event )
                {
                    if( event instanceof MasterDetailsContentOutline.FilterChangedEvent )
                    {
                        refreshEnablementState();
                    }
                }
            };
           
            this.contentTree.attach( contentTreeListener );
           
            refreshEnablementState();
           
            attach
            (
                new Listener()
                {
                    @Override
                    public void handle( final Event event )
                    {
                        if( event instanceof DisposeEvent )
View Full Code Here

                    SapphireTextCellEditor.this.isDefaultValue = false;
                }
            }
        );
       
        final Listener actionHandlerListener = new Listener()
        {
            @Override
            public void handle( final Event event )
            {
                handleActionHandlerEvent( event );
View Full Code Here

                    }
                };
               
                action.attach
                (
                    new Listener()
                    {
                        @Override
                        public void handle( final Event event )
                        {
                            if( event instanceof EnablementChangedEvent )
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Listener

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.