org.eclipse.swtbot.swt.finder.keyboard.Keystrokes Java Examples

The following examples show how to use org.eclipse.swtbot.swt.finder.keyboard.Keystrokes. 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: DBManagement.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param from
 *            入口,请使用 TSUIConstants 类中提供的枚举。
 * @return 打开的库管理对话框;
 */
public DatabaseManagementDialog openDBMgmgDialog(Entry from) {
	if (from.equals(TsUIConstants.Entry.MENU)) {
		ts.menuDBManagement().click();
	} else if (from.equals(TsUIConstants.Entry.SHORTCUT)) {
		try {
			ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D"));
		} catch (ParseException e) {
			e.printStackTrace();
			assertTrue("快捷键解析错误。", false);
		}
	} else {
		assertTrue("参数错误,该功能无此入口:" + from, false);
	}
	dialog = new DatabaseManagementDialog(DatabaseManagementDialog.MANAGEMENT);
	return dialog;
}
 
Example #2
Source File: MemoryDBManagement.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param from
 *            入口,请使用 TSUIConstants 类中提供的枚举。
 * @return 打开的库管理对话框;
 */
public MemoryDatabaseManagementDialog openDBMgmgDialog(Entry from) {
	if (from.equals(TsUIConstants.Entry.MENU)) {
		if (isMemory){
			ts.menuDBManagement().click();
		} else {
			ts.menuTeriDBManagement().click();
		}
	} else if (from.equals(TsUIConstants.Entry.SHORTCUT)) {
		try {
			ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D"));
		} catch (ParseException e) {
			e.printStackTrace();
			assertTrue("快捷键解析错误。", false);
		}
	} else {
		assertTrue("参数错误,该功能无此入口:" + from, false);
	}
	dialog = new MemoryDatabaseManagementDialog(MemoryDatabaseManagementDialog.MANAGEMENT,isMemory?"dlgTitleMemoryManagement":"dlgTitletreiTbManagement");
	return dialog;
}
 
Example #3
Source File: DBManagement.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param from
 *            入口,请使用 TSUIConstants 类中提供的枚举。
 * @return 打开的库管理对话框;
 */
public DatabaseManagementDialog openDBMgmgDialog(Entry from) {
	if (from.equals(TsUIConstants.Entry.MENU)) {
		ts.menuDBManagement().click();
	} else if (from.equals(TsUIConstants.Entry.SHORTCUT)) {
		try {
			ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D"));
		} catch (ParseException e) {
			e.printStackTrace();
			assertTrue("快捷键解析错误。", false);
		}
	} else {
		assertTrue("参数错误,该功能无此入口:" + from, false);
	}
	dialog = new DatabaseManagementDialog(DatabaseManagementDialog.MANAGEMENT);
	return dialog;
}
 
Example #4
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test keyboard marker navigation using '.' and ','
 */
@Test
public void testKeyboardSelectNextPreviousMarker() {
    SWTBotView viewBot = getViewBot();
    SWTBotCanvas canvas = viewBot.bot().canvas(1);
    testNextPreviousMarker(
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(KeyStroke.getInstance('.'));
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance('.'));
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(KeyStroke.getInstance(','));
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(','));
            });
}
 
Example #5
Source File: PreTranslate.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 打开预翻译对话框
 * @param from
 *            入口,请使用 TSUIConstants 类提供的常量
 * @return 预翻译对话框对象;
 */
private PreTranslateDialog openPreTransDlg(Entry from) {
	select();

	switch (from) {
	case MENU: {
		ts.menuTranslationPreTrans().click();
		break;
	}
	case CONTEXT_MENU: {
		ProjectTreeView.getInstance().ctxMenuPreTranslate().click();
		break;
	}
	case SHORTCUT: {
		ProjectTreeView.getTree().pressShortcut(Keystrokes.SHIFT, Keystrokes.F5);
		break;
	}
	default: {
		assertTrue("参数错误,无此入口:" + from, false);
	}
	}

	dlgPreTrans = new PreTranslateDialog();
	assertTrue("预翻译对话框未正确打开。", dlgPreTrans.isOpen());
	return dlgPreTrans;
}
 
