Search in sources :

Example 1 with SWTBotMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu in project translationstudio8 by heartsome.

the class ProjectTreeItem method ctxMenuOpenFile.

/**
	 * 打开当前项目中的一个 XLIFF 文件
	 * @param xlfFileName
	 *            要打开的 XLIFF 文件名称
	 */
public void ctxMenuOpenFile(final String xlfFileName) {
    selectFile("XLIFF", xlfFileName);
    SWTBotMenu openFiles = ptv.ctxMenuOpenFile();
    openFiles.isEnabled();
    openFiles.click();
    SWTBotEditor editor = HSBot.bot().editorByTitle(xlfFileName);
    HSBot.bot().waitUntil(new IsEditorOpened(editor));
}
Also used : SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) IsEditorOpened(net.heartsome.test.swtbot.waits.IsEditorOpened) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)

Example 2 with SWTBotMenu

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

the class AbstractRefactoringSwtBotTest method renameInXtendEditor.

public void renameInXtendEditor(final SWTBotEclipseEditor xtendEditor, final String newName, final String dialogName) {
    final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(xtendEditor, "Refactor", "Rename Element");
    renameMenuItem.click();
    boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
    if (_isUseInlineRefactoring) {
        this.waitForLinkedMode();
        xtendEditor.typeText(newName);
        boolean _isUsePreview = this.testParams.isUsePreview();
        if (_isUsePreview) {
            xtendEditor.pressShortcut(SWT.CTRL, SWT.CR);
            AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
            AbstractRefactoringSwtBotTest.bot.button("OK").click();
        } else {
            xtendEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
        }
    } else {
        SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
        final Procedure1<SWTBot> _function = (SWTBot it) -> {
            SWTBotText _textWithLabel = it.textWithLabel("New name:");
            _textWithLabel.setText(newName);
            boolean _isUsePreview_1 = this.testParams.isUsePreview();
            if (_isUsePreview_1) {
                it.button("Preview >").click();
            }
            it.button("OK").click();
        };
        ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
    }
    this.waitForRefactoring(xtendEditor);
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText)

Example 3 with SWTBotMenu

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

the class PreferencesTest method testPreferencesPage.

@Test
public void testPreferencesPage() {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    // Set default tool for "timing" profiling.
    checkDefaultPreference(PROFILING_PREFS_CATEGORY, PROFILING_PREFS_TYPE);
    // Open preferences shell.
    // $NON-NLS-1$
    SWTBotMenu windowsMenu = bot.menu("Window");
    // $NON-NLS-1$
    windowsMenu.menu("Preferences").click();
    // $NON-NLS-1$
    SWTBotShell shell = bot.shell("Preferences");
    shell.activate();
    // Go to "Profiling Categories" preferences page.
    bot.text().setText(PROFILING_PREFS_CATEGORY);
    bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "Profiling", "Categories", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    PROFILING_PREFS_CATEGORY));
    // Get name of default tool to deselect.
    String defaultToolId = ProviderFramework.getProviderIdToRun(null, PROFILING_PREFS_TYPE);
    // $NON-NLS-1$
    String defaultToolName = ProviderFramework.getToolInformationFromId(defaultToolId, "name");
    // Workaround for BZ #344484.
    deselectSelectionByName(defaultToolName, bot);
    // Assert specified tool to select is what we expect and select it.
    SWTBotRadio stubRadio = bot.radio(STUB_LABEL);
    assertNotNull(stubRadio);
    assertEquals(STUB_TOOLTIP, stubRadio.getToolTipText());
    stubRadio.click();
    // $NON-NLS-1$
    bot.button("Apply").click();
    // $NON-NLS-1$
    bot.button("Apply and Close").click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 4 with SWTBotMenu

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

the class TestCreateSystemtapScript method openRunConfigurations.

private static void openRunConfigurations(String scriptName) {
    // Focus on project explorer view.
    projectExplorer.setFocus();
    new SWTBotMenu(ContextMenuHelper.contextMenu(projectExplorer.bot().tree().select(scriptName), "Run As", "Run Configurations...")).click();
}
Also used : SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)

Example 5 with SWTBotMenu

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

the class TestCreateSystemtapScript method clickMainMenu.

/**
 * Click an item from the main Eclipse menu, with a guarantee that the main
 * shell will be in focus.
 * @param items The names of each item in the path to the target item to click.
 * For example, to click "File->New->Project...", the items would be "File",
 * "New", and "Project...".
 */
public static void clickMainMenu(String... items) {
    if (items.length == 0) {
        return;
    }
    mainShell.setFocus();
    SWTBotMenu menu = bot.menu(items[0]);
    for (int i = 1; i < items.length; i++) {
        menu = menu.menu(items[i]);
    }
    menu.click();
}
Also used : SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) Point(org.eclipse.swt.graphics.Point)

Aggregations

SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)44 Test (org.junit.Test)27 DockerClient (com.spotify.docker.client.DockerClient)14 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)14 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)3 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)3 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)3 IsEditorOpened (net.heartsome.test.swtbot.waits.IsEditorOpened)2 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)2 SWTBotRadio (org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio)2 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)2 ArrayList (java.util.ArrayList)1 ContributionItem (org.eclipse.jface.action.ContributionItem)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)1 AbstractChartBuilder (org.eclipse.linuxtools.systemtap.graphing.ui.charts.AbstractChartBuilder)1