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

  • Home
  • SEARCH
  • 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 6151313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:45:10+00:00 2026-05-23T19:45:10+00:00

In my RCP app, I have a tab folder widget. Each of the tab

  • 0

In my RCP app, I have a tab folder widget. Each of the tab items in the tab folder widget holds a single table. The tab items (represent name of a specific hall) are dynamic and whenever a tab item is created dynamically, a table is created to be displayed within that tab item. The tab items are being dynamically created along with the table (and the table’s content too) for each item in the tab folder.

Now when I try to retrieve the user selected values in the table in the first (or any other tab except the last one), I’m not able to get the values. I am able to retrieve and manipulate
the table in the last tab item only. It seems like the preceding tables in the preceding tab items are replaced/overlapped by the new tables that are created dynamically later on. How do I solve this?

For Instance,

//createPartControl method
public void createPartControl(Composite parent) {
    .....
    .....    

    createTabFolder();
}


// createTabFolder() method
private void createTabFolder() {

tabFolder = new CTabFolder(comMainContainer, SWT.BORDER);
tabFolder.setBounds(204, 21, 769, 495);
    tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(
            SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));

    // display the tabitems in the tabfolder dynamically
    try {
        selectedDate = sdf.format(dateChooser.getSelectedDate());
        rs = objHallBookingController.getHallList();

        while (rs.next()) {

            displayCtabItems(rs.getString("hall_name"),
                    rs.getInt("hall_id"));
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}


// displayCtabItems method
private void displayCtabItems(String hallName, int hallId) {

            tabItem = new CTabItem(tabFolder, SWT.NONE);
    tabItem.setText(hallName);

    comTabItem = new Composite(tabFolder, SWT.NONE);
    tabItem.setControl(comTabItem);


    tblHallBooking = new Table(comTabItem, SWT.BORDER | SWT.FULL_SELECTION);
    tblHallBooking.setHeaderVisible(true);
    tblHallBooking.setLinesVisible(true);

    tblclmnTime = new TableColumn(tblHallBooking[hallId], SWT.NONE);
    tblclmnTime.setWidth(88);
    tblclmnTime.setText("Time");

    tblclmnTitle = new TableColumn(tblHallBooking[hallId], SWT.NONE);
    tblclmnTitle.setWidth(306);
    tblclmnTitle.setText("Title");

            // display contents in the table; working fine
    displayHallOpeningTime(Integer.parseInt(txtHallId.getText()));
      }

This code generates and displays the tab items and the tables. But I can’t manipulate the contents in the tables in the tab items other than the last one.

  • 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-05-23T19:45:12+00:00Added an answer on May 23, 2026 at 7:45 pm

    You call method displayCTabItems(...) more than one time (depends on rs.next())

    while (rs.next()) {
        displayCtabItems(rs.getString("hall_name"),
            rs.getInt("hall_id"));
    }
    

    but you creates the Table instance tblHallBooking = new Table(comTabItem, SWT.BORDER | SWT.FULL_SELECTION); again and again to same attribute tblHallBooking, so in first cycle will have the attribute point to instance of Table in first tab, in second cycle will point to Table on second tab, etc. In every cycle you override value (instance “pointer”) to Table on current creating tab.

    You have to make Array of tables (size of array equals size of items in list objHallBookingController.getHallList();) or you have to dynamically lookup to children of selected CTabItem and search for Table instance..

    EDIT

    Based on your comment, here could be way, how to get your table from selected CTabItem

    Control parent = tabFolder.getSelection().getControl();
    if(parent instanceof Composite) {
        Composite parentComposite = (Composite) parent;
            Control control = null;
            for(int i = 0; i < parentComposite.getChildren().length; i++) {
                if(parentComposite.getChildren()[i] instanceof Table) {
                    control = parentComposite.getChildren()[i];
                    break;
                }
            }
            if(control != null) {
            // now you have your table in control
            Table tbl = (Table) control;
            // do whatever you want with tbl
            ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Eclipse RCP app I'm working on. It has some view-specific menus
I have created an Ubuntu package to install my RCP app. The installed files
I have a plugin for an RCP app that uses BIRT. I have a
I have an RCP application based on plugins because I started this app from
I have no background in Eclipse-RCP. My understanding is that a eclipse-rcp app is
In my RCP app, I contribute several items to the main toolbar. The easy
curvy tab in eclipse 4 RCP app. Even though i am adding SHOW_TRADITIONAL_STYLE_TABS=false to
I have an Eclipse RCP app running on Java 6. When I try to
Here's a scenario: I have a java front end (RCP/SWT) app which currently has
What I have is an RCP application, and a plugin directory in it: my-rcp-app/

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.