tmf: batch import wizard smoke test
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui.swtbot.tests / src / org / eclipse / linuxtools / tmf / ui / swtbot / tests / conditions / TreeNodeAvailable.java
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.swtbot.swt.finder.SWTBot;
16 import org.eclipse.swtbot.swt.finder.waits.ICondition;
17 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
18 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
19
20 /**
21 * Is a tree node available?
22 *
23 * @author Matthew Khouzam
24 */
25 class TreeNodeAvailable implements ICondition {
26
27 private final SWTBotTree fTree;
28 private final String fName;
29
30 /**
31 * Is a tree node available
32 *
33 * @param name
34 * The name of the node
35 * @param tree
36 * the swtbotTree
37 */
38 public TreeNodeAvailable(String name, SWTBotTree tree) {
39 fTree = tree;
40 fName = name;
41 }
42
43 @Override
44 public boolean test() throws Exception {
45 try {
46 final SWTBotTreeItem[] treeItems = fTree.getAllItems();
47 for( SWTBotTreeItem ti : treeItems){
48 final String text = ti.getText();
49 if( text.equals(fName)) {
50 return true;
51 }
52 }
53 } catch (Exception e) {
54 }
55 return false;
56 }
57
58 @Override
59 public void init(SWTBot bot) {
60 }
61
62 @Override
63 public String getFailureMessage() {
64 return null;
65 }
66
67 }
This page took 0.031616 seconds and 5 git commands to generate.