Package code.satyagraha.gfm.viewer.bots

Source Code of code.satyagraha.gfm.viewer.bots.PreferencesBot

package code.satyagraha.gfm.viewer.bots;

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

public class PreferencesBot {

    private final static SWTWorkbenchBot bot = new SWTWorkbenchBot();
   
    private SWTBotShell botShell;

    public static PreferencesBot activateFromWorkbench() {
        bot.menu("Window").menu("Preferences").click();
        return fromActivatedPreferences();
    }
   
    static PreferencesBot fromActivatedPreferences() {
        SWTBotShell botShell = bot.shell("Preferences");
        botShell.activate();
        return new PreferencesBot(botShell);
    }

    public PreferencesBot(SWTBotShell botShell) {
        this.botShell = botShell;
    }
   
    public void setApiUrl(String apiUrl) {
        botShell.bot().tree().getTreeItem("GFM Viewer").select().click();
        botShell.bot().textWithLabel("API URL:").setText(apiUrl);
        botShell.bot().button("Apply").click();
        botShell.bot().button("OK").click();
    }

    public void cancel() {
        botShell.bot().button("Cancel").click();
    }

}
TOP

Related Classes of code.satyagraha.gfm.viewer.bots.PreferencesBot

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.