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

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


   * @return the {@link IMenuItemInfo}'s of given {@link MenuBarInfo}.
   */
  public static List<IMenuItemInfo> getItems(MenuBarInfo container) {
    List<IMenuItemInfo> items = Lists.newArrayList();
    for (MenuBarItemInfo item : container.getItems()) {
      IMenuItemInfo itemObject = getMenuItem(item);
      if (itemObject != null) {
        items.add(itemObject);
      }
    }
    return items;
View Full Code Here


   * @return the {@link IMenuItemInfo}'s of given {@link MenuInfo}.
   */
  public static List<IMenuItemInfo> getItems(MenuInfo container) {
    List<IMenuItemInfo> items = Lists.newArrayList();
    for (ComponentInfo item : container.getItems()) {
      IMenuItemInfo itemObject = getMenuItem(item);
      if (itemObject != null) {
        items.add(itemObject);
      }
    }
    return items;
View Full Code Here

  /**
   * @return the {@link IMenuItemInfo} wrapper for given {@link Object}.
   */
  public static IMenuItemInfo getMenuItem(ComponentInfo component) {
    {
      IMenuItemInfo item = MenuObjectInfoUtils.getMenuItemInfo(component);
      if (item != null) {
        return item;
      }
    }
    {
      IMenuItemInfo item = (IMenuItemInfo) component.getArbitraryValue(KEY_MENU_UTILS_ITEM);
      if (item == null) {
        item = new ComponentMenuItemInfo(component);
        component.putArbitraryValue(KEY_MENU_UTILS_ITEM, item);
      }
      return item;
View Full Code Here

  /**
   * Sets {@link ComponentInfo} which is menu item and should be selected (and expanded) during
   * refresh.
   */
  public static void setSelectingItem(ComponentInfo component) {
    IMenuItemInfo item = getMenuItem(component);
    MenuObjectInfoUtils.setSelectingObject(item);
  }
View Full Code Here

    }

    public List<IMenuItemInfo> getItems() {
      List<IMenuItemInfo> items = Lists.newArrayList();
      for (ObjectInfo object : getAllItems()) {
        IMenuItemInfo item = MenuObjectInfoUtils.getMenuItemInfo(object);
        items.add(item);
      }
      return items;
    }
View Full Code Here

    }

    public List<IMenuItemInfo> getItems() {
      List<IMenuItemInfo> items = Lists.newArrayList();
      for (ObjectInfo object : getAllItems()) {
        IMenuItemInfo item = MenuObjectInfoUtils.getMenuItemInfo(object);
        items.add(item);
      }
      return items;
    }
View Full Code Here

    MenuItemSeparatorInfo separator = getObjectByName("separator");
    // only separator in "bar"
    assertThat(bar.getAllItems()).containsOnly(separator);
    // IMenuItemInfo
    {
      IMenuItemInfo separatorObject;
      {
        IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
        List<IMenuItemInfo> items = barObject.getItems();
        assertThat(items).hasSize(1);
        separatorObject = items.get(0);
      }
      // ask IMenuItemInfo directly
      assertNull(separator.getAdapter(List.class));
      assertSame(separatorObject, MenuObjectInfoUtils.getMenuItemInfo(separator));
      // model
      assertSame(separator, separatorObject.getModel());
      assertSame(separator, separatorObject.getToolkitModel());
      // presentation
      assertNull(separatorObject.getImage());
      assertNotNull(separatorObject.getBounds());
      // access
      assertNull(separatorObject.getMenu());
      assertSame(IMenuPolicy.NOOP, separatorObject.getPolicy());
    }
  }
View Full Code Here

      {
        List<IMenuItemInfo> itemObjects = menuObject.getItems();
        assertThat(itemObjects).hasSize(2);
        // "Sub" item
        {
          IMenuItemInfo itemObject = itemObjects.get(0);
          assertSame(item_1, itemObject.getModel());
          // presentation
          {
            // items don't have screen shot, we show them on menu shots
            assertNull(itemObject.getImage());
            // reasonable bounds
            {
              Rectangle bounds = itemObject.getBounds();
              assertThat(bounds.x).isEqualTo(2);
              assertThat(bounds.y).isEqualTo(2);
              assertThat(bounds.width).isGreaterThan(30);
              assertThat(bounds.height).isGreaterThan(20);
            }
          }
          // sub-menu
          {
            IMenuInfo subMenuObject = itemObject.getMenu();
            assertSame(subMenu, subMenuObject.getModel());
            // access
            assertFalse(subMenuObject.isHorizontal());
            {
              List<IMenuItemInfo> subMenuItemObjects = subMenuObject.getItems();
              assertThat(subMenuItemObjects).hasSize(2);
              assertSame(subMenuItem_1, subMenuItemObjects.get(0).getModel());
              assertSame(subMenuItem_2, subMenuItemObjects.get(1).getModel());
            }
            // presentation
            assertNotNull(subMenuObject.getImage());
            {
              Rectangle bounds = subMenuObject.getBounds();
              assertThat(bounds.width).isGreaterThan(85);
              assertThat(bounds.height).isGreaterThan(45);
            }
          }
        }
        // "Separate item"
        {
          IMenuItemInfo itemObject = itemObjects.get(1);
          assertSame(item_2, itemObject.getModel());
          // no sub-menu
          assertNull(itemObject.getMenu());
          // no policy
          assertSame(IMenuPolicy.NOOP, itemObject.getPolicy());
        }
      }
    }
  }
View Full Code Here

    assertNotNull(subMenu);
    // prepare object for "subMenu"
    IMenuInfo subMenuObject;
    {
      IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
      IMenuItemInfo itemObject = menuObject.getItems().get(0);
      subMenuObject = itemObject.getMenu();
    }
    // check
    assertNotNull(subMenuObject);
    assertSame(subMenu, subMenuObject.getModel());
    {
View Full Code Here

    assertInstanceOf(InvocationChildAssociation.class, separator.getAssociation());
    // only item in "bar"
    assertThat(bar.getAllItems()).containsOnly(separator);
    // IMenuItemInfo
    {
      IMenuItemInfo separatorObject;
      {
        IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
        List<IMenuItemInfo> items = barObject.getItems();
        assertThat(items).hasSize(1);
        separatorObject = items.get(0);
      }
      // ask IMenuItemInfo directly
      assertNull(separator.getAdapter(List.class));
      assertSame(separatorObject, MenuObjectInfoUtils.getMenuItemInfo(separator));
      // model
      assertSame(separator, separatorObject.getModel());
      assertSame(separator, separatorObject.getToolkitModel());
      // presentation
      assertNull(separatorObject.getImage());
      assertNotNull(separatorObject.getBounds());
      // access
      assertNull(separatorObject.getMenu());
      assertSame(IMenuPolicy.NOOP, separatorObject.getPolicy());
    }
  }
View Full Code Here

TOP

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

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.