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

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotCCombo. 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: ImportBdmWizardBot.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public ImportBdmWizardBot setImportAction(String packageName, String action) {
    SWTBotTree tree = bot.tree();
    SWTBotShell activeShell = bot.activeShell();
    bot.waitUntil(treeItemAvailable(tree, packageName));
    SWTBotTreeItem treeItem = tree.getTreeItem(packageName);
    treeItem.select();
    treeItem.click(1);

    SWTBot activeBot = activeShell.bot();
    SWTBotCCombo ccomboBoxInGroup = activeBot.ccomboBoxWithId(SmartImportBdmPage.IMPORT_ACTION_COMBO_EDITOR_ID);
    activeBot.waitUntil(new ConditionBuilder()
            .withTest(() -> Stream.of(ccomboBoxInGroup.items()).anyMatch(action::equals))
            .withFailureMessage(() -> String.format("Action '%s' not found in combo", action))
            .create());
    ccomboBoxInGroup.setSelection(action);
    return this;
}
 
Example #2
Source File: SwtBotControlUtils.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the item count.
 *
 * @param control
 *          the control
 * @return the item count
 */
private static int getItemCount(final AbstractSWTBotControl<?> control) {
  int itemCount;
  if (control instanceof SWTBotCCombo) {
    itemCount = ((SWTBotCCombo) control).itemCount();
  } else if (control instanceof SWTBotList) {
    itemCount = ((SWTBotList) control).itemCount();
  } else if (control instanceof SWTBotCombo) {
    itemCount = ((SWTBotCombo) control).itemCount();
  } else {
    throw new WrappedException("Control not supported", null);
  }
  return itemCount;
}
 
Example #3
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test enabled/disabled trace types behavior in the filters view
 */
@Test
public void testFiltersView() {
    int defaultCount = TmfTraceType.getAvailableTraceTypes().length;
    SWTBotUtils.openView(FilterView.ID);
    SWTBotView viewBot = fBot.viewById(FilterView.ID);
    importFilter(viewBot);
    SWTBot bot = viewBot.bot();

    SWTBotTree tree = bot.tree(0);
    SWTBotTreeItem item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    SWTBotCCombo comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", defaultCount, comboBox.itemCount());

    // Change the preference value for testxmlextension
    setTraceTypePreferences(UNCHECK_ALL, "Custom XML", "testxmlextension");

    // Change node to refresh the tree
    item = tree.expandNode("FILTER test");
    item.select();
    item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", 1, comboBox.itemCount());

    setTraceTypePreferences(UNCHECK_ALL, "Custom Text", "testtxtextension");

    // Change node to refresh the tree
    item = tree.expandNode("FILTER test");
    item.select();
    item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", 2, comboBox.itemCount());
}
 
Example #4
Source File: BotBdmModelEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotBdmModelEditor setType(String packageName, String businessObject, SWTBotTableItem item, String type,
        SWTBotTable attributeTable) {
    SWTBotShell activeShell = bot.activeShell();
    item.click(1);
    SWTBot activeBot = activeShell.bot();
    SWTBotCCombo ccomboBoxInGroup = activeBot.ccomboBoxWithId(FieldTypeEditingSupport.TYPE_COMBO_EDITOR_ID);
    activeBot.waitUntil(new ConditionBuilder()
            .withTest(() -> Stream.of(ccomboBoxInGroup.items()).anyMatch(type::equals))
            .withFailureMessage(() -> String.format("Type '%s' not found in combo", type))
            .create());
    ccomboBoxInGroup.setSelection(type);
    return this;
}
 
Example #5
Source File: BotBdmQueriesEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private BotBdmQueriesEditor setType(String queryName, String parameterName, String parameterType) {
    SWTBotShell activeShell = bot.activeShell();
    selectCustomQuery(queryName);
    getQueryParametersTable().getTableItem(parameterName).click(1);
    SWTBot activeBot = activeShell.bot();
    SWTBotCCombo typeComboBox = activeBot
            .ccomboBoxWithId(QueryParameterTypeEditingSupport.QUERY_PARAM_TYPE_COMBO_EDITOR_ID);
    activeBot.waitUntil(new ConditionBuilder()
            .withTest(() -> Stream.of(typeComboBox.items()).anyMatch(parameterType::equals))
            .withFailureMessage(() -> String.format("The type %s doesn't exist", parameterType))
            .create());
    typeComboBox.setSelection(parameterType);
    return this;
}
 
Example #6
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Return all timestamps ending with 100... for reasons
 */
@Test
public void testTimestampFilter() {
    SWTBotView viewBot = fBot.viewById(FilterView.ID);
    viewBot.setFocus();
    SWTBot filterBot = viewBot.bot();
    SWTBotTree treeBot = filterBot.tree();

    viewBot.toolbarButton("Add new filter").click();
    treeBot.getTreeItem("FILTER <name>").select();
    SWTBotText textBot = filterBot.text();
    textBot.setFocus();
    String filterName = "timestamp";
    textBot.setText(filterName);
    SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
    filterNodeBot.click();
    filterNodeBot.contextMenu("TRACETYPE").click();
    filterNodeBot.expand();
    SWTBotCCombo comboBot = filterBot.ccomboBox();
    comboBot.setSelection(TRACETYPE);
    filterNodeBot.getNode(WITH_TRACETYPE).expand();

    // --------------------------------------------------------------------
    // add AND
    // --------------------------------------------------------------------

    filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(AND).click();

    // --------------------------------------------------------------------
    // add CONTAINS "100"
    // --------------------------------------------------------------------

    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).contextMenu(CONTAINS).click();
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).expand();
    comboBot = filterBot.ccomboBox(1); // aspect
    comboBot.setSelection(TIMESTAMP);
    textBot = filterBot.text();
    textBot.setFocus();
    textBot.setText("100");
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).getNode("Timestamp CONTAINS \"100\"").select();
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).select();

    viewBot.toolbarButton("Save filters").click();

    String ret = applyFilter(fBot, filterName);
    assertEquals("10/100", ret);
}
 
