Search in sources :

Example 11 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project xtext-xtend by eclipse.

the class SwtBotProjectHelper method clearSourceFolderContents.

public static void clearSourceFolderContents(final SWTWorkbenchBot it, final String project) {
    try {
        try {
            SWTBotTree packageExplorerTree = it.tree();
            boolean _hasItems = it.tree().hasItems();
            boolean _not = (!_hasItems);
            if (_not) {
                packageExplorerTree = it.viewByTitle("Package Explorer").bot().tree();
            }
            final SWTBotTreeItem srcNode = SwtBotProjectHelper.expandNode(SwtBotProjectHelper.expandNode(packageExplorerTree, project), "src");
            SWTBotTreeItem[] _items = srcNode.getItems();
            for (final SWTBotTreeItem source : _items) {
                boolean _isDisposed = source.widget.isDisposed();
                boolean _not_1 = (!_isDisposed);
                if (_not_1) {
                    InputOutput.<SWTBotText>println(it.text());
                    srcNode.select(source.getText());
                    source.contextMenu("Delete").click();
                    it.shell("Delete").activate();
                    it.button("OK").click();
                }
            }
        } catch (final Throwable _t) {
            if (_t instanceof WidgetNotFoundException) {
                final Consumer<IResource> _function = (IResource it_1) -> {
                    try {
                        it_1.delete(true, null);
                    } catch (Throwable _e) {
                        throw Exceptions.sneakyThrow(_e);
                    }
                };
                ((List<IResource>) Conversions.doWrapArray(ResourcesPlugin.getWorkspace().getRoot().getProject(project).getFolder("src").members())).forEach(_function);
            } else {
                throw Exceptions.sneakyThrow(_t);
            }
        }
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) Consumer(java.util.function.Consumer) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) IResource(org.eclipse.core.resources.IResource)

Example 12 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.

the class ImagePushSWTBotTests method openPushWizard.

private void openPushWizard() {
    SWTUtils.syncExec(() -> dockerExplorerView.getCommonViewer().expandAll());
    final SWTBotTreeItem imageTreeItem = SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images", "foo/bar");
    // when opening the "Push Image..." wizard
    final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
    dockerExplorerViewTreeBot.select(imageTreeItem);
    SWTUtils.getContextMenu(dockerExplorerViewTreeBot, "Push...").click();
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Example 13 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.

the class SVNReporsitoriesView method discardRepository.

/**
 * 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);
    // discard
    clickOnDiscardRepo(tree);
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)

Example 14 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.

the class PreferencesTest method testProfileProjectActions.

private void testProfileProjectActions(SWTWorkbenchBot bot) throws Exception {
    testPreferencesPage();
    // Focus on project explorer view.
    // $NON-NLS-1$
    SWTBotView projectExplorer = bot.viewByTitle("Project Explorer");
    projectExplorer.bot().tree().select(PROJ_NAME);
    final Shell shellWidget = bot.activeShell().widget;
    // Open profiling configurations dialog
    UIThreadRunnable.asyncExec(() -> {
        DebugUITools.openLaunchConfigurationDialogOnGroup(shellWidget, (StructuredSelection) PlatformUI.getWorkbench().getWorkbenchWindows()[0].getSelectionService().getSelection(), // $NON-NLS-1$
        "org.eclipse.debug.ui.launchGroup.profilee");
    });
    // $NON-NLS-1$
    SWTBotShell shell = bot.shell("Profiling Tools Configurations");
    shell.activate();
    // Create new profiling configuration
    SWTBotTree profilingConfigs = bot.tree();
    // $NON-NLS-1$
    SWTBotTree perfNode = profilingConfigs.select("Profile Timing");
    // $NON-NLS-1$
    perfNode.contextMenu("New").click();
    // $NON-NLS-1$
    bot.button("Profile").click();
    bot.waitUntil(Conditions.shellCloses(shell));
    // Assert that the expected tool is running.
    // $NON-NLS-1$
    SWTBotShell profileShell = bot.shell("Successful profile launch").activate();
    assertNotNull(profileShell);
    // $NON-NLS-1$
    bot.button("Apply and Close").click();
    bot.waitUntil(shellCloses(profileShell));
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Shell(org.eclipse.swt.widgets.Shell) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 15 with SWTBotTree

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.

the class TestUtils method openPropertyPage.

/**
 * Open the property page, and activate its shell.
 */
public static SWTBotShell openPropertyPage(SWTWorkbenchBot bot, SWTBotView navigator) {
    navigator.show();
    // select the .repo file from the package explorer and open its properties
    SWTBotTree botTree = navigator.bot().tree();
    botTree.select(ICreaterepoTestConstants.REPO_NAME).contextMenu(ICreaterepoTestConstants.PROPERTIES).click();
    // get a handle of the property shell
    SWTBotShell propertyShell = bot.shell(String.format(ICreaterepoTestConstants.PROPERTIES_SHELL, ICreaterepoTestConstants.REPO_NAME));
    propertyShell.activate();
    return propertyShell;
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Aggregations

SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)18 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)7 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)7 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)3 Test (org.junit.Test)3 DockerClient (com.spotify.docker.client.DockerClient)2 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)2 Shell (org.eclipse.swt.widgets.Shell)2 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 Consumer (java.util.function.Consumer)1 ConfirmProjectDeleteDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog)1 ProgressDialog (net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog)1 ProjectTreeView (net.heartsome.cat.ts.test.ui.views.ProjectTreeView)1 IResource (org.eclipse.core.resources.IResource)1 Composite (org.eclipse.swt.widgets.Composite)1 Tree (org.eclipse.swt.widgets.Tree)1 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)1 SWTBotMultiPageEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor)1 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)1