| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| WaitForView |
|
| 1.0;1 |
| 1 | /******************************************************************************* | |
| 2 | * Copyright (c) 2008-2009 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 | * Ralf Ebert www.ralfebert.de - (bug 271630) SWTBot Improved RCP / Workbench support | |
| 11 | *******************************************************************************/ | |
| 12 | ||
| 13 | package org.eclipse.swtbot.eclipse.finder.waits; | |
| 14 | ||
| 15 | import java.util.List; | |
| 16 | ||
| 17 | import org.eclipse.swtbot.eclipse.finder.finders.WorkbenchContentsFinder; | |
| 18 | import org.eclipse.swtbot.swt.finder.waits.WaitForObjectCondition; | |
| 19 | import org.eclipse.ui.IViewReference; | |
| 20 | import org.hamcrest.Matcher; | |
| 21 | ||
| 22 | /** | |
| 23 | * Waits until a view part that matches the specified matcher appears. | |
| 24 | * | |
| 25 | * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com> | |
| 26 | * @author Ralf Ebert www.ralfebert.de (bug 271630) | |
| 27 | * @version $Id$ | |
| 28 | */ | |
| 29 | public class WaitForView extends WaitForObjectCondition<IViewReference> { | |
| 30 | ||
| 31 | /** | |
| 32 | * Creates a condition that waits until the matcher is true. | |
| 33 | * | |
| 34 | * @param matcher the matcher | |
| 35 | */ | |
| 36 | WaitForView(Matcher<IViewReference> matcher) { | |
| 37 | 22 | super(matcher); |
| 38 | 22 | } |
| 39 | ||
| 40 | public String getFailureMessage() { | |
| 41 | 4 | return "Could not find view matching: " + matcher; |
| 42 | } | |
| 43 | ||
| 44 | @Override | |
| 45 | protected List<IViewReference> findMatches() { | |
| 46 | 49 | return new WorkbenchContentsFinder().findViews(matcher); |
| 47 | } | |
| 48 | ||
| 49 | } |