~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to changelog/org.eclipse.linuxtools.changelog.ui.tests/src/org/eclipse/linuxtools/changelog/ui/tests/utils/TableAppearsCondition.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2010 Red Hat Inc. 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
package org.eclipse.linuxtools.changelog.ui.tests.utils;
 
9
 
 
10
import org.eclipse.swtbot.swt.finder.SWTBot;
 
11
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 
12
import org.eclipse.swtbot.swt.finder.waits.ICondition;
 
13
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 
14
 
 
15
/**
 
16
 * Condition for an appearing table (SWTBot tests).
 
17
 *
 
18
 */
 
19
public class TableAppearsCondition implements ICondition {
 
20
 
 
21
        private SWTBot bot;
 
22
        
 
23
        public boolean test() throws Exception {
 
24
                try {
 
25
                        SWTBotTable table = bot.table();
 
26
                        // table available
 
27
                        // make sure rowcount > 0
 
28
                        if (table.rowCount() > 0) {
 
29
                                return true;
 
30
                        }
 
31
                } catch (WidgetNotFoundException e) {
 
32
                        // ignore
 
33
                }
 
34
                return false;
 
35
        }
 
36
 
 
37
        public void init(SWTBot bot) {
 
38
                this.bot = bot;
 
39
        }
 
40
 
 
41
        public String getFailureMessage() {
 
42
                return null;
 
43
        }
 
44
 
 
45
}