~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/SVNProjectCreatedCondition.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.core.resources.IProject;
 
11
import org.eclipse.core.resources.IWorkspaceRoot;
 
12
import org.eclipse.core.resources.ResourcesPlugin;
 
13
import org.eclipse.core.runtime.Path;
 
14
import org.eclipse.swtbot.swt.finder.SWTBot;
 
15
import org.eclipse.swtbot.swt.finder.waits.ICondition;
 
16
 
 
17
/**
 
18
 * Condition returns true if and only if a project with
 
19
 * name <code>projectName</code> exists in the current
 
20
 * workspace.
 
21
 *
 
22
 */
 
23
public class SVNProjectCreatedCondition implements ICondition {
 
24
 
 
25
        private String projectName;
 
26
        
 
27
        public SVNProjectCreatedCondition(String projectName) {
 
28
                this.projectName = projectName;
 
29
        }
 
30
        
 
31
        public boolean test() throws Exception {
 
32
                IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
 
33
                IProject project = (IProject)wsRoot.findMember(new Path(projectName));
 
34
                if (project == null)
 
35
                        return false;
 
36
                else
 
37
                        return true;
 
38
        }
 
39
 
 
40
        public void init(SWTBot bot) {
 
41
                // no initialization; don't need bot
 
42
        }
 
43
 
 
44
        public String getFailureMessage() {
 
45
                return null;
 
46
        }
 
47
 
 
48
}