org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio Java Examples

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiUtils.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * You MUST navigate to the correct preferences page, or the method fails and
 * possibly throws widget not found exception. Sets The CodeChecker Directory on
 * the preferences pages.
 * 
 * @param method
 *            The associated radio button to the {@link ResolutionMethodTypes}
 *            will be clicked on the preferences/properties page.
 * @param ccDir
 *            Path to the CodeChecker Root directory.
 * @param bot
 *            The bot to be guided.
 * @param root
 *            TODO
 */
public static void setCCBinDir(ResolutionMethodTypes method, Path ccDir, SWTWorkbenchBot bot, boolean root) {
    SWTBotRadio radio = null;
    switch (method) {
        case PATH:
            radio = bot.radio("Search in PATH");
            break;
        case PRE:
            radio = bot.radio("Pre built package");
            break;
        default:
            break;
    }
    radio.click();
    if (method != ResolutionMethodTypes.PATH || ccDir != null) {
        SWTBotText text = bot.textWithLabel(GuiUtils.CC_DIR_WIDGET);
        // if the given path is the package root, extend it to the concrete binary else
        // it could be used directly.
        text.setText(root ? ccDir.resolve(Paths.get(BIN, CODECHECKER)).toString() : ccDir.toString());
        bot.sleep(SHORT_WAIT_TIME);
    }
}
 
Example #2
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void search(String findText, SearchOptions options, SWTBotButton findButton, SWTBot bot) {
    // set the text to search
    SWTBotCombo findFieldCombo = bot.comboBox();
    findFieldCombo.setText(findText);
    assertTrue("Find combo", findFieldCombo.getText().equals(findText));

    // set the options
    SWTBotRadio directions = options.forwardSearch ? bot.radio("Forward").click() : bot.radio("Backward").click();
    assertTrue("direction", directions.isSelected());

    setCheckButton("Case sensitive", options.caseSensitive, bot);
    setCheckButton("Wrap search", options.wrapSearch, bot);
    setCheckButton("Whole word", options.wholeWord, bot);
    setCheckButton("Regular expression", options.regExSearch, bot);

    findButton.click();
}
 
Example #3
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * While in the import wizard, select the specified directory as a source.
 *
 * @param bot
 *            the SWTBot
 * @param directoryPath
 *            the directory path to set as a source
 */
public static void selectImportFromDirectory(SWTBot bot, String directoryPath) {
    SWTBotRadio button = bot.radio("Select roo&t directory:");
    button.click();

    SWTBotCombo sourceCombo = bot.comboBox();
    File traceFolderParent = new File(directoryPath);
    sourceCombo.setFocus();
    sourceCombo.setText(traceFolderParent.getAbsolutePath());

    /* the resource tree gets updated when the combo loses focus */
    SWTBotTree tree = bot.tree();
    tree.setFocus();
}
 
Example #4
Source File: ConfirmProjectDeleteDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return 单选按钮:同时删除目录下的内容;
 */
public SWTBotRadio radBtnAlsoDeleteContentsUnder() {
	assertTrue("参数错误,项目名称为 null。", prjName != null);
	String path = FileUtil.joinPath(FileUtil.getWorkspacePath(), prjName);
	String msg = TsUIConstants.getString("radBtnAlsoDeleteContentsUnder");
	return dialogBot.radio(MessageFormat.format(msg, path));
}
 
Example #5
Source File: ConfirmProjectDeleteDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return 单选按钮:同时删除目录下的内容;
 */
public SWTBotRadio radBtnAlsoDeleteContentsUnder() {
	assertTrue("参数错误,项目名称为 null。", prjName != null);
	String path = FileUtil.joinPath(FileUtil.getWorkspacePath(), prjName);
	String msg = TsUIConstants.getString("radBtnAlsoDeleteContentsUnder");
	return dialogBot.radio(MessageFormat.format(msg, path));
}
 
Example #6
Source File: ControlViewProfileTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test load session
 */
