Package org.eclipse.swtbot.swt.finder.finders

Examples of org.eclipse.swtbot.swt.finder.finders.EventContextMenuFinder


  public SWTBotTrayItem(TrayItem widget) throws WidgetNotFoundException {
    super(widget);
  }

  public SWTBotMenu contextMenu(String label) throws WidgetNotFoundException {
    EventContextMenuFinder finder = new EventContextMenuFinder();
    try {
      finder.register();
      notify(SWT.MenuDetect);
      Matcher<MenuItem> withMnemonic = withMnemonic(label);
      List<MenuItem> menus = finder.findMenus(withMnemonic);
      if (menus.isEmpty())
        throw new WidgetNotFoundException("Could not find a menu item");
      return new SWTBotMenu(menus.get(0));
    } finally {
      finder.unregister();
    }
  }
View Full Code Here


   * @return the menu item with the specified text
   * @throws WidgetNotFoundException if the menuItem could not be found
   * @since 1.0
   */
  public SWTBotMenu menuItem(String menuItem) throws WidgetNotFoundException {
    EventContextMenuFinder menuFinder = new EventContextMenuFinder();
    try {
      menuFinder.register();
      log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$
      assertEnabled();
      notify(SWT.MouseEnter);
      notify(SWT.MouseMove);
      notify(SWT.Activate);
      notify(SWT.FocusIn);
      notify(SWT.MouseDown);
      notify(SWT.MouseUp);
      notify(SWT.Selection, arrowEvent());
      notify(SWT.MouseHover);
      notify(SWT.MouseMove);
      notify(SWT.MouseExit);
      notify(SWT.Deactivate);
      notify(SWT.FocusOut);
      log.debug(MessageFormat.format("Clicked on {0}", this)); //$NON-NLS-1$

      Matcher<? extends Widget> matcher = withMnemonic(menuItem);
      List<?> findMenus = menuFinder.findMenus(new SWTBot().activeShell().widget, matcher, true);
      log.debug(findMenus);
      if (findMenus.isEmpty())
        throw new WidgetNotFoundException("Could not find a menu item"); //$NON-NLS-1$
      return new SWTBotMenu((MenuItem) findMenus.get(0), matcher);
    } finally {
      menuFinder.unregister();
    }
  }
View Full Code Here

  public SWTBotTrayItem(TrayItem widget) throws WidgetNotFoundException {
    super(widget);
  }

  public SWTBotMenu contextMenu(String label) throws WidgetNotFoundException {
    EventContextMenuFinder finder = new EventContextMenuFinder();
    try {
      finder.register();
      notify(SWT.MenuDetect);
      List<MenuItem> menus = finder.findMenus(withMnemonic(label));
      if (menus.isEmpty())
        throw new WidgetNotFoundException("Could not find a menu item");
      return new SWTBotMenu(menus.get(0));
    } finally {
      finder.unregister();
    }
  }
View Full Code Here

   * @param matcher the matcher
   * @return the menu items matching the matcher.
   * @throws WidgetNotFoundException if the menuItem could not be found
   */
  public List<? extends SWTBotMenu> menuItems(Matcher<MenuItem> matcher) {
    EventContextMenuFinder menuFinder = new EventContextMenuFinder();
    try {
      menuFinder.register();
      log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$
      assertEnabled();
      notify(SWT.MouseEnter);
      notify(SWT.MouseMove);
      notify(SWT.Activate);
      notify(SWT.FocusIn);
      notify(SWT.MouseDown);
      notify(SWT.MouseUp);
      notify(SWT.Selection, arrowEvent());
      notify(SWT.MouseHover);
      notify(SWT.MouseMove);
      notify(SWT.MouseExit);
      notify(SWT.Deactivate);
      notify(SWT.FocusOut);
      log.debug(MessageFormat.format("Clicked on {0}", this)); //$NON-NLS-1$
      List<MenuItem> findMenus = menuFinder.findMenus(new SWTBot().activeShell().widget, matcher, true);
      return toSWTBotMenuItems(matcher, findMenus);
    } finally {
      menuFinder.unregister();
    }
  }
View Full Code Here

   * @param matcher the matcher
   * @return the menu items matching the matcher.
   * @throws WidgetNotFoundException if the menuItem could not be found
   */
  public List<? extends SWTBotMenu> menuItems(Matcher<MenuItem> matcher) {
    EventContextMenuFinder menuFinder = new EventContextMenuFinder();
    try {
      menuFinder.register();
      log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$
      waitForEnabled();
      notify(SWT.MouseEnter);
      notify(SWT.MouseMove);
      notify(SWT.Activate);
      notify(SWT.FocusIn);
      notify(SWT.MouseDown);
      notify(SWT.MouseUp);
      notify(SWT.Selection, arrowEvent());
      notify(SWT.MouseHover);
      notify(SWT.MouseMove);
      notify(SWT.MouseExit);
      notify(SWT.Deactivate);
      notify(SWT.FocusOut);
      log.debug(MessageFormat.format("Clicked on {0}", this)); //$NON-NLS-1$
      List<MenuItem> findMenus = menuFinder.findMenus(new SWTBot().activeShell().widget, matcher, true);
      return toSWTBotMenuItems(matcher, findMenus);
    } finally {
      menuFinder.unregister();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swtbot.swt.finder.finders.EventContextMenuFinder

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.