Example #7
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * Return all timestamps ending with 100... for reasons
     */
    @Test
    public void testTimestampEqualsOr() {
        SWTBotView viewBot = fBot.viewById(FilterView.ID);
        viewBot.setFocus();
        SWTBot filterBot = viewBot.bot();
        SWTBotTree treeBot = filterBot.tree();

        viewBot.toolbarButton("Add new filter").click();
        treeBot.getTreeItem("FILTER <name>").select();
        SWTBotText textBot = filterBot.text();
        textBot.setFocus();
        String filterName = "matchAndEquals";
        textBot.setText(filterName);
        SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
        filterNodeBot.click();
        filterNodeBot.contextMenu("TRACETYPE").click();
        filterNodeBot.expand();
        SWTBotCCombo comboBot = filterBot.ccomboBox();
        comboBot.setSelection(TRACETYPE);
        filterNodeBot.getNode(WITH_TRACETYPE).expand();

        // --------------------------------------------------------------------
        // add OR
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(OR).click();

        // --------------------------------------------------------------------
        // add EQUALS "19...300"
        // --------------------------------------------------------------------

        SWTBotTreeItem orNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode(OR);
        orNode.contextMenu("EQUALS").click();
        orNode.expand();
        orNode.getNode(0).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(TIMESTAMP);
        textBot = filterBot.text();
        textBot.setFocus();
        textBot.setText("19:00:00.000 000 300");

        // --------------------------------------------------------------------
        // add MATCHES "1"
        // --------------------------------------------------------------------
        orNode.contextMenu("MATCHES").click();
        orNode.expand();
        orNode.getNode(1).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText("field");
        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1");

        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
        assertEquals("26/100", ret);
//        filterNodeBot.contextMenu().menu("Delete").click();
    }
 
Example #8
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * test compare field >= 2
     */
    @Test
    public void testField01() {
        SWTBotView viewBot = fBot.viewById(FilterView.ID);
        viewBot.setFocus();
        SWTBot filterBot = viewBot.bot();
        SWTBotTree treeBot = filterBot.tree();

        viewBot.toolbarButton("Add new filter").click();
        treeBot.getTreeItem("FILTER <name>").select();
        SWTBotText textBot = filterBot.text();
        textBot.setFocus();
        String filterName = "field";
        textBot.setText(filterName);
        SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
        filterNodeBot.click();
        filterNodeBot.contextMenu("TRACETYPE").click();
        filterNodeBot.expand();
        SWTBotCCombo comboBot = filterBot.ccomboBox();
        comboBot.setSelection(TRACETYPE);
        filterNodeBot.getNode(WITH_TRACETYPE).expand();

        // --------------------------------------------------------------------
        // add Compare > 1.5
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(COMPARE).click();
        SWTBotTreeItem contentNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode("<select aspect> " + "=" + " <value>");
        contentNode.expand();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText(filterName);

        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1.5");
        filterBot.radio(">").click();

        // --------------------------------------------------------------------
        // apply
        // --------------------------------------------------------------------
        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
//        filterNodeBot.contextMenu().menu("Delete").click();
        assertEquals("50/100", ret);
    }
 
Example #9
Source File: ControlViewKernelFilterTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private void testEnableKernelFromProviderEvent() {
    SWTBotTreeItem kernelProviderEventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.PROVIDER_GROUP_NAME,
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);

    kernelProviderEventItem.select();
    SWTBotMenu menuBot = kernelProviderEventItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate();
    SWTBotCCombo sessionCombo = shell.bot().ccomboBoxInGroup(ControlViewSwtBotUtil.SESSION_LIST_GROUP_NAME);
    sessionCombo.setSelection(getSessionName());
    SWTBotText filterText = shell.bot().textInGroup(ControlViewSwtBotUtil.FILTER_EXPRESSION_LABEL);
    filterText.setText(FILTER_EXPRESSION);
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem));

    SWTBotTreeItem kernelDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, kernelDomainItem.getText());

    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);
    assertEquals(ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME, eventItem.getText());

    ITraceControlComponent comp = ControlViewSwtBotUtil.getComponent(fNode,
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);
    assertNotNull(comp);
    assertTrue(comp instanceof TraceEventComponent);
    TraceEventComponent event = (TraceEventComponent) comp;
    assertEquals(FILTER_EXPRESSION_DISPLAY, event.getFilterExpression());
}
 
Example #10
Source File: RemoteBotCCombo.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public IRemoteBotCCombo setWidget(SWTBotCCombo ccomb) {
  this.widget = ccomb;
  return this;
}
 
Example #11
Source File: CoreSwtbotTools.java    From dsl-devkit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Returns the full text of the first CcomboItem found with the given prefix.
 * <p>
 * <em>Note</em>: Throws an AssertionError if the item could not be found.
 * </p>
 *
 * @param ccombo
 *          the ccomboBox to search in, must not be {@code null}
 * @param prefix
 *          the prefix of the item to search for, must not be {@code null}
 * @return the full name of the item as string, never {@code null}
 */
public static String getCcomboItemText(final SWTBotCCombo ccombo, final String prefix) {
  Assert.isNotNull(ccombo, "ccombo");
  Assert.isNotNull(prefix, "prefix");
  for (String ccomboItem : ccombo.items()) {
    if (ccomboItem.startsWith(prefix)) {
      return ccomboItem;
    }
  }
  throw new AssertionFailedException(NLS.bind("Must have a CcomboItem named ''{0}''.", prefix));
}