Commit | Line | Data |
---|---|---|
4b451cbe MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.ui.swtbot.tests.conditions; | |
14 | ||
15 | import org.eclipse.jface.wizard.IWizardContainer; | |
16 | import org.eclipse.jface.wizard.IWizardPage; | |
17 | import org.eclipse.jface.wizard.Wizard; | |
18 | import org.eclipse.swtbot.swt.finder.SWTBot; | |
19 | import org.eclipse.swtbot.swt.finder.waits.ICondition; | |
20 | ||
21 | /** | |
22 | * Is the wizard on the page you want? | |
23 | * @author Matthew Khouzam | |
24 | */ | |
25 | class WizardOnPage implements ICondition { | |
26 | ||
27 | private final Wizard fWizard; | |
28 | private final IWizardPage fPage; | |
29 | ||
30 | public WizardOnPage(Wizard wizard, IWizardPage desiredPage) { | |
31 | fWizard = wizard; | |
32 | fPage = desiredPage; | |
33 | } | |
34 | ||
35 | @Override | |
36 | public boolean test() throws Exception { | |
37 | if (fWizard == null || fPage == null) { | |
38 | return false; | |
39 | } | |
40 | final IWizardContainer container = fWizard.getContainer(); | |
41 | if (container == null) { | |
42 | return false; | |
43 | } | |
44 | IWizardPage currentPage = container.getCurrentPage(); | |
45 | return fPage.equals(currentPage); | |
46 | } | |
47 | ||
48 | @Override | |
49 | public void init(SWTBot bot) { | |
50 | } | |
51 | ||
52 | @Override | |
53 | public String getFailureMessage() { | |
54 | return null; | |
55 | } | |
56 | ||
57 | } |