Search in sources :

Example 1 with IsSegmentSelected

use of net.heartsome.cat.ts.test.ui.waits.IsSegmentSelected in project translationstudio8 by heartsome.

the class XlfEditor method gotoSeg.

/**
	 * 跳到指定文本段
	 * @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));
    }
}
Also used : IsSegmentSelected(net.heartsome.cat.ts.test.ui.waits.IsSegmentSelected) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText)

Aggregations

IsSegmentSelected (net.heartsome.cat.ts.test.ui.waits.IsSegmentSelected)1 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)1