public class AbstractNamespaceMasterPartUiTest extends AbstractConfigUiTestCase {
public void testCreateButtons() throws Exception {
cEditor = openFileInEditor("src/beans-config.xml");
assertNotNull("Could not open a configuration editor.", cEditor);
final AbstractConfigFormPage page = cEditor.getFormPageForUri(BeansSchemaConstants.URI);
Thread.sleep(StsTestUtil.WAIT_TIME);
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
cEditor.setActivePage(page.getId());
assertNotNull("Could not load beans page.", page.getMasterPart());
}
});
SWTBotButton newBeanButton = bot.flatButton("New Bean...");
SWTBotButton upButton = bot.flatButton("Up");
SWTBotButton downButton = bot.flatButton("Down");
assertFalse(upButton.isEnabled());
assertFalse(downButton.isEnabled());
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
TreeViewer treeViewer = (TreeViewer) page.getMasterPart().getViewer();
TreeItem root = treeViewer.getTree().getItem(0);
TreeItem beanItem = root.getItem(1);
page.setSelection(new StructuredSelection(beanItem.getData()));
}
});
assertTrue(upButton.isEnabled());
assertTrue(downButton.isEnabled());