Example #6
Source File: ControlFlowViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test keyboard navigation using ARROW_RIGHT and ARROW_LEFT
 */
@Test
public void testKeyboardLeftRight() {
    SWTBotView viewBot = getViewBot();
    SWTBotCanvas canvas = viewBot.bot().canvas(1);
    testNextPreviousEvent(
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.RIGHT);
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT);
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.LEFT);
            },
            () -> {
                canvas.setFocus();
                canvas.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT);
            });
}
 
Example #7
Source File: BotBdmQueriesEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 #8
Source File: XlfEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 跳到指定文本段
 * @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 #9
Source File: XlfEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param text
 *            文本内容,其中的内部标记为源代码形式(必须对其中的双引号进行转义)
 * @param fromSegNum
 *            查找的起始文本段序号
 * @return int 从指定序号的文本段起,源文本内容等于指定内容的文本段序号(精确匹配)
 */
public int segNumOfSource(String text, int fromSegNum) {
	if (text == null) {
		return -1;
	}
	getNatTable();
	nattable.click(1, 1);
	int columnPosition = positionOfSourceTextColumn();
	int rowPosition;
	String srcText;
	selectSourceCell(fromSegNum);
	for (int i = fromSegNum; i <= segCount(); i++) {
		rowPosition = nattable.positionOfSelectedRow();
		srcText = nattable.getTextByPosition(rowPosition, columnPosition);
		if (text.equals(srcText) || text.equals(XliffUtil.tagged(srcText))) {
			// 考虑标记的两种显示状态
			int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants
					.getString("lblNatTableHeaderLineNum"));
			return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition));
		}
		nattable.pressShortcut(Keystrokes.DOWN); // 输入向下方向键
	}
	return -1;
}
 
Example #10
Source File: XlfEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param text
 *            文本内容,其中的内部标记为源代码形式(必须对其中的双引号进行转义)
 * @param fromSegNum
 *            查找的起始文本段序号
 * @return int 从指定序号的文本段起,源文本内容包含指定内容的文本段序号(模糊匹配)
 */
public int segNumContainsSource(String text, int fromSegNum) {
	if (text == null) {
		return -1;
	}
	getNatTable();
	int columnPosition = positionOfSourceTextColumn();
	int rowPosition;
	String srcText;
	selectSourceCell(fromSegNum);
	for (int i = fromSegNum; i <= segCount(); i++) {
		rowPosition = nattable.positionOfSelectedRow();
		srcText = nattable.getTextByPosition(rowPosition, columnPosition);
		if (srcText != null && (srcText.contains(text) || XliffUtil.tagged(srcText).contains(text))) {
			// 考虑标记的两种显示状态
			int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants
					.getString("lblNatTableHeaderLineNum"));
			return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition));
		}
		nattable.pressShortcut(Keystrokes.DOWN); // 输入向下方向键
	}
	return -1;
}
 
Example #11
Source File: MemoryDBManagement.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param from
 *            入口,请使用 TSUIConstants 类中提供的枚举。
 * @return 打开的库管理对话框;
 */
public MemoryDatabaseManagementDialog openDBMgmgDialog(Entry from) {
	if (from.equals(TsUIConstants.Entry.MENU)) {
		if (isMemory){
			ts.menuDBManagement().click();
		} else {
			ts.menuTeriDBManagement().click();
		}
	} else if (from.equals(TsUIConstants.Entry.SHORTCUT)) {
		try {
			ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D"));
		} catch (ParseException e) {
			e.printStackTrace();
			assertTrue("快捷键解析错误。", false);
		}
	} else {
		assertTrue("参数错误,该功能无此入口:" + from, false);
	}
	dialog = new MemoryDatabaseManagementDialog(MemoryDatabaseManagementDialog.MANAGEMENT,isMemory?"dlgTitleMemoryManagement":"dlgTitletreiTbManagement");
	return dialog;
}
 
Example #12
Source File: PreTranslate.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 打开预翻译对话框
 * @param from
 *            入口,请使用 TSUIConstants 类提供的常量
 * @return 预翻译对话框对象;
 */
