use of org.eclipse.swt.widgets.TabItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_TabFolder method test_getItemI.
@Test
public void test_getItemI() {
int number = 15;
TabItem[] items = new TabItem[number];
for (int i = 0; i < number; i++) {
items[i] = new TabItem(tabFolder, 0);
}
for (int i = 0; i < number; i++) {
assertTrue(":a:" + String.valueOf(i), tabFolder.getItem(i).equals(items[i]));
}
try {
tabFolder.getItem(number);
fail("No exception thrown for illegal index argument");
} catch (IllegalArgumentException e) {
}
try {
tabFolder.getItem(number + 1);
fail("No exception thrown for illegal index argument");
} catch (IllegalArgumentException e) {
}
try {
tabFolder.getItem(-1);
fail("No exception thrown for index == -1");
} catch (IllegalArgumentException e) {
}
}
use of org.eclipse.swt.widgets.TabItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_TabFolder method test_indexOfLorg_eclipse_swt_widgets_TabItem.
@Test
public void test_indexOfLorg_eclipse_swt_widgets_TabItem() {
int number = 10;
TabItem[] tis = new TabItem[number];
for (int i = 0; i < number; i++) {
tis[i] = new TabItem(tabFolder, 0);
}
for (int i = 0; i < number; i++) {
assertTrue(":a:" + i, tabFolder.indexOf(tis[i]) == i);
}
//
makeCleanEnvironment();
for (int i = 0; i < number; i++) {
tis[i] = new TabItem(tabFolder, 0);
}
for (int i = 0; i < number; i++) {
try {
tabFolder.indexOf(null);
fail("No exception thrown for tabItem == null");
} catch (IllegalArgumentException e) {
}
}
//
makeCleanEnvironment();
number = 20;
TabItem[] items = new TabItem[number];
for (int i = 0; i < number; i++) {
items[i] = new TabItem(tabFolder, 0);
items[i].setText(String.valueOf(i));
}
// another tabFolder
TabFolder tabFolder_2 = new TabFolder(shell, 0);
TabItem[] items_2 = new TabItem[number];
for (int i = 0; i < number; i++) {
items_2[i] = new TabItem(tabFolder_2, 0);
items_2[i].setText(String.valueOf(i));
}
for (int i = 0; i < number; i++) {
assertTrue(":a:" + String.valueOf(i), tabFolder.indexOf(items_2[i]) == -1);
}
//
TabFolder tabFolder2 = new TabFolder(shell, SWT.NULL);
TabItem tabItem = new TabItem(tabFolder2, SWT.NULL);
assertTrue(":a:", tabFolder.indexOf(tabItem) == -1);
}
use of org.eclipse.swt.widgets.TabItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_TabFolder method test_TabFolder_getChildren.
@Test
public void test_TabFolder_getChildren() {
ArrayList<Control> children = new ArrayList<>();
for (int i = 0; i < 6; i++) {
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText("TabItem " + i);
Button button = new Button(tabFolder, SWT.PUSH);
button.setText("Page " + i);
item.setControl(button);
children.add(button);
}
Label label = new Label(tabFolder, SWT.NONE);
label.setText("Unused Child");
children.add(label);
assertArrayEquals(children.toArray(), tabFolder.getChildren());
}
use of org.eclipse.swt.widgets.TabItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_TabItem method setUp.
@Override
@Before
public void setUp() {
super.setUp();
tabFolder = new TabFolder(shell, 0);
tabItem = new TabItem(tabFolder, 0);
setWidget(tabItem);
}
use of org.eclipse.swt.widgets.TabItem in project xtext-xtend by eclipse.
the class FormatterModifyDialog method addTabPageNewAPI.
// copied from Eclipse Oxygen to support old dialog in Eclipse Photon
private final void addTabPageNewAPI(String title, IModifyDialogTabPage tabPage) {
final TabItem tabItem = new TabItem(fTabFolder, SWT.NONE);
applyDialogFont(tabItem.getControl());
tabItem.setText(title);
tabItem.setData(tabPage);
tabItem.setControl(tabPage.createContents(fTabFolder));
fTabPages.add(tabPage);
}
Aggregations