private void testLoadSession() {
    SWTBotTreeItem nodeItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName());
    SWTBotTreeItem sessionGroupItem = nodeItem.getNode(ControlViewSwtBotUtil.SESSION_GROUP_NAME);

    sessionGroupItem.select();
    SWTBotMenu menuBot = sessionGroupItem.contextMenu(ControlViewSwtBotUtil.LOAD_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.LOAD_DIALOG_TITLE).activate();

    SWTBotRadio button = shell.bot().radio(ControlViewSwtBotUtil.REMOTE_RADIO_BUTTON_LABEL);
    button.click();

    SWTBotTree shellTree = shell.bot().tree();

    SWTBotTreeItem profileItem = shellTree.getTreeItem(SESSION_NAME + ControlViewSwtBotUtil.PROFILE_SUFFIX);
    profileItem.select();
    profileItem.click();

    shell.bot().button(ControlViewSwtBotUtil.CONFIRM_DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    sessionGroupItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(), ControlViewSwtBotUtil.SESSION_GROUP_NAME);

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(SESSION_NAME, sessionGroupItem));
    assertEquals(1, sessionGroupItem.getNodes().size());
}
 
Example #7
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * While in the import wizard, select the specified archive as a source.
 *
 * @param bot
 *            the SWTBot
 * @param archivePath
 *            the archive path to set as a source
 */
public static void selectImportFromArchive(SWTBot bot, String archivePath) {
    SWTBotRadio button = bot.radio("Select &archive file:");
    button.click();

    SWTBotCombo sourceCombo = bot.comboBox(1);

    sourceCombo.setFocus();
    sourceCombo.setText(new File(archivePath).getAbsolutePath());

    /* the resource tree gets updated when the combo loses focus */
    SWTBotTree tree = bot.tree();
    tree.setFocus();
}
 
Example #8
Source File: RemoteBotRadio.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public IRemoteBotRadio setWidget(SWTBotRadio radio) {
  this.swtBotRadio = radio;
  return this;
}
 
Example #9
Source File: ManageCustomFilterDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配任一条件;
 */
public SWTBotRadio radBtnMatchAnyCondition() {
	return dialogBot.radio(TsUIConstants.getString("radBtnMatchAnyCondition"));
}
 
Example #10
Source File: ConfirmProjectDeleteDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:不删除内容;
 */
public SWTBotRadio radBtnDoNotDeleteContents() {
	return dialogBot.radio(TsUIConstants.getString("radBtnDoNotDeleteContents"));
}
 
Example #11
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配率相同时排序策略,默认库优先;
 */
public SWTBotRadio tmRadBtnSortDefaultDBFirst() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortDefaultDBFirst"));
}
 
Example #12
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配率相同时排序策略,更新时间倒序排列;
 */
public SWTBotRadio tmRadBtnSortUpdateTimeReverse() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortUpdateTimeReverse"));
}
 
Example #13
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:记忆库更新策略,始终增加;
 */
public SWTBotRadio tmRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeAlwaysAdd"));
}
 
Example #14
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:记忆库更新策略,重复覆盖;
 */
public SWTBotRadio tmRadBtnUpdateModeOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeOverwrite"));
}
 
Example #15
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:记忆库更新策略,重复忽略;
 */
public SWTBotRadio tmRadBtnUpdateModeIgnore() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeIgnore"));
}
 
Example #16
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:术语库更新策略,始终增加;
 */
public SWTBotRadio tbRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeAlwaysAdd"));
}
 
Example #17
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:术语库更新策略,重复覆盖;
 */
public SWTBotRadio tbRadBtnUpdateModeOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeOverwrite"));
}
 
Example #18
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:术语库更新策略,重复合并;
 */
public SWTBotRadio tbRadBtnUpdateModeMerge() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeMerge"));
}
 
Example #19
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:术语库更新策略,重复忽略;
 */
public SWTBotRadio tbRadBtnUpdateModeIgnore() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeIgnore"));
}
 
Example #20
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:保留现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeKeepCurrent() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeKeepCurrent"));
}
 
Example #21
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:如果匹配率比当前高,覆盖现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeOverwriteIfHigher() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeOverwriteIfHigher"));
}
 
Example #22
Source File: PreferencesDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:始终覆盖现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeAlwaysOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeAlwaysOverwrite"));
}
 
Example #23
Source File: ManageCustomFilterDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配所有条件;
 */
public SWTBotRadio radBtnMatchAllConditions() {
	return dialogBot.radio(TsUIConstants.getString("radBtnMatchAllConditions"));
}
 
Example #24
Source File: PreferencesDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:术语库更新策略,始终增加;
 */
