How to get destination tab in SelectedTabChangeListener?

Hi,

I’m actually working on a view who contain a TabSheet, and one of business rules are to prevent the closing of the first tab.

For this, I have actually :

tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {
            
            /**
             * serialVersionUID
             */
            private static final long serialVersionUID = 5205515013224167173L;
            
            @Override
            public void selectedTabChange(SelectedTabChangeEvent event) {
                int destinationTabIndex
                    = event.getTabSheet().getTabPosition(event.getTabSheet().getTab(event.getTabSheet().getSelectedTab()));
                deleteButton.setEnabled(!(destinationTabIndex == 0));
            }
        });

Is there a simpler solution than

event.getTabSheet().getTabPosition(event.getTabSheet().getTab(event.getTabSheet().getSelectedTab())) to get the destination tab’s position?

I don’t think so, but thanks for helping me figure out which was the selected tab. :slight_smile: event.getSource(), event.getComponent() and event.getTabsheet() all return the same thing (the tabsheet, not the tab) which is a bit confusing.