cEditor = openFileInEditor("src/integration-config.xml");
assertNotNull("Could not open a configuration editor.", cEditor);
ConfigUiPlugin.getDefault().getPreferenceStore()
.setValue(SpringConfigPreferenceConstants.PREF_DISPLAY_TABS_DIALOG, MessageDialogWithToggle.NEVER);
AbstractConfigFormPage page = cEditor.getFormPage(NamespacesFormPage.ID);
cEditor.setActivePage(page.getId());
assertNotNull("Could not load namespaces page.", page.getMasterPart());
CheckboxTableViewer checkViewer = (CheckboxTableViewer) page.getMasterPart().getViewer();
assertNull(cEditor.getFormPageForUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForAdapterUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForUri(IntegrationSchemaConstants.URI));
CountDownLatch latch = ((NamespacesMasterPart) page.getMasterPart()).getLazyInitializationLatch();
assertTrue("Table initialization did not complete before timeout.", latch.await(30, TimeUnit.SECONDS));
StsTestUtil.waitForDisplay();
boolean foundItem = false;
List<String> uris = new ArrayList<String>();
for (TableItem item : checkViewer.getTable().getItems()) {
INamespaceDefinition def = (INamespaceDefinition) item.getData();
String currentUri = def.getNamespaceURI();
uris.add(currentUri);
if (IntStreamSchemaConstants.URI.equals(currentUri)) {
foundItem = true;
assertTrue("Expected table item " + currentUri + "to be checked.", item.getChecked());
item.setChecked(false);
((NamespacesMasterPart) page.getMasterPart()).updateDefinitionFromCheckState(def, item.getChecked());
assertNull(cEditor.getFormPageForUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForAdapterUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForUri(IntegrationSchemaConstants.URI));
item.setChecked(true);
((NamespacesMasterPart) page.getMasterPart()).updateDefinitionFromCheckState(def, item.getChecked());
assertNull(cEditor.getFormPageForUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForAdapterUri(IntStreamSchemaConstants.URI));
assertNotNull(cEditor.getFormPageForUri(IntegrationSchemaConstants.URI));
}
}