Java Code Examples for org.eclipse.swtbot.swt.finder.SWTBot#textWithLabel()

The following examples show how to use org.eclipse.swtbot.swt.finder.SWTBot#textWithLabel() . 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: AbstractRefactoringSwtBotTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public void renameInXtendEditor(final SWTBotEclipseEditor xtendEditor, final String newName, final String dialogName) {
  final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(xtendEditor, "Refactor", "Rename Element");
  renameMenuItem.click();
  boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
  if (_isUseInlineRefactoring) {
    this.waitForLinkedMode();
    xtendEditor.typeText(newName);
    boolean _isUsePreview = this.testParams.isUsePreview();
    if (_isUsePreview) {
      xtendEditor.pressShortcut(SWT.CTRL, SWT.CR);
      AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
      AbstractRefactoringSwtBotTest.bot.button("OK").click();
    } else {
      xtendEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
    }
  } else {
    SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
    final Procedure1<SWTBot> _function = (SWTBot it) -> {
      SWTBotText _textWithLabel = it.textWithLabel("New name:");
      _textWithLabel.setText(newName);
      boolean _isUsePreview_1 = this.testParams.isUsePreview();
      if (_isUsePreview_1) {
        it.button("Preview >").click();
      }
      it.button("OK").click();
    };
    ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
  }
  this.waitForRefactoring(xtendEditor);
}
 
Example 2
Source File: AbstractRefactoringSwtBotTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public void renameInJavaEditor(final SWTBotEclipseEditor javaEditor, final String newName, final String dialogName) {
  final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(javaEditor, "Refactor", "Rename...");
  renameMenuItem.click();
  boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
  if (_isUseInlineRefactoring) {
    javaEditor.typeText(newName);
    boolean _isUsePreview = this.testParams.isUsePreview();
    if (_isUsePreview) {
      javaEditor.pressShortcut(SWT.CTRL, SWT.CR);
      AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
      AbstractRefactoringSwtBotTest.bot.button("OK").click();
    } else {
      javaEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
    }
  } else {
    SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
    final Procedure1<SWTBot> _function = (SWTBot it) -> {
      SWTBotText _textWithLabel = it.textWithLabel("New name:");
      _textWithLabel.setText(newName);
      boolean _isUsePreview_1 = this.testParams.isUsePreview();
      if (_isUsePreview_1) {
        it.button("Next").click();
      }
      it.button("Finish").click();
    };
    ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
  }
  this.waitForRefactoring(javaEditor);
}
 
Example 3
Source File: SDViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test Sequence diagram print dialog
 */
@Test
public void testSDPrintUi() {
    SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID);
    assertNotNull(viewBot);
    viewBot.setFocus();
    WaitUtils.waitForJobs();

    // Test print dialog
    SWTBotCanvas canvas = viewBot.bot().canvas(1);
    canvas.setFocus();
    canvas.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('P'));
    SWTBotShell printShell = fBot.shell("Print");
    assertNotNull(printShell);
    SWTBot printBot = printShell.bot();

    printBot.radio("Use current zoom").click();

    SWTBotRadio allPages = printBot.radio("All pages");
    SWTBotRadio currentView = printBot.radio("Current view");
    // 'All pages' and 'Current view' buttons will be enabled
    allPages.click();
    currentView.click();

    // Test 'Number of horizontal pages' button
    printBot.radio("Number of horizontal pages:").click();
    SWTBotText horizontalPagesText = printBot.text(0);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), horizontalPagesText, "Number of horizontal pages should be 1");
    horizontalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), horizontalPagesText, "Number of horizontal pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'Number of vertical pages' button
    SWTBotText totalPagesText = printBot.textWithLabel("Total number of pages:");
    printBot.radio("Number of vertical pages:").click();
    SWTBotText verticalPagesText = printBot.text(1);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), verticalPagesText, "Number of vertical pages should be 1");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), totalPagesText, "Total number of pages should be 1");
    verticalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), verticalPagesText, "Number of vertical pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'selected pages' button
    printBot.radio("Selected pages").click();
    assertFalse(currentView.isEnabled());

    // Test 'From pages' buttons
    printBot.radio("From page").click();
    SWTBotText fromText = printBot.text(3);
    SWTBotText toText = printBot.text(4);
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), fromText, "From text is not empty");
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), toText, "To text is not empty");
    fromText.setText("2");
    toText.setText("3");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), fromText, "From text is not 2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(3)), toText, "To text is not 3");
    assertFalse(currentView.isEnabled());

    // Don't actually print
    printBot.button("Cancel").click();
    printBot.waitUntil(Conditions.shellCloses(printShell));
}
 
Example 4
Source File: TsUIConstants.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 * @param labelKey
 * @return ;
 */
public static SWTBotText textWithLabel(SWTBot bot, String labelKey) {
	return bot.textWithLabel(getString(labelKey));
}
 
Example 5
Source File: TsUIConstants.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 * @param labelKey
 * @return ;
 */
public static SWTBotText textWithLabel(SWTBot bot, String labelKey) {
	return bot.textWithLabel(getString(labelKey));
}