Package org.eclipse.swtbot.swt.finder.widgets

Examples of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton


        project.newFile("file1.md");
        project.newFile("file2.md");

        MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
        assertThat(MarkdownViewBot.isPresent(), is(true));
        SWTBotToolbarButton linkedButton = markdownViewBot.getLinkedButton();

        EditorBot editorBot1 = EditorBot.findByName("file1.md").show();
        SWTUtils.sleep(2000);
        assertThat(markdownViewBot.getTitle(), is("file1"));

        EditorBot editorBot2 = EditorBot.findByName("file2.md").show();
        SWTUtils.sleep(2000);
        assertThat(markdownViewBot.getTitle(), is("file2"));

        linkedButton.click(); // set unlinked

        editorBot2.close();
        SWTUtils.sleep(2000);
        assertThat(markdownViewBot.getTitle(), is("file2"));

        editorBot1.close();
        SWTUtils.sleep(2000);
        assertThat(markdownViewBot.getTitle(), is("file2"));

        linkedButton.click();
        markdownViewBot.close();
        project.delete();
    }
View Full Code Here


       
        assertThat(MarkdownViewBot.isPresent(), is(false));
        MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
        assertThat(MarkdownViewBot.isPresent(), is(true));

        SWTBotToolbarButton onlineButton = markdownViewBot.getOnlineButton();
        SWTBotToolbarButton reloadButton = markdownViewBot.getReloadButton();

        ProjectBot project = ProjectBot.createSimpleProject();
        ProjectFileBot fileBot = project.newFile("file1.md");
        EditorBot editorBot = EditorBot.findByName("file1.md");

        String textMd1 = "sample text 1, timestamp: " + System.currentTimeMillis() + ".";
        editorBot.typeText(textMd1 + "\r");
        editorBot.save();

        onlineButton.click(); // set offline

        String textMd2 = "sample text 2, timestamp: " + System.currentTimeMillis() + ".";
        editorBot.typeText(textMd2 + "\r");
        editorBot.save();
        SWTUtils.sleep(2000);

        File fileMd = fileBot.toFile();
        File fileHt = new File(fileMd.getParentFile(), ".file1.md.html");
        assertThat("not found: " + fileHt, fileHt.exists(), is(true));

        assertThat(markdownViewBot.getTitle(), is("*file1"));
        String textHt1 = IOUtils.toString(new FileInputStream(fileHt));
        assertThat(textHt1, containsString(textMd1));
        assertThat(textHt1, not(containsString(textMd2)));

        reloadButton.click();
        SWTUtils.sleep(2000);

        assertThat(markdownViewBot.getTitle(), is("*file1"));
        String textHt2 = IOUtils.toString(new FileInputStream(fileHt));
        assertThat(textHt2, containsString(textMd1));
        assertThat(textHt2, not(containsString(textMd2)));

        onlineButton.click(); // set online
        reloadButton.click();
        SWTUtils.sleep(2000);

        assertThat(markdownViewBot.getTitle(), is("file1"));
        String textHt3 = IOUtils.toString(new FileInputStream(fileHt));
        assertThat(textHt3, containsString(textMd1));
View Full Code Here

    String trackingBranch = Constants.R_REMOTES + "origin/master";
    launchSynchronization(Constants.HEAD, trackingBranch, false);

    SWTBotView viewBot = bot.viewByTitle("Synchronize");
    SWTBotToolbarButton pushButton = viewBot.toolbarButton(UIText.GitActionContributor_Push);
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 30, TimeUnit.SECONDS);
    pushButton.click();
    jobJoiner.join();

    String destinationString = repositoryFile.getParentFile().getName() + " - " + "origin";
    SWTBotShell resultDialog = bot.shell(NLS.bind(UIText.PushResultDialog_title, destinationString));
    resultDialog.close();
View Full Code Here

  @Test
  public void toolbarPushButton() throws Exception {
    SWTBotView view = bot.viewByTitle("SWTBot Test View");

    SWTBotToolbarButton button = view.toolbarButton("This represents an IAction command.");
    assertNotNull(button);

    button.click();
    bot.button("OK").click();
  }
View Full Code Here

   * @param tooltip The tooltip to use to find the button to return.
   * @return The toolbar button.
   * @throws WidgetNotFoundException Thrown if the widget was not found matching the given tooltip.
   */
  public SWTBotToolbarDropDownButton toolbarDropDownButton(String tooltip) throws WidgetNotFoundException {
    SWTBotToolbarButton abstractButton = toolbarButton(tooltip);
    if (abstractButton instanceof SWTBotToolbarDropDownButton)
      return (SWTBotToolbarDropDownButton) abstractButton;

    throw new WidgetNotFoundException("Unable to find toolitem with the given tooltip '" + tooltip + "'"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

   * @param tooltip The tooltip to use to find the button to return.
   * @return The toolbar button.
   * @throws WidgetNotFoundException Thrown if the widget was not found matching the given tooltip.
   */
  public SWTBotToolbarRadioButton toolbarRadioButton(String tooltip) throws WidgetNotFoundException {
    SWTBotToolbarButton abstractButton = toolbarButton(tooltip);
    if (abstractButton instanceof SWTBotToolbarRadioButton)
      return (SWTBotToolbarRadioButton) abstractButton;

    throw new WidgetNotFoundException("Unable to find toolitem with the given tooltip '" + tooltip + "'"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

   * @param tooltip The tooltip to use to find the button to return.
   * @return The toolbar button.
   * @throws WidgetNotFoundException Thrown if the widget was not found matching the given tooltip.
   */
  public SWTBotToolbarPushButton toolbarPushButton(String tooltip) throws WidgetNotFoundException {
    SWTBotToolbarButton abstractButton = toolbarButton(tooltip);
    if (abstractButton instanceof SWTBotToolbarPushButton)
      return (SWTBotToolbarPushButton) abstractButton;

    throw new WidgetNotFoundException("Unable to find toolitem with the given tooltip '" + tooltip + "'"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

   * @param tooltip The tooltip to use to find the button to return.
   * @return The toolbar button.
   * @throws WidgetNotFoundException Thrown if the widget was not found matching the given tooltip.
   */
  public SWTBotToolbarToggleButton toolbarToggleButton(String tooltip) throws WidgetNotFoundException {
    SWTBotToolbarButton abstractButton = toolbarButton(tooltip);
    if (abstractButton instanceof SWTBotToolbarToggleButton)
      return (SWTBotToolbarToggleButton) abstractButton;

    throw new WidgetNotFoundException("Unable to find toolitem with the given tooltip '" + tooltip + "'"); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

   */
  public SWTBotToolbarButton toolbarButton(String tooltip) throws WidgetNotFoundException {
    List<SWTBotToolbarButton> l = getToolbarButtons();

    for (int i = 0; i < l.size(); i++) {
      SWTBotToolbarButton item = l.get(i);
      if (item.getToolTipText().equals(tooltip)) {
        return item;
      }
    }

    throw new WidgetNotFoundException("Unable to find toolitem with the given tooltip '" + tooltip + "'"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

TOP

Related Classes of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.