Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2342ffd83d141f5ec84658fb93b07e0e899d1a3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*******************************************************************************
 * Copyright (c) 2010, 2018 Red Hat Inc. and others.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package org.eclipse.linuxtools.changelog.ui.tests.utils;

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

/**
 * SWTBot abstraction for the SVNRepositoriesView.
 */
public class SVNReporsitoriesView {

    private SWTWorkbenchBot bot;

    public SVNReporsitoriesView(SWTWorkbenchBot bot) {
        this.bot = bot;
    }

    /**
     * Open the SVNRepositoriesView
     */
    public SVNReporsitoriesView open() {
        bot.menu("Window").menu("Show View").menu("Other...").click();
        SWTBotShell shell = bot.shell("Show View");
        shell.activate();
        bot.tree().expandNode("SVN").select("SVN Repositories");
        bot.button("OK").click();
        return this;
    }

    /**
     * Select repository
     */
    public void discardRepository(String repo) {
        SWTBotView svnRepoView = bot.viewByTitle("SVN Repositories");
        svnRepoView.show();
        svnRepoView.setFocus();
        SWTBotTree tree = svnRepoView.bot().tree();
        tree.select(repo);
        clickOnDiscardRepo(tree); // discard
    }

    /**
     * Context menu click helper. Click on "Add to existing sources".
     *
     * @param Tree of Package Explorer view.
     * @throws Exception
     */
    private void clickOnDiscardRepo(SWTBotTree svnReposTree) {
        String menuItem = "Discard location";
        ContextMenuHelper.clickContextMenu(svnReposTree, menuItem);
    }
}

Back to the top