private PreTranslateDialog openPreTransDlg(Entry from) {
	select();

	switch (from) {
	case MENU: {
		ts.menuTranslationPreTrans().click();
		break;
	}
	case CONTEXT_MENU: {
		ProjectTreeView.getInstance().ctxMenuPreTranslate().click();
		break;
	}
	case SHORTCUT: {
		ProjectTreeView.getTree().pressShortcut(Keystrokes.SHIFT, Keystrokes.F5);
		break;
	}
	default: {
		assertTrue("参数错误,无此入口:" + from, false);
	}
	}

	dlgPreTrans = new PreTranslateDialog();
	assertTrue("预翻译对话框未正确打开。", dlgPreTrans.isOpen());
	return dlgPreTrans;
}
 
Example #13
Source File: XlfEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 跳到指定文本段
 * @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 #14
Source File: XlfEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param text
 *            文本内容,其中的内部标记为源代码形式(必须对其中的双引号进行转义)
 * @param fromSegNum
 *            查找的起始文本段序号
 * @return int 从指定序号的文本段起,源文本内容等于指定内容的文本段序号(精确匹配)
 */
public int segNumOfSource(String text, int fromSegNum) {
	if (text == null) {
		return -1;
	}
	getNatTable();
	nattable.click(1, 1);
	int columnPosition = positionOfSourceTextColumn();
	int rowPosition;
	String srcText;
	selectSourceCell(fromSegNum);
	for (int i = fromSegNum; i <= segCount(); i++) {
		rowPosition = nattable.positionOfSelectedRow();
		srcText = nattable.getTextByPosition(rowPosition, columnPosition);
		if (text.equals(srcText) || text.equals(XliffUtil.tagged(srcText))) {
			// 考虑标记的两种显示状态
			int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants
					.getString("lblNatTableHeaderLineNum"));
			return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition));
		}
		nattable.pressShortcut(Keystrokes.DOWN); // 输入向下方向键
	}
	return -1;
}
 
Example #15
Source File: XlfEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param text
 *            文本内容,其中的内部标记为源代码形式(必须对其中的双引号进行转义)
 * @param fromSegNum
 *            查找的起始文本段序号
 * @return int 从指定序号的文本段起,源文本内容包含指定内容的文本段序号(模糊匹配)
 */
public int segNumContainsSource(String text, int fromSegNum) {
	if (text == null) {
		return -1;
	}
	getNatTable();
	int columnPosition = positionOfSourceTextColumn();
	int rowPosition;
	String srcText;
	selectSourceCell(fromSegNum);
	for (int i = fromSegNum; i <= segCount(); i++) {
		rowPosition = nattable.positionOfSelectedRow();
		srcText = nattable.getTextByPosition(rowPosition, columnPosition);
		if (srcText != null && (srcText.contains(text) || XliffUtil.tagged(srcText).contains(text))) {
			// 考虑标记的两种显示状态
			int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants
					.getString("lblNatTableHeaderLineNum"));
			return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition));
		}
		nattable.pressShortcut(Keystrokes.DOWN); // 输入向下方向键
	}
	return -1;
}
 
Example #16
Source File: BotBdmModelEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BotBdmModelEditor renameAttribute(String packageName, String businessObject, String oldAttributeName,
        String newAttributeName) {
    SWTBotTable attributeTable = getAttributeTable(packageName, businessObject);
    bot.waitUntil(Conditions.widgetIsEnabled(attributeTable));
    bot.waitUntil(new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
            attributeTable.getTableItem(oldAttributeName).select();
            return attributeTable.selectionCount() == 1;
        }

        @Override
        public String getFailureMessage() {
            return String.format("Cannot select '%s' row in attribute table", oldAttributeName);
        }
    });
    attributeTable.getTableItem(oldAttributeName).click();
    bot.textWithId(SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR)
            .setText(newAttributeName)
            .pressShortcut(Keystrokes.CR);
    attributeTable.setFocus();
    return this;
}
 
