Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotText#pressShortcut()
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotText#pressShortcut() .
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: XlfEditor.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 跳到指定文本段 * @param segNum * 文本段行号 */ public void gotoSeg(int segNum) { getNatTable(); nattable.click(1, 1); int targetRowIndex; if (isHorizontalLayout()) { targetRowIndex = segNum - 1; } else { targetRowIndex = (segNum - 1) * 2; } int selectedRowIndex = nattable.indexOfSelectedRow(positionOfTargetTextColumn()); // 先判断指定文本段是否已经被选中,若未被选中才继续 if (segNum != 1 && targetRowIndex != selectedRowIndex) { SWTBotText text = editorBot.text(lineNumLastValue); text.setText(String.valueOf(segNum)); text.pressShortcut(Keystrokes.LF); lineNumLastValue = String.valueOf(segNum); // 确认选中了指定文本段 bot.waitUntil(new IsSegmentSelected(this, targetRowIndex)); } }
Example 2
Source File: XlfEditor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 跳到指定文本段 * @param segNum * 文本段行号 */ public void gotoSeg(int segNum) { getNatTable(); nattable.click(1, 1); int targetRowIndex; if (isHorizontalLayout()) { targetRowIndex = segNum - 1; } else { targetRowIndex = (segNum - 1) * 2; } int selectedRowIndex = nattable.indexOfSelectedRow(positionOfTargetTextColumn()); // 先判断指定文本段是否已经被选中,若未被选中才继续 if (segNum != 1 && targetRowIndex != selectedRowIndex) { SWTBotText text = editorBot.text(lineNumLastValue); text.setText(String.valueOf(segNum)); text.pressShortcut(Keystrokes.LF); lineNumLastValue = String.valueOf(segNum); // 确认选中了指定文本段 bot.waitUntil(new IsSegmentSelected(this, targetRowIndex)); } }
Example 3
Source File: BotBdmModelEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotBdmModelEditor addAttribute(String packageName, String businessObject, String attribute, String type) { SWTBotTable attributeTable = getAttributeTable(packageName, businessObject); attributeTable.unselect(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return attributeTable.selectionCount() == 0; } @Override public String getFailureMessage() { return "Attribute table should have no selection"; } }); bot.toolbarButtonWithId(AttributeEditionControl.ADD_ATTRIBUTE_BUTTON_ID).click(); SWTBotText botText = bot.textWithId(SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR); botText.setText(attribute); botText.pressShortcut(Keystrokes.CR); setType(packageName, businessObject, attributeTable.getTableItem(attribute), type, attributeTable); return this; }
Example 4
Source File: BotBdmQueriesEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotBdmQueriesEditor setParameters(String queryName, Map<String, String> queryParam) { selectCustomQuery(queryName); // remove all existing parameters SWTBotTable queryParametersTable = getQueryParametersTable(); int[] indexes = new int[queryParametersTable.rowCount()]; for (int i = 0; i < indexes.length; i++) { indexes[i] = i; } queryParametersTable.select(indexes); bot.toolbarButtonWithId(QueryDetailsControl.REMOVE_PARAM_BUTTON_ID).click(); bot.waitUntil(Conditions.shellIsActive(Messages.deleteQueryParamsConfirmTitle)); SWTBotShell activeShell = bot.activeShell(); activeShell.bot().button(IDialogConstants.YES_LABEL).click(); bot.waitUntil(Conditions.shellCloses(activeShell)); //add required parameters for (Entry<String, String> paramEntry : queryParam.entrySet()) { bot.toolbarButtonWithId(QueryDetailsControl.ADD_PARAM_BUTTON_ID).click(); getQueryParametersTable().getTableItem(Messages.parameter).click(); SWTBotText textBot = bot.textWithId(SWTBOT_ID_QUERY_PARAM_NAME_TEXTEDITOR); textBot.setText(paramEntry.getKey()); textBot.pressShortcut(Keystrokes.CR); setType(queryName, paramEntry.getKey(), paramEntry.getValue()); } return this; }
Example 5
Source File: ExportToTsvTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test export when a filter is applied to the table * * @throws IOException * File not found or such */ @Test public void testExportWithFilter() throws IOException { SWTBotEditor editorBot = fEditorBot; assertNotNull(editorBot); final SWTBotTable tableBot = editorBot.bot().table(); tableBot.getTableItem(0).click(3); SWTBotText textBot = editorBot.bot().text(); textBot.typeText("LoggerA|LoggerB|LoggerC"); textBot.pressShortcut(Keystrokes.CTRL, Keystrokes.CR); fBot.waitUntil(Conditions.tableHasRows(tableBot, 6), 5000); tableBot.getTableItem(1).contextMenu(EXPORT_TO_TSV).click(); assertTsvContentsEquals(ImmutableList.of(HEADER_TEXT, EVENT1_TEXT, EVENT2_TEXT, EVENT3_TEXT)); }
Example 6
Source File: BotBdmConstraintsEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public BotBdmConstraintsEditor addConstraint(String packageName, String businessObject, String constraintName, String... selectFields) { selectBusinessObject(packageName, businessObject); bot.toolbarButtonWithId(ConstraintEditionControl.ADD_CONSTRAINT_BUTTON_ID).click(); SWTBotText botText = bot.textWithId(SWTBOT_ID_UNIQUE_CONSTRAINT_NAME_TEXTEDITOR); botText.setText(constraintName); botText.pressShortcut(Keystrokes.CR); return editConstraint(packageName, businessObject, constraintName, selectFields); }
Example 7
Source File: BotBdmIndexesEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public BotBdmIndexesEditor addIndex(String packageName, String businessObject, String indexName, String... selectFields) { selectBusinessObject(packageName, businessObject); bot.toolbarButtonWithId(IndexControl.ADD_INDEX_BUTTON_ID).click(); SWTBotText botText = bot.textWithId(SWTBOT_ID_UNIQUE_INDEX_NAME_TEXTEDITOR); botText.setText(indexName); botText.pressShortcut(Keystrokes.CR); editIndex(packageName, businessObject, indexName, selectFields); return this; }
Example 8
Source File: TestTraceOffsetting.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Test offsetting by 99 ns */ @Test public void testOffsetting() { // Skip this test on Mac OS X 10.11.1 because of bug 481611 // FIXME: Remove this work around once bug 481611 is fixed MacOsVersion macOsVersion = MacOsVersion.getMacOsVersion(); boolean macBugPresent = macOsVersion != null && macOsVersion.compareTo(new MacOsVersion(10, 11, 1)) >= 0; assumeTrue(!macBugPresent); SWTBotUtils.createProject(PROJET_NAME); SWTBotTreeItem traceFolderItem = SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME); SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); SWTBotEditor editor = fBot.editorByTitle(fLocation.getName()); SWTBotTable eventsTableBot = editor.bot().table(); String timestamp = eventsTableBot.cell(1, 1); assertEquals("19:00:00.000 000 000", timestamp); SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, traceFolderItem, fLocation.getName()); traceItem.select(); traceItem.contextMenu("Apply Time Offset...").click(); WaitUtils.waitForJobs(); // set offset to 99 ns SWTBotShell shell = fBot.shell("Apply time offset"); shell.setFocus(); SWTBotTreeItem[] allItems = fBot.tree().getAllItems(); final SWTBotTreeItem swtBotTreeItem = allItems[0]; swtBotTreeItem.select(); swtBotTreeItem.click(1); // Press shortcuts on the cell editor SWTBotText text = shell.bot().text(1); text.pressShortcut(KeyStroke.getInstance('9')); text.pressShortcut(KeyStroke.getInstance('9')); text.pressShortcut(KeyStroke.getInstance('\n')); WaitUtils.waitForJobs(); fBot.button("OK").click(); // wait for trace to close fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, fLocation.getName())); // re-open trace SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); editor = fBot.editorByTitle(fLocation.getName()); eventsTableBot = editor.bot().table(); timestamp = eventsTableBot.cell(1, 1); assertEquals("19:01:39.000 000 000", timestamp); SWTBotUtils.deleteProject(PROJET_NAME, fBot); }
Example 9
Source File: ReflectivityModelTester.java From ice with Eclipse Public License 1.0 | 3 votes |
/** * Enters the specified text into a text widget with the given label, * followed by pressing the enter key. This function will cause the test to * fail if the text widget with the given label is not enabled. * * @param label * The label of the text widget to type in. * @param text * The text to be typed. */ public void enterText(String label, String text) { // Find the appropriate widget SWTBotText widget = bot.textWithLabel(label); // Type in the text and hit enter widget.setText(text); widget.pressShortcut(Keystrokes.LF); }
Example 10
Source File: MOOSETester.java From ice with Eclipse Public License 1.0 | 3 votes |
/** * Enters the specified text into a text widget with the given label, * followed by pressing the enter key. This function will cause the test to * fail if the text widget with the given label is not enabled. * * @param label * The label of the text widget to type in. * @param text * The text to be typed. */ public void enterText(String label, String text) { // Find the appropriate widget SWTBotText widget = bot.textWithLabel(label); // Type in the text and hit enter widget.setText(text); widget.pressShortcut(Keystrokes.LF); }