Package org.eclipse.wb.internal.core.model.menu

Examples of org.eclipse.wb.internal.core.model.menu.IMenuPolicy


            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    WidgetInfo button = frame.getChildrenWidgets().get(1);
    // validate
    IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
    // Object can not be pasted (not list of memento at all)
    assertFalse(policy.validatePaste(new Object()));
    // RootPanel can not be pasted (even it memento)
    {
      JavaInfoMemento memento = JavaInfoMemento.createMemento(button);
      List<JavaInfoMemento> mementos = ImmutableList.of(memento);
      assertFalse(policy.validatePaste(mementos));
    }
  }
View Full Code Here


      JavaInfoMemento memento = JavaInfoMemento.createMemento(existingItem);
      mementos = ImmutableList.of(memento);
    }
    // paste "newItem"
    {
      IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
      // validate
      assertTrue(policy.validatePaste(mementos));
      // do paste
      List<?> pastedObjects = policy.commandPaste(mementos, null);
      assertThat(pastedObjects).hasSize(1);
      assertThat(pastedObjects.get(0)).isInstanceOf(MenuItemInfo.class);
    }
    assertEditor(
        "public class Test implements EntryPoint {",
View Full Code Here

      IMenuInfo subMenuObject_1 = MenuObjectInfoUtils.getMenuInfo(subMenu_1);
      assertFalse(subMenuObject_1.getPolicy().validateMove(bar));
    }
    // move "item_2" before "item_1"
    {
      IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
      // validate
      {
        assertFalse(policy.validateMove(new Object()));
        assertTrue(policy.validateMove(item_2));
      }
      // do move
      policy.commandMove(item_2, item_1);
    }
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
View Full Code Here

        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    MenuItemSeparatorInfo separator = getObjectByName("separator");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy barPolicy = barObject.getPolicy();
    // don't accept something other than MenuItem or MenuItemSeparator
    assertFalse(barPolicy.validateMove(new Object()));
    assertTrue(barPolicy.validateMove(separator));
    barPolicy.commandMove(separator, null);
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:FlowPanel>",
View Full Code Here

        "    <g:MenuBar wbp:name='bar'/>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy policy = barObject.getPolicy();
    // don't accept something other than MenuItem
    assertFalse(policy.validateCreate(new Object()));
    // create new MenuItem
    MenuItemInfo newItem = createObject("com.google.gwt.user.client.ui.MenuItem");
    assertTrue(policy.validateCreate(newItem));
    policy.commandCreate(newItem, null);
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:FlowPanel>",
View Full Code Here

        "  <g:FlowPanel>",
        "    <g:MenuBar wbp:name='bar'/>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
    // use "field initializer"
    {
      GenerationSettings generationSettings =
          GwtToolkitDescription.INSTANCE.getGenerationSettings();
      generationSettings.setVariable(FieldInitializerVariableDescription.INSTANCE);
    }
    // create new MenuItem
    MenuItemInfo newItem = createObject("com.google.gwt.user.client.ui.MenuItem", "withSubMenu");
    assertTrue(policy.validateCreate(newItem));
    policy.commandCreate(newItem, null);
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:FlowPanel>",
View Full Code Here

        "</ui:UiBinder>");
    refresh();
    MenuBarInfo bar = getObjectByName("bar");
    WidgetInfo button = getObjectByName("button");
    // validate
    IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
    // Object can not be pasted (not list of memento at all)
    assertFalse(policy.validatePaste(new Object()));
    // RootPanel can not be pasted (even it memento)
    {
      XmlObjectMemento memento = XmlObjectMemento.createMemento(button);
      List<XmlObjectMemento> mementos = ImmutableList.of(memento);
      assertFalse(policy.validatePaste(mementos));
    }
  }
View Full Code Here

      XmlObjectMemento memento = XmlObjectMemento.createMemento(existingItem);
      mementos = ImmutableList.of(memento);
    }
    // paste new "Item"
    {
      IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
      // validate
      assertTrue(policy.validatePaste(mementos));
      // do paste
      List<?> pastedObjects = policy.commandPaste(mementos, null);
      assertThat(pastedObjects).hasSize(1);
      assertThat(pastedObjects.get(0)).isInstanceOf(MenuItemInfo.class);
    }
    assertXML(
        "// filler filler filler filler filler",
View Full Code Here

      IMenuInfo subMenuObject_1 = MenuObjectInfoUtils.getMenuInfo(subMenu_1);
      assertFalse(subMenuObject_1.getPolicy().validateMove(bar));
    }
    // move "item_2" before "item_1"
    {
      IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
      // validate
      {
        assertFalse(policy.validateMove(new Object()));
        assertTrue(policy.validateMove(item_2));
      }
      // do move
      policy.commandMove(item_2, item_1);
    }
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
View Full Code Here

        "    <g:MenuBar wbp:name='bar'/>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy barPolicy = barObject.getPolicy();
    // don't accept something other than MenuItem or MenuItemSeparator
    assertFalse(barPolicy.validateCreate(new Object()));
    // create new MenuItemSeparator
    MenuItemSeparatorInfo newSeparator =
        createObject("com.google.gwt.user.client.ui.MenuItemSeparator");
    assertTrue(barPolicy.validateCreate(newSeparator));
    barPolicy.commandCreate(newSeparator, null);
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:FlowPanel>",
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.model.menu.IMenuPolicy

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.