Package org.eclipse.wb.tests.gef

Examples of org.eclipse.wb.tests.gef.UiContext


  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  @DisposeProjectAfter
  public void test_0() throws Exception {
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        TestUtils.runWizard(new PopupPanelWizard(), new StructuredSelection(m_packageFragment));
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here


    //
    final Property property = PropertyUtils.getByPath(button, "Events/onClick");
    assertTrue(property.isModified());
    assertEquals("someMethod", getPropertyText(property));
    // do remove
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        property.setValue(Property.UNKNOWN_VALUE);
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

    // create dialog
    final AlignStringPropertyEditor.AlignDialog dialog =
        new AlignStringPropertyEditor.AlignDialog(new Shell());
    dialog.setValue("tl?-br");
    // check state
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        dialog.open();
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

    Figure panelFigure = panelEditPart.getFigure();
    // no device yet
    assertEquals(new Rectangle(20, 20, 450, 300), panelFigure.getBounds());
    // set device
    {
      UiContext context = new UiContext();
      // click ToolItem to open Menu
      ToolItem deviceToolItem = context.getToolItem("No device");
      context.click(deviceToolItem, SWT.ARROW);
      // click "device" MenuItem
      {
        Menu menu = (Menu) deviceToolItem.getData("designTimeMenu");
        MenuItem menuItem = context.getMenuItem(menu, "QVGA");
        context.click(menuItem);
      }
    }
    // new bounds
    assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
    // flip orientation
    {
      UiContext context = new UiContext();
      ToolItem deviceToolItem = context.getToolItem("Flip orientation");
      // PORTRAIT -> LANDSCAPE
      context.click(deviceToolItem);
      assertEquals(new Rectangle(25, 25, 320, 240), panelFigure.getBounds());
      // LANDSCAPE -> PORTRAIT
      context.click(deviceToolItem);
      assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
    }
  }
View Full Code Here

    animateDialog(property);
    assertEquals("2.png", result[0]);
  }

  private static void animateDialog(final Property property) throws Exception {
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        openPropertyDialog(property);
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

    WidgetInfo button = getObjectByName("button");
    assertNotNull(button);
    // prepare action
    final IAction action = getExposeAction(button, "text");
    // animate
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        action.run();
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

      // activate
      propertyTable.setInput(new Property[]{property});
      propertyTable.setActiveProperty(property);
      propertyTable.activateEditor(property, null);
      // open dialog and use "Cancel"
      new UiContext().executeAndCheck(new UIRunnable() {
        public void run(UiContext context) throws Exception {
          openCssStyleEditorDialog(propertyTable, property, propertyEditor);
        }
      }, new UIRunnable() {
        public void run(UiContext context) throws Exception {
          context.useShell("CSS Style Editor");
          context.clickButton("Cancel");
        }
      });
      // open dialog and use "OK"
      new UiContext().executeAndCheck(new UIRunnable() {
        public void run(UiContext context) throws Exception {
          openCssStyleEditorDialog(propertyTable, property, propertyEditor);
        }
      }, new UIRunnable() {
        public void run(UiContext context) throws Exception {
          context.useShell("CSS Style Editor");
          context.clickButton("OK");
        }
      });
      assertEditor(getStyleSource(null));
      // open dialog and use "Apply"
      new UiContext().executeAndCheck(new UIRunnable() {
        public void run(UiContext context) throws Exception {
          openCssStyleEditorDialog(propertyTable, property, propertyEditor);
        }
      }, new UIRunnable() {
        public void run(UiContext context) throws Exception {
View Full Code Here

    property.setValue("red");
    assertEquals("red", getPropertyText(property));
    callPaint(property);
    assertEquals(getSource(".style {", "  color: red;", "}"), getFileContent(styleFile));
    // animate dialog
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        PropertyEditorPresentation presentation = property.getEditor().getPresentation();
        ReflectionUtils.invokeMethod(
            presentation,
            "onClick(org.eclipse.wb.internal.core.model.property.table.PropertyTable,"
View Full Code Here

        "  }",
        "}");
    assertTrue(property.isModified());
    assertEquals("(1, 2, 3, 4)", getPropertyText(property));
    // remove value using editor
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        openPropertyDialog(property);
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
        context.useShell("margins");
        // check existing values
        assertEquals(1, getSpinnerValue(context, "Top:"));
        assertEquals(2, getSpinnerValue(context, "Right:"));
        assertEquals(3, getSpinnerValue(context, "Bottom:"));
        assertEquals(4, getSpinnerValue(context, "Left:"));
        // reset to default
        context.clickButton("Default");
      }

      private int getSpinnerValue(UiContext context, String text) {
        Control control = context.getControlAfterLabel(text);
        CSpinner spinner = (CSpinner) control;
        return spinner.getSelection();
      }
    });
    assertEditor(
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    FlowLayout flowLayout = new FlowLayout();",
        "    setLayout(flowLayout);",
        "  }",
        "}");
    assertFalse(property.isModified());
    assertEquals(null, getPropertyText(property));
    // set value using editor
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        openPropertyDialog(property);
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

    animateDialog(property);
    assertEquals("2.png", result[0]);
  }

  private static void animateDialog(final Property property) throws Exception {
    new UiContext().executeAndCheck(new UIRunnable() {
      public void run(UiContext context) throws Exception {
        openPropertyDialog(property);
      }
    }, new UIRunnable() {
      public void run(UiContext context) throws Exception {
View Full Code Here

TOP

Related Classes of org.eclipse.wb.tests.gef.UiContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.