Search in sources :

Example 1 with ObserveType

use of org.eclipse.wb.internal.core.databinding.ui.ObserveType in project windowbuilder by eclipse.

the class DatabindingsProviderTest method test_common.

// //////////////////////////////////////////////////////////////////////////
// 
// Tests
// 
// //////////////////////////////////////////////////////////////////////////
public void test_common() throws Exception {
    CompositeInfo shell = parseComposite("public class Test {", "  protected Shell m_shell;", "  public static void main(String[] args) {", "    Test test = new Test();", "    test.open();", "  }", "  public void open() {", "    Display display = new Display();", "    createContents();", "    m_shell.open();", "    m_shell.layout();", "    while (!m_shell.isDisposed()) {", "      if (!display.readAndDispatch()) {", "        display.sleep();", "      }", "    }", "  }", "  protected void createContents() {", "    m_shell = new Shell();", "  }", "}");
    assertNotNull(shell);
    // 
    DatabindingsProvider provider = getDatabindingsProvider();
    // 
    assertNotNull(provider.getRootInfo());
    assertNull(provider.getRootInfo().getInitDataBindings());
    assertNotNull(provider.getRootInfo().getContextInfo());
    assertNotNull(provider.getRootInfo().getContextInfo().getBindings());
    assertTrue(provider.getRootInfo().getContextInfo().getBindings().isEmpty());
    assertNull(provider.getRootInfo().getContextInfo().getVariableIdentifier());
    // 
    List<ObserveType> types = provider.getTypes();
    assertEquals(2, types.size());
    // 
    assertSame(ObserveType.BEANS, types.get(0));
    assertSame(ObserveType.BEANS, provider.getModelStartType());
    // 
    assertSame(ObserveType.WIDGETS, types.get(1));
    assertSame(ObserveType.WIDGETS, provider.getTargetStartType());
    // 
    List<ObserveTypeContainer> containers = provider.getContainers();
    assertEquals(2, containers.size());
    // 
    assertSame(ObserveType.BEANS, containers.get(0).getObserveType());
    assertSame(containers.get(0), provider.getContainer(ObserveType.BEANS));
    assertTrue(containers.get(0).isModelStartType());
    assertFalse(containers.get(0).isTargetStartType());
    // 
    assertSame(ObserveType.WIDGETS, containers.get(1).getObserveType());
    assertSame(containers.get(1), provider.getContainer(ObserveType.WIDGETS));
    assertFalse(containers.get(1).isModelStartType());
    assertTrue(containers.get(1).isTargetStartType());
}
Also used : DatabindingsProvider(org.eclipse.wb.internal.rcp.databinding.DatabindingsProvider) ObserveType(org.eclipse.wb.internal.core.databinding.ui.ObserveType) ObserveTypeContainer(org.eclipse.wb.internal.core.databinding.model.ObserveTypeContainer) BeansObserveTypeContainer(org.eclipse.wb.internal.rcp.databinding.model.beans.BeansObserveTypeContainer) CompositeInfo(org.eclipse.wb.internal.swt.model.widgets.CompositeInfo)

Aggregations

ObserveTypeContainer (org.eclipse.wb.internal.core.databinding.model.ObserveTypeContainer)1 ObserveType (org.eclipse.wb.internal.core.databinding.ui.ObserveType)1 DatabindingsProvider (org.eclipse.wb.internal.rcp.databinding.DatabindingsProvider)1 BeansObserveTypeContainer (org.eclipse.wb.internal.rcp.databinding.model.beans.BeansObserveTypeContainer)1 CompositeInfo (org.eclipse.wb.internal.swt.model.widgets.CompositeInfo)1