I can't find any method for making a tab invisible or otherwise hidden in an SWT/JFace application --- I want a second tab to be available (or not) based on some other preferences set by the user.
It shouldn't be so hard to figure this out!
I can't find any method for making a tab invisible or otherwise hidden in an SWT/JFace application --- I want a second tab to be available (or not) based on some other preferences set by the user.
It shouldn't be so hard to figure this out!
The only way that I know of is to dispose the CTabItem for the tab you want to hide and then create a new CTabItem when you want to show it. Sort of,
CTabFolder folder = new CTabFolder(parent, SWT.NONE);
Label label = new Label(folder, SWT.NONE);
label.setText("Hello");
CTabItem item = new CTabItem(folder);
item.setControl(label);
// Hide it
item.dipose();
// show it again
CTabItem item = new CTabItem(folder);
item.setControl(label);
If you want to hide a tab in the middle you'll need to recreate all the tabs after the one you disposed.. It's probably easiest if you create a class that holds the control and a field that can be used to toggle the visibility. Then you can just dipose all the CTabItems and recreate iff the visibility field is true.