I am trying to create a tab inferface for my application in SWT. I would like to setup my menu button so that when it is clicked it check to see if a tab is open. If it is open I want to switch to the tab and if it is not I want to open it. I have already created a menu item that will create the tab, but I am unsure how to check to see if the tab exists.
Asked
Active
Viewed 267 times
2 Answers
0
public static Boolean CtabExists(CTabFolder folder, CTabItem tab) {
if (tab != null) {
int intIndex = -1;
intIndex = folder.indexOf(tab);
if (intIndex == -1) {
return false;
} else {
return true;
}
} else {
return false;
}
}

Talon06
- 1,756
- 3
- 27
- 51
0
int tabItemIndex=tabFolderItem.getSelectionIndex();
if(tabItemIndex!=-1)
tabFolderItem.setSelection(tabItemIndex);
else
tabFolderItem.setSelection(value); //keep your required index in the place of value

R.Shanmukha sai
- 1
- 1
-
Okay, I am new to stack overflow, from next time i will do. Thanks for letting me know. – R.Shanmukha sai Mar 23 '17 at 06:51