Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:18:43+00:00 2026-06-13T01:18:43+00:00

I want to show view which contains 2 Tree Viewers and one Table Viewer

  • 0

I want to show view which contains 2 Tree Viewers and one Table Viewer.
It will look as follow,


TreeViewer1 | TreeViewer2

————-TableViewer————


(Sorry as I can’t upload the image from my machine due to some restrictions, but the above controls must fill the entire area of the view)

For this I had created one mainComposite, which will hold all the controls and which is having RowLayout with SWT.VERTICAL style.
After that I had created top composite which is going to hold TreeViewer1 and TreeViewer2, and which is having Grid layout with 2 columns.(Where each column will contain one TreeViewer resp.)
After that I had created bottom composite which is going to hold TableViewer, and which is again having grid layout with 1 column.

mainComposite holds top and bottom composite. The top and bottom composite needs to share mainComposites height equally and both composites needs to acquire entire width of mainComposite.

When I run the program, my controls are coming in order as I want.But they are not acquiring the entire width of the composite.( i.e. they are coming in left corner ).
I tried using different type of layouts but no help.

I tried with the post
http://www.programcreek.com/2012/03/eclipse-rcp-tutorial-5-how-to-layout-your-view-gridlayout-example/
but didn’t work for me since I am having table viewer and not Text.

Any help is appreciated.

Regards,
Mandar

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:18:45+00:00Added an answer on June 13, 2026 at 1:18 am

    You can get the behavior that I think you’re looking for (both trees as well as the table using all available space) by using a bunch of GridLayouts with alignments set to SWT.FILL and both grabExcess*Space parameters set to true.

    Try this:

    @Override
    public void createPartControl(Composite parent) {
        Composite container = new Composite(parent, SWT.NONE);
        GridLayout gl_container = new GridLayout(1, false);
        gl_container.horizontalSpacing = 15;
        container.setLayout(gl_container);
    
        Composite mainComposite = new Composite(container, SWT.NONE);
        mainComposite.setLayout(new GridLayout(1, false));
        mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    
        Composite treesComposite = new Composite(mainComposite, SWT.NONE);
        treesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        treesComposite.setLayout(new GridLayout(2, false));
    
        TreeViewer leftTreeViewer = new TreeViewer(treesComposite, SWT.BORDER);
        Tree leftTree = leftTreeViewer.getTree();
        leftTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    
        TreeViewer rightTreeViewer = new TreeViewer(treesComposite, SWT.BORDER);
        Tree rightTree = rightTreeViewer.getTree();
        rightTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    
        TableViewer bottomTableViewer = new TableViewer(mainComposite, SWT.BORDER | SWT.FULL_SELECTION);
        bottomTable = bottomTableViewer.getTable();
        bottomTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    }
    

    Alternatively, you could try using FormLayouts.

    Here I specify the locations of things using the “numerator/offset” approach. Where you see numbers like 0/50/100, those are essentially percentages of the available space. The smaller numbers like 5/-5 are offsets, in pixels, from the positions described by those percentages; they provide a small margin between components.

    @Override
    public void createPartControl(Composite parent) {
        Composite container = new Composite(parent, SWT.NONE);
        GridLayout gl_container = new GridLayout(1, false);
        gl_container.horizontalSpacing = 15;
        container.setLayout(gl_container);
    
        Composite mainComposite = new Composite(container, SWT.NONE);
        mainComposite.setLayout(new FormLayout());
        mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    
        Composite treesComposite = new Composite(mainComposite, SWT.NONE);
        FormData fd_treesComposite = new FormData();
        fd_treesComposite.bottom = new FormAttachment(50);
        fd_treesComposite.right = new FormAttachment(100);
        fd_treesComposite.top = new FormAttachment(0);
        fd_treesComposite.left = new FormAttachment(0);
        treesComposite.setLayoutData(fd_treesComposite);
        treesComposite.setLayout(new FormLayout());
    
        TreeViewer leftTreeViewer = new TreeViewer(treesComposite, SWT.BORDER);
        Tree leftTree = leftTreeViewer.getTree();
        FormData fd_leftTree = new FormData();
        fd_leftTree.bottom = new FormAttachment(100);
        fd_leftTree.right = new FormAttachment(50, -2);
        fd_leftTree.top = new FormAttachment(0, 5);
        fd_leftTree.left = new FormAttachment(0, 5);
        leftTree.setLayoutData(fd_leftTree);
    
        TreeViewer rightTreeViewer = new TreeViewer(treesComposite, SWT.BORDER);
        Tree rightTree = rightTreeViewer.getTree();
        FormData fd_rightTree = new FormData();
        fd_rightTree.bottom = new FormAttachment(100);
        fd_rightTree.right = new FormAttachment(100, -5);
        fd_rightTree.top = new FormAttachment(0, 5);
        fd_rightTree.left = new FormAttachment(50, 3);
        rightTree.setLayoutData(fd_rightTree);
    
        TableViewer bottomTableViewer = new TableViewer(mainComposite, SWT.BORDER | SWT.FULL_SELECTION);
        bottomTable = bottomTableViewer.getTable();
        FormData fd_bottomTable = new FormData();
        fd_bottomTable.bottom = new FormAttachment(100, -5);
        fd_bottomTable.right = new FormAttachment(100, -5);
        fd_bottomTable.top = new FormAttachment(50, 5);
        fd_bottomTable.left = new FormAttachment(0, 5);
        bottomTable.setLayoutData(fd_bottomTable);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've an application in which i want to show a list view that is
I want show annotation view (above one of my pin) after load map. For
I want to show an image view for three like on/off,if any one have
Hi all I am developing an app.I want to show a table view with
In my application , I want to show one popover view, whenever I am
I have two classes. In my first class i have table view which contains
I want to create a tree view which list down all properties in an
i want to show my view as a model view. In iPad there are
I'm developing a plug-in in Eclipse and I want to show a view. I'm
I want to show a button at the end of an Android list view.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.