public SWTBotRadio tbRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeAlwaysAdd"));
}
 
Example #25
Source File: SDViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test Sequence diagram print dialog
 */
@Test
public void testSDPrintUi() {
    SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID);
    assertNotNull(viewBot);
    viewBot.setFocus();
    WaitUtils.waitForJobs();

    // Test print dialog
    SWTBotCanvas canvas = viewBot.bot().canvas(1);
    canvas.setFocus();
    canvas.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('P'));
    SWTBotShell printShell = fBot.shell("Print");
    assertNotNull(printShell);
    SWTBot printBot = printShell.bot();

    printBot.radio("Use current zoom").click();

    SWTBotRadio allPages = printBot.radio("All pages");
    SWTBotRadio currentView = printBot.radio("Current view");
    // 'All pages' and 'Current view' buttons will be enabled
    allPages.click();
    currentView.click();

    // Test 'Number of horizontal pages' button
    printBot.radio("Number of horizontal pages:").click();
    SWTBotText horizontalPagesText = printBot.text(0);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), horizontalPagesText, "Number of horizontal pages should be 1");
    horizontalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), horizontalPagesText, "Number of horizontal pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'Number of vertical pages' button
    SWTBotText totalPagesText = printBot.textWithLabel("Total number of pages:");
    printBot.radio("Number of vertical pages:").click();
    SWTBotText verticalPagesText = printBot.text(1);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), verticalPagesText, "Number of vertical pages should be 1");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), totalPagesText, "Total number of pages should be 1");
    verticalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), verticalPagesText, "Number of vertical pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'selected pages' button
    printBot.radio("Selected pages").click();
    assertFalse(currentView.isEnabled());

    // Test 'From pages' buttons
    printBot.radio("From page").click();
    SWTBotText fromText = printBot.text(3);
    SWTBotText toText = printBot.text(4);
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), fromText, "From text is not empty");
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), toText, "To text is not empty");
    fromText.setText("2");
    toText.setText("3");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), fromText, "From text is not 2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(3)), toText, "To text is not 3");
    assertFalse(currentView.isEnabled());

    // Don't actually print
    printBot.button("Cancel").click();
    printBot.waitUntil(Conditions.shellCloses(printShell));
}
 
Example #26
Source File: ControlFlowViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test dynamic filters dialog on CPU
 */
@Test
public void testDynamicFilteringCpu() {
    /* Change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);

    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length);

    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    SWTBotShell shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();

    /* Make sure nothing is checked and radio buttons are disabled */
    SWTBotCheckBox activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertFalse(activeThreadsCheckbox.isChecked());

    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);

    /* Toggle active thread filter button */
    activeThreadsCheckbox.click();
    assertTrue(activeThreadsCheckbox.isChecked());

    /* Filter on selected CPUs */
    onCpuRadio.click();
    onCpuField.setText("0");

    shell.bot().button(DIALOG_OK).click();

    /*
     * A zoom thread is started after applying the filter. Make sure that the time graph
     * is ready before continuing with the test
     */
    timeGraphIsReadyCondition(range);

    /* Change window range to 50 us */
    range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);

    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 1, traceEntry, () -> "Entries size expected:1 actual:" + traceEntry.getEntries().length);

    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();

    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertTrue(activeThreadsCheckbox.isChecked());

    /*
     * Test Active Filter buttons toggle
     */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertFalse(activeThreadsCheckbox.isChecked());
}
 
Example #27
Source File: ConfirmProjectDeleteDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:不删除内容;
 */
public SWTBotRadio radBtnDoNotDeleteContents() {
	return dialogBot.radio(TsUIConstants.getString("radBtnDoNotDeleteContents"));
}
 
Example #28
Source File: PreferencesDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配率相同时排序策略,默认库优先;
 */
public SWTBotRadio tmRadBtnSortDefaultDBFirst() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortDefaultDBFirst"));
}
 
Example #29
Source File: PreferencesDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:匹配率相同时排序策略,更新时间倒序排列;
 */
public SWTBotRadio tmRadBtnSortUpdateTimeReverse() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortUpdateTimeReverse"));
}
 
Example #30
Source File: PreferencesDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 单选按钮:记忆库更新策略,始终增加;
 */
public SWTBotRadio tmRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeAlwaysAdd"));
}