Java 类org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem 实例源码

项目:gw4e.project    文件:ModelPathGeneratorHelper.java   
private void selectComboPathGenerator (SWTBotTableItem tableItem,String path) {
    DefaultCondition condition = new DefaultCondition() {
        @Override
        public boolean test() throws Exception {
            try {
                tableItem.click(1);
                SWTBotCCombo combo = bot.ccomboBoxWithId(ModelPathGenerator.GW4E_LAUNCH_CONFIGURATION_PATH_GENERATOR_ID,ModelPathGenerator.GW4E_LAUNCH_CONFIGURATION_PATH_GENERATOR_COMBO_EDITOR);
                combo.setSelection(path);
                return true;
            } catch (Exception e) {
                return false;
            }
        }

        @Override
        public String getFailureMessage() {
            return "Unable to open the path generator combo";
        }
    };
    bot.waitUntil(condition);
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatAllProjectsAreDeselectedWithDeselectAll() {
    openImportProjectWizardPage();

    final SWTBotTable projectTable = bot.table(0);

    for (int i = 0; i < projectTable.rowCount(); i++) {
        projectTable.getTableItem(i).check();
    }

    bot.button("Deselect All").click();

    for (int i = 0; i < projectTable.rowCount(); i++) {
        final SWTBotTableItem oneProjectRow = projectTable.getTableItem(i);
        Assert.assertFalse(oneProjectRow.isChecked());
    }
}
项目:gw4e.project    文件:RunAsManualWizard.java   
private String getStatus(SWTBotTableItem item) {
    String[] status = new String[1];
    Display.getDefault().syncExec(() -> {
        org.gw4e.eclipse.launching.runasmanual.StepDetail detail = (org.gw4e.eclipse.launching.runasmanual.StepDetail) item.widget
                .getData();
        status[0] = detail.getStatus() + "";
    });
    return status[0];
}
项目:gw4e.project    文件:RunAsManualWizard.java   
public void assertContext(SWTBotShell page, SummaryExecutionRow[] rows) {
    SWTBotTable table = bot.tableWithId(
            org.gw4e.eclipse.wizard.runasmanual.SummaryExecutionPage.GW4E_MANUAL_ELEMENT_ID,
            org.gw4e.eclipse.wizard.runasmanual.SummaryExecutionPage.GW4E_MANUAL_TABLE_VIEWER_SUMMARY_ID);
    int max = table.rowCount();
    for (int i = 0; i < max; i++) {
        SWTBotTableItem item = table.getTableItem(i);

        String status = getStatus(item);
        String step = item.getText(1);
        String result = item.getText(2);
        String description = item.getText(4);

        String statusExpected = rows[i].getStatus() + "";
        String stepExpected = rows[i].getStepname();
        String resultExpected = rows[i].getResult();

        String defaultResult = MessageUtil.getString("enter_a_result_if_verification_failed");
        if (defaultResult.equalsIgnoreCase(resultExpected)) {
            resultExpected = "";
        }

        String descriptionExpected = rows[i].getDescription();
        org.junit.Assert.assertEquals("Invalid status", statusExpected, status);
        org.junit.Assert.assertEquals("Invalid step", stepExpected, step);
        org.junit.Assert.assertEquals("Invalid result", resultExpected, result);
        org.junit.Assert.assertEquals("Invalid description", descriptionExpected, description);
    }

}
项目:gw4e.project    文件:JUnitGraphWalkerTestUIPageTest.java   
public void selectAdditionalContext (String [] additionalsContext) {
    SWTBotTable table = bot.tableWithId(JUnitGW4ETestUIPage.GW4E_CONVERSION_WIDGET_ID,JUnitGW4ETestUIPage.GW4E_LAUNCH_TEST_CONFIGURATION_ADDITIONAL_CONTEXT);
    int count = table.rowCount();
    for (String context : additionalsContext) {
        for (int i = 0; i < count; i++) {
            SWTBotTableItem item = table.getTableItem(i);
            int cols = table.columnCount();
            for (int j = 0; j < cols; j++) {
                if (item.getText(j).equals(context)) {
                    item.check();
                };
            }
        }           
    }
}
项目:gw4e.project    文件:OfflineTestUIPageTest.java   
public void selectGenerators (String [] generators) {
    SWTBotTable table = bot.tableWithId(BuildPoliciesCheckboxTableViewer.GW4E_CONVERSION_WIDGET_ID, BuildPoliciesCheckboxTableViewer.GW4E_CONVERSION_TABLE_GENERATORS);
    int max = table.rowCount();
    for (int i = 0; i < max; i++) {
        SWTBotTableItem item = table.getTableItem(i);
        for (String generator : generators) {
            if (generator.equalsIgnoreCase(item.getText())) {
                item.check();
            }
        }
    }
}
项目:gw4e.project    文件:GW4EProjectProperties.java   
public boolean hasGenerator (String value) {
    SWTBotTable table = getBuildPoliciesTable();
    int max  = table.rowCount();
    for (int i = 0; i < max; i++) {
        SWTBotTableItem item = table.getTableItem(i);
        if (value.equalsIgnoreCase(item.getText())) {
            return true;
        }
    }
    return false;
}
项目:gw4e.project    文件:ModelPathGeneratorHelper.java   
public void setSelectionFileStatus (String path,boolean checked) {
    SWTBotTable table= getTable ();
    int max=table.rowCount();
    for (int i = 0; i < max; i++) {
        SWTBotTableItem tableItem = table.getTableItem(i);
        ModelData d =  (ModelData) tableItem.widget.getData();
        if (d.getName().equalsIgnoreCase(path)) {
            tableItem.widget.setChecked(checked);
        }
    }
}
项目:gw4e.project    文件:ModelPathGeneratorHelper.java   
public void selectPathGenerator (String file,String path) {
    SWTBotTable table= getTable ();
    int max=table.rowCount();
    for (int i = 0; i < max; i++) {
        SWTBotTableItem tableItem = table.getTableItem(i);
        ModelData d =  (ModelData) tableItem.widget.getData();
        if (d.getName().equalsIgnoreCase(file)) {
            selectComboPathGenerator(tableItem,path);
        }
    }       
}
项目:dsl-devkit    文件:CoreSwtbotTools.java   
/**
 * Returns items from a table.
 *
 * @param bot
 *          to work with, must not be {@code null}
 * @param table
 *          to look for items in, must not be {@code null}
 * @return list of table items, never {@code null}
 */
public static List<SWTBotTableItem> tableItems(final SWTWorkbenchBot bot, final SWTBotTable table) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  Assert.isNotNull(table, ARGUMENT_TABLE);
  waitForTableItem(bot, table);
  List<SWTBotTableItem> items = null;
  for (int i = 0; i < table.rowCount(); i++) {
    items = new ArrayList<SWTBotTableItem>(Arrays.asList(table.getTableItem(i)));
  }
  return items;
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatAllProjectsAreSelectedWithSelectAll() {
    openImportProjectWizardPage();

    final SWTBotTable projectTable = bot.table(0);

    bot.button("Select All").click();

    for (int i = 0; i < projectTable.rowCount(); i++) {
        final SWTBotTableItem oneProjectRow = projectTable.getTableItem(i);
        Assert.assertTrue(oneProjectRow.isChecked());
    }
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatAlreadyImportedProjectIsGrayedInProjectTable() throws CoreException {
    importCodenvyProject(MOCK_WORKSPACE_NAME, MOCK_PROJECT_NAME);
    openImportProjectWizardPage();

    final SWTBotTable projectTable = bot.table(0);

    for (int i = 0; i < projectTable.rowCount(); i++) {
        final SWTBotTableItem oneProjectRow = projectTable.getTableItem(i);
        Assert.assertTrue(oneProjectRow.isGrayed() == MOCK_PROJECT_NAME.equals(projectTable.cell(i, 0)));
    }
}
项目:gw4e.project    文件:ProblemView.java   
public void executeQuickFixForErrorMessage(String expectedErrorMessageInProblemView, String quickfixmessage,
        ICondition[] conditions) throws CoreException {

    print ();

    bot.waitUntil(new ErrorIsInProblemView(this, expectedErrorMessageInProblemView));

    SWTBotTreeItem item = findErrorItemWithText(expectedErrorMessageInProblemView);
    item.setFocus();
    item.click();
    bot.waitUntil(new IsItemSelectedInErrors(this, item));

    ICondition condition = new DefaultCondition () {
        @Override
        public boolean test() throws Exception {
            item.contextMenu().menu("Quick Fix").click();
            try {
                bot.waitUntil(Conditions.shellIsActive("Quick Fix"), 2 * 1000 );
            } catch (Exception e) {
                return false;
            }
            return true;
        }

        @Override
        public String getFailureMessage() {
            return "Unable to open the Quick fix";
        }

    };

    bot.waitUntil(condition, 15 * 1000);

    SWTBotShell shell = bot.shell("Quick Fix");

    SWTBotTable table = shell.bot().tableWithLabel("Select a fix:");

    SWTBotTableItem thequickFixItem = table.getTableItem(quickfixmessage);
    thequickFixItem.click();
    thequickFixItem.select();

    SWTBotButton button = shell.bot().button("Finish");
    button.click();
    bot.waitUntil(Conditions.shellCloses(shell),TIMEOUT);

    bot.saveAllEditors();

    GW4EProject.fullBuild();

    if (conditions != null) {
        for (int i = 0; i < conditions.length; i++) {
            bot.waitUntil(conditions[i], TIMEOUT);
        }
    }

}
项目:gw4e.project    文件:GW4EPreferencePage.java   
void selectRowWithValue (SWTBotTable table,String value) {
    SWTBotTableItem item = table.getTableItem(value);
    item.select();
    item.click();

}
项目:scenarioo-example-swtbot-e4    文件:RemoveOrderFromOrderOverviewAndVerifyThatTheOrderStillExistsTest.java   
private void verifyRemovedOrderHasNotBeenDeleted() {

        SearchOrdersDialogPageObject searchOrdersDialog = new SearchOrdersDialogPageObject(
                scenariooWriterHelper);

        searchOrdersDialog.open();

        searchOrdersDialog.enterOrderNumber("Order");

        searchOrdersDialog.startSearch();

        SWTBotTable table = bot.table();
        SWTBotTableItem item = table.getTableItem(REMOVED_ORDER_NUMBER);

        LOGGER.info(item.toString());
        Assert.assertNotNull(item);

        bot.button("Cancel").click();
    }