Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTable#setFocus()

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotTable#setFocus() . 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: 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 2
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void goToTime(long timestamp) {
    ITmfTimestamp time = TmfTimestamp.fromNanos(timestamp);
    SWTBotTable table = sfBot.activeEditor().bot().table();
    table.setFocus();
    WaitUtils.waitForJobs();
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, time));
    sfBot.waitUntil(ConditionHelpers.selectionInEventsTable(sfBot, timestamp));
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    IWorkbenchPart part = viewBot.getViewReference().getPart(false);
    sfBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(time, time), time));
}
 
Example 3
Source File: SwtBotProjectActions.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create a Maven project from Archetype and land in the Java perspective.
 */
public static void createMavenProjectFromArchetype(final SWTWorkbenchBot bot, String groupId,
    String artifactId, String packageName, String archetypeGroupId, String archetypeArtifactId,
    String archetypeVersion, String archetypeUrl) {
  // create maven project
  SwtBotMenuActions.openNewMavenProject(bot);

  // move to next step, archetype selection
  bot.button("Next >").click();

  // include snapshot archetypes checkbox
  bot.checkBox(1).click();

  // open archetype dialog
  SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      bot.button("Add Archetype...").click();
    }
  });

  // Dialog: "New Maven Project"
  // The Archetype project source lives here
  // Generated with this repos generator
  bot.comboBox(0).setText(archetypeGroupId);
  bot.comboBox(1).setText(archetypeArtifactId);
  bot.comboBox(2).setText(archetypeVersion);
  bot.comboBox(3).setText(archetypeUrl);

  // close archetype dialog
  SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      // After OK, it will take a minute to download
      bot.button("OK").click();
    }
  });

  // filter so only one row shows up
  bot.text().setText(archetypeArtifactId);

  // select first row
  SWTBotTable table = bot.table();
  table.setFocus();
  table.getTableItem(0).select();

  // move to last wizard
  bot.button("Next >").click();

  // set archetype inputs
  bot.comboBox(0).setText(groupId);
  bot.comboBox(1).setText(artifactId);
  bot.comboBox(3).setText(packageName);

  // finish and close dialog, and it will init
  bot.button("Finish").click();

  // change to the java perpective for next stage
  SwtBotMenuActions.openJavaPerpsective(bot);

  // select the first project
  bot.tree().setFocus();
}