Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346224

Summary: [SWT_AWT] embed jface viewer inside swing UI
Product: [Eclipse Project] Platform Reporter: amit <devpamit>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, pwebster, remy.suen
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description amit CLA 2011-05-18 07:57:52 EDT
Build Identifier: 3.5

I am trying to embed jface treeviewer inside a jpanel using swt awt bridge. I don't see the tree being displayed in the panel. When i add a SWT button it works. Is this possible? 

Reproducible: Always
Comment 1 Felipe Heidrich CLA 2011-05-18 09:48:37 EDT
can you please add a simple test scase that shows the problem ?
Comment 2 amit CLA 2011-05-19 00:58:15 EDT
Following is sample code snippate. I have not added code for content provider and label provider. It don't show tree in the UI. If we add SWT button it works.        

        final Canvas c = new Canvas();
        c.setBounds( 10, 10, 200, 200 );
        c.setBackground( Color.GRAY );

        JPanel listPanel = new JPanel( new GridLayout( 2, 1 ));
        parentFrame.add( listPanel );
        listPanel.add( c );
        listPanel.setVisible( true );
        parentFrame.setVisible( true );
        final Display d = Display.getDefault();
        d.asyncExec( new Runnable(){

            @Override
            public void run()
            {
                Shell s = SWT_AWT.new_Shell( d, c );
                TCComponent folder = null;
                s.setBackground( new org.eclipse.swt.graphics.Color( null, 100, 0, 50 ) );
                s.setSize( 100, 100 );
                s.setText( "A MessageBox Example" );

                Composite mainSwtPanel = new Composite( s, SWT.BORDER );

                TreeViewer tree = new TreeViewer( mainSwtPanel );
                /* you can add your own content provider here */
                tree.setContentProvider( new MyContentProvider() );
                tree.setLabelProvider( new MyLabelProvider() );
                tree.setInput( object );
            }

        } );
Comment 3 Lars Vogel CLA 2019-11-14 02:19:49 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.