Coverage Report - org.eclipse.swtbot.swt.finder.waits.WaitForMenu
 
Classes in this File Line Coverage Branch Coverage Complexity
WaitForMenu
100%
5/5
N/A
1
 
 1  
 /*******************************************************************************
 2  
  * Copyright (c) 2008 Ketan Padegaonkar and others.
 3  
  * All rights reserved. This program and the accompanying materials
 4  
  * are made available under the terms of the Eclipse Public License v1.0
 5  
  * which accompanies this distribution, and is available at
 6  
  * http://www.eclipse.org/legal/epl-v10.html
 7  
  *
 8  
  * Contributors:
 9  
  *     Ketan Padegaonkar - initial API and implementation
 10  
  *******************************************************************************/
 11  
 package org.eclipse.swtbot.swt.finder.waits;
 12  
 
 13  
 import java.util.List;
 14  
 
 15  
 import org.eclipse.swt.widgets.MenuItem;
 16  
 import org.eclipse.swtbot.swt.finder.finders.MenuFinder;
 17  
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 18  
 import org.hamcrest.Matcher;
 19  
 
 20  
 /**
 21  
  * Condition that waits for a shell with the specified text to appear.
 22  
  *
 23  
  * @see Conditions
 24  
  * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
 25  
  * @version $Id$
 26  
  */
 27  
 class WaitForMenu extends WaitForObjectCondition<MenuItem> {
 28  
 
 29  
         private final SWTBotShell        shell;
 30  
 
 31  
         /**
 32  
          * @param shell the shell to search for the menu.
 33  
          * @param matcher the matcher used for matching the menu items.
 34  
          */
 35  
         public WaitForMenu(SWTBotShell shell, Matcher<MenuItem> matcher) {
 36  5
                 super(matcher);
 37  5
                 this.shell = shell;
 38  5
         }
 39  
 
 40  
         public String getFailureMessage() {
 41  2
                 return "Could not find a menu within the shell '" + shell + "' matching '" + matcher + "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 42  
         }
 43  
 
 44  
         protected List<MenuItem> findMatches() {
 45  23
                 return new MenuFinder().findMenus(shell.widget, matcher, true);
 46  
         }
 47  
 
 48  
 }