Java源码示例:org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio

示例1
/**
 * 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);
    }
}
 
示例2
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();
}
 
示例3
/**
 * 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();
}
 
示例4
/**
 * 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();
}
 
示例5
/**
 * 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());
}
 
示例6
/**
 * @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));
}
 
示例7
/**
 * @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));
}
 
示例8
/**
 * 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));
}
 
示例9
/**
 * 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());
}
 
示例10
/**
 * @return 单选按钮:不删除内容;
 */
public SWTBotRadio radBtnDoNotDeleteContents() {
	return dialogBot.radio(TsUIConstants.getString("radBtnDoNotDeleteContents"));
}
 
示例11
/**
 * @return 单选按钮:匹配率相同时排序策略,默认库优先;
 */
public SWTBotRadio tmRadBtnSortDefaultDBFirst() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortDefaultDBFirst"));
}
 
示例12
/**
 * @return 单选按钮:匹配率相同时排序策略,更新时间倒序排列;
 */
public SWTBotRadio tmRadBtnSortUpdateTimeReverse() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortUpdateTimeReverse"));
}
 
示例13
/**
 * @return 单选按钮:记忆库更新策略,始终增加;
 */
public SWTBotRadio tmRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeAlwaysAdd"));
}
 
示例14
/**
 * @return 单选按钮:记忆库更新策略,重复覆盖;
 */
public SWTBotRadio tmRadBtnUpdateModeOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeOverwrite"));
}
 
示例15
/**
 * @return 单选按钮:记忆库更新策略,重复忽略;
 */
public SWTBotRadio tmRadBtnUpdateModeIgnore() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeIgnore"));
}
 
示例16
/**
 * @return 单选按钮:术语库更新策略,始终增加;
 */
public SWTBotRadio tbRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeAlwaysAdd"));
}
 
示例17
/**
 * @return 单选按钮:术语库更新策略,重复覆盖;
 */
public SWTBotRadio tbRadBtnUpdateModeOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeOverwrite"));
}
 
示例18
/**
 * @return 单选按钮:术语库更新策略,重复合并;
 */
public SWTBotRadio tbRadBtnUpdateModeMerge() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeMerge"));
}
 
示例19
/**
 * @return 单选按钮:术语库更新策略,重复忽略;
 */
public SWTBotRadio tbRadBtnUpdateModeIgnore() {
	return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeIgnore"));
}
 
示例20
/**
 * @return 单选按钮:保留现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeKeepCurrent() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeKeepCurrent"));
}
 
示例21
/**
 * @return 单选按钮:如果匹配率比当前高,覆盖现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeOverwriteIfHigher() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeOverwriteIfHigher"));
}
 
示例22
/**
 * @return 单选按钮:始终覆盖现有匹配;
 */
public SWTBotRadio transPreRadBtnOverwriteModeAlwaysOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeAlwaysOverwrite"));
}
 
示例23
/**
 * @return 单选按钮:匹配所有条件;
 */
public SWTBotRadio radBtnMatchAllConditions() {
	return dialogBot.radio(TsUIConstants.getString("radBtnMatchAllConditions"));
}
 
示例24
/**
 * @return 单选按钮:匹配任一条件;
 */
public SWTBotRadio radBtnMatchAnyCondition() {
	return dialogBot.radio(TsUIConstants.getString("radBtnMatchAnyCondition"));
}
 
示例25
/**
 * @return 单选按钮:不删除内容;
 */
public SWTBotRadio radBtnDoNotDeleteContents() {
	return dialogBot.radio(TsUIConstants.getString("radBtnDoNotDeleteContents"));
}
 
示例26
/**
 * @return 单选按钮:匹配率相同时排序策略,默认库优先;
 */
public SWTBotRadio tmRadBtnSortDefaultDBFirst() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortDefaultDBFirst"));
}
 
示例27
/**
 * @return 单选按钮:匹配率相同时排序策略,更新时间倒序排列;
 */
public SWTBotRadio tmRadBtnSortUpdateTimeReverse() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortUpdateTimeReverse"));
}
 
示例28
/**
 * @return 单选按钮:记忆库更新策略,始终增加;
 */
public SWTBotRadio tmRadBtnUpdateModeAlwaysAdd() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeAlwaysAdd"));
}
 
示例29
/**
 * @return 单选按钮:记忆库更新策略,重复覆盖;
 */
public SWTBotRadio tmRadBtnUpdateModeOverwrite() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeOverwrite"));
}
 
示例30
/**
 * @return 单选按钮:记忆库更新策略,重复忽略;
 */
public SWTBotRadio tmRadBtnUpdateModeIgnore() {
	return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeIgnore"));
}