Example #17
Source File: BotBdmModelEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 #18
Source File: BotBdmModelEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotBdmModelEditor renameBusinessObject(String packageName, String oldName, String newName) {
    SWTBotTree businessObjectTree = getBusinessObjectTree();
    bot.waitUntil(treeItemAvailable(businessObjectTree, packageName));
    SWTBotTreeItem packageItem = businessObjectTree.getTreeItem(packageName);
    packageItem.expand();
    bot.waitUntil(nodeAvailable(packageItem, oldName));
    packageItem.getNode(oldName).click();
    bot.textWithId(SWTBOT_ID_BO_NAME_TEXTEDITOR)
            .setText(newName)
            .pressShortcut(Keystrokes.CR);
    businessObjectTree.setFocus();
    return this;
}
 
Example #19
Source File: ConnectorDefinitionWizardPageTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void openConnectorDefinitionWizardPage(String id) {
    final String packageLang = "java.lang.";
    final String packageUtil = "java.util.";
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    Keyboard key = KeyboardFactory.getSWTKeyboard();
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, "1.0.0");
    bot.button(IDialogConstants.NEXT_LABEL).click();
    SWTBotTable table = bot.table();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    table.click(1, 2);
    bot.ccomboBox().setSelection(packageLang + "Boolean");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(2, 2);
    bot.ccomboBox().setSelection(packageLang + "Double");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(3, 2);
    bot.ccomboBox().setSelection(packageLang + "Float");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(4, 2);
    bot.ccomboBox().setSelection(packageLang + "Integer");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(5, 2);
    bot.ccomboBox().setSelection(packageUtil + "List");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(6, 2);
    bot.ccomboBox().setSelection(packageUtil + "Map");
    key.pressShortcut(Keystrokes.CR);
    bot.button(IDialogConstants.NEXT_LABEL).click();

}
 
Example #20
Source File: BotBdmConstraintsEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #21
Source File: BotBdmIndexesEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #22
Source File: SWTBotTestUtil.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public static void selectExpressionProposal(final SWTBot bot, final String storageExpressionName,
        final String returnType, final int index) {
    bot.toolbarButtonWithId(SWTBOT_ID_EXPRESSIONVIEWER_DROPDOWN, index).click();
    final SWTBotShell proposalShell = bot.shellWithId(SWTBOT_ID_EXPRESSIONVIEWER_PROPOSAL_SHELL);
    final SWTBot proposalBot = proposalShell.bot();
    final SWTBotTable proposalTAble = proposalBot.tableWithId(SWTBOT_ID_EXPRESSIONVIEWER_PROPOSAL_TABLE);
    final int row = proposalTAble.indexOf(storageExpressionName + " -- " + returnType, 0);
    if (row == -1) {
        throw new WidgetNotFoundException(storageExpressionName + " not found in proposals");
    }
    proposalTAble.select(row);
    proposalTAble.pressShortcut(Keystrokes.CR);
    bot.waitUntil(Conditions.shellCloses(proposalShell));
}
 
Example #23
Source File: BotActorDefinitionPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotActorDefinitionPropertySection addActor(final String name, final String description) {
    bot.button(Messages.addActor).click();
    final SWTBotTable table = bot.table();

    table.click(table.rowCount() - 1, 1);
    bot.text()
            .typeText(name)
            .pressShortcut(Keystrokes.CR);

    table.click(table.rowCount() - 1, 2);
    bot.text()
            .typeText(description)
            .pressShortcut(Keystrokes.CR);
    return this;
}
 
Example #24
Source File: BotContractConstraintRow.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotContractConstraintRow setName(final String name) {
    constraintTable.setFocus();
    constraintTable.click(row, NAME_COLUMN);
    bot.textWithId(SWTBotConstants.SWTBOT_ID_CONSTRAINT_NAME_TEXTEDITOR)
     .typeText(name)
     .pressShortcut(Keystrokes.CR);
    bot.waitUntil(textApplied(name, NAME_COLUMN));
    return this;
}
 
Example #25
Source File: BotContractConstraintRow.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotContractConstraintRow setErrorMessages(final String errorMessage) {
    constraintTable.setFocus();
    constraintTable.click(row, ERROR_MESSAGE_COLUMN);
    bot.textWithId(SWTBotConstants.SWTBOT_ID_CONSTRAINT_ERROR_MESSAGE_TEXTEDITOR) 
     .typeText(errorMessage)
     .pressShortcut(Keystrokes.CR);
    bot.waitUntil(textApplied(errorMessage, ERROR_MESSAGE_COLUMN));
    return this;
}
 
Example #26
Source File: BotContractInputRow.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotContractInputRow setName(final String name) {
    waitForInputTree();
    swtBotTreeItem.setFocus();
    swtBotTreeItem.click(NAME_COLUMN);
    bot.textWithId(SWTBotConstants.SWTBOT_ID_INPUT_NAME_TEXTEDITOR)
            .typeText(name)
            .pressShortcut(Keystrokes.CR);
    return this;
}
 
Example #27
Source File: BotContractInputRow.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotContractInputRow setDescription(final String description) {
    waitForInputTree();
    swtBotTreeItem.setFocus();
    swtBotTreeItem.click(DESCRIPTION_COLUMN);
    bot.textWithId(SWTBotConstants.SWTBOT_ID_INPUT_DESCRIPTION_TEXTEDITOR)
            .typeText(description)
            .pressShortcut(Keystrokes.CR);
    return this;
}
 
Example #28
Source File: BotContractInputRow.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotContractInputRow setType(final String type) {
    waitForInputTree();
    swtBotTreeItem.setFocus();
    swtBotTreeItem.click(TYPE_COLUMN);
    final SWTBotList comboBox = bot.list();
    comboBox.select(type);
    comboBox.pressShortcut(Keystrokes.CR);
    return this;
}
 
Example #29
Source File: ActorFilterDefinitionTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testAddInputs() throws Exception {
    final String id = "test5";
    final String textLabel = "Definition id *";
    final String version = "1.0.0";
    final String inputName = "testInput";
    final String mandatory = "Mandatory";
    final String value = "hello";
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    bot.textWithLabel(textLabel).setText(id);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Remove")), 5000);
    bot.button("Remove").click();
    SWTBotTable table = bot.table();
    table.click(0, 0);
    bot.sleep(500);
    bot.text(0).setText(inputName);
    table.click(0, 1);
    bot.ccomboBox().setSelection(mandatory);
    Keyboard key = KeyboardFactory.getSWTKeyboard();
    key.pressShortcut(Keystrokes.CR);
    bot.waitUntil(Conditions.widgetIsEnabled(table));
    table.click(0, 3);
    bot.text().setText("hello");
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ActorFilterDefRepositoryStore store = (ActorFilterDefRepositoryStore) RepositoryManager
            .getInstance().getRepositoryStore(ActorFilterDefRepositoryStore.class);
    ConnectorDefinition actorDefinition = store.getDefinition(id, version);
    assertEquals("wrong number of inputs", actorDefinition.getInput()
            .size(), 2);
    Input input = actorDefinition.getInput().get(0);
    assertEquals("wrong input name", input.getName(), inputName);
    assertEquals("wrong input value", input.getDefaultValue(), value);
    assertTrue("input should be mandatory", input.isMandatory());
}
 
Example #30
Source File: ActorFilterDefinitionWizardPageTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void openActorFilterDefinitionWizardPage(String id) {
    final String packageLang = "java.lang.";
    final String packageUtil = "java.util.";
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    Keyboard key = KeyboardFactory.getSWTKeyboard();
    SWTBotActorFilterUtil.activateActorFilterDefinitionShell(bot);
    SWTBotActorFilterUtil.createActorFilterDefinition(bot, id, "1.0.0");
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL)), 5000);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    SWTBotTable table = bot.table();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    table.click(1, 2);
    bot.ccomboBox().setSelection(packageLang + "Boolean");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(2, 2);
    bot.ccomboBox().setSelection(packageLang + "Double");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(3, 2);
    bot.ccomboBox().setSelection(packageLang + "Float");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(4, 2);
    bot.ccomboBox().setSelection(packageLang + "Integer");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(5, 2);
    bot.ccomboBox().setSelection(packageUtil + "List");
    key.pressShortcut(Keystrokes.CR);
    bot.button("Add...").click();
    table.click(6, 2);
    bot.ccomboBox().setSelection(packageUtil + "Map");
    key.pressShortcut(Keystrokes.CR);
    bot.button(IDialogConstants.NEXT_LABEL).click();

}