当前位置: 首页>>代码示例>>Java>>正文


Java SWTWorkbenchBot.waitUntil方法代码示例

本文整理汇总了Java中org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.waitUntil方法的典型用法代码示例。如果您正苦于以下问题:Java SWTWorkbenchBot.waitUntil方法的具体用法?Java SWTWorkbenchBot.waitUntil怎么用?Java SWTWorkbenchBot.waitUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot的用法示例。


在下文中一共展示了SWTWorkbenchBot.waitUntil方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static GW4EProject create (SWTWorkbenchBot bot,String gwproject) throws CoreException, FileNotFoundException  {
	GW4EProject project = new GW4EProject(bot, gwproject);
	project.resetToJavPerspective();
	project.createProject();
	
	File path = new File("src/test/resources/petclinic");
	IContainer destFolder = (IContainer) ResourceManager.getResource(gwproject+ "/src/test/resources");
	ImportHelper.copyFiles(path,destFolder);
	
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	String[] temp = new String[2];
	temp[0] = gwproject;
	temp[1] = folders[1];
	project.generateSource(temp);
	bot.waitUntil(new EditorOpenedCondition(bot, "VeterinariensSharedStateImpl.java"), 3 * 60000);
	project.waitForBuildAndAssertNoErrors();
	return project;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:19,代码来源:PetClinicProject.java

示例2: openNewGraphWalkerModel

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void openNewGraphWalkerModel(SWTWorkbenchBot bot) {
	
	SWTBotMenu all = bot.menu("File").menu("New");
	
	/*
	Function<String, String>   f =  new Function<String, String> () {

		@Override
		public String apply(String t) {
			return t;
		}
		
	};
	all.menuItems().stream().map(f);
	*/
	
	bot.menu("File").menu("New").menu("GW4E Model").click();
	bot.waitUntil(new ShellActiveCondition("GW4E"));
	SWTBotShell shell = bot.shell("GW4E");
	assertTrue(shell.isOpen());
	shell.bot().button("Cancel").click();
	bot.waitUntil(Conditions.shellCloses(shell));
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:GW4EPerspective.java

示例3: waitUntilTreeItemHasChild

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Wait until a tree item contains a child with the given text.
 * 
 * @throws TimeoutException if the child does not appear within the default timeout
 */
public static void waitUntilTreeItemHasChild(SWTWorkbenchBot bot, final SWTBotTreeItem treeItem,
    final String childText) {
  bot.waitUntil(new DefaultCondition() {
    @Override
    public String getFailureMessage() {
      System.err.println(treeItem + ": expanded? " + treeItem.isExpanded());
      for (SWTBotTreeItem childNode : treeItem.getItems()) {
        System.err.println("    " + childNode);
      }
      return "Tree item never appeared";
    }

    @Override
    public boolean test() throws Exception {
      return treeItem.getNodes().contains(childText);
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:SwtBotTreeUtilities.java

示例4: waitUntilTreeContainsText

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Wait until the tree item contains the given text with the timeout specified.
 */
public static void waitUntilTreeContainsText(SWTWorkbenchBot bot,
                                             final SWTBotTreeItem treeItem,
                                             final String text,
                                             long timeout) {
  bot.waitUntil(new DefaultCondition() {
    @Override
    public boolean test() throws Exception {
      return treeItem.getText().contains(text);
    }

    @Override
    public String getFailureMessage() {
      return "Text never appeared";
    }
  }, timeout);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:SwtBotTreeUtilities.java

示例5: assertShellWithDataTypeVisible

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Tests if a shell with a specific type of data contained (e.g. Window).
 * 
 * @param bot
 *          to use
 * @param clazz
 *          class of data contained to check for
 */
@SuppressWarnings("rawtypes")
public static void assertShellWithDataTypeVisible(final SWTWorkbenchBot bot, final Class clazz) {
  bot.waitUntil(Conditions.waitForShell(new BaseMatcher<Shell>() {
    @SuppressWarnings("unchecked")
    public boolean matches(final Object item) {
      return UIThreadRunnable.syncExec(new Result<Boolean>() {
        public Boolean run() {
          if (item instanceof Shell) {
            Object shellData = ((Shell) item).getData();
            if (shellData != null) {
              return clazz.isAssignableFrom(shellData.getClass());
            }
          }
          return false;
        }
      });
    }

    public void describeTo(final Description description) {
      description.appendText("Shell for " + clazz.getName());
    }
  }));
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:32,代码来源:ShellUiTestUtil.java

示例6: safeBlockingCollapse

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Waits until the node collapses.
 *
 * @param bot
 *          bot to work with, must not be {@code null}
 * @param node
 *          node to wait for, must not be {@code null}
 */
public static void safeBlockingCollapse(final SWTWorkbenchBot bot, final SWTBotTreeItem node) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  Assert.isNotNull(node, ARGUMENT_NODE);
  if (node.isExpanded()) {
    node.collapse();
    try {
      bot.waitUntil(new DefaultCondition() {

        @Override
        @SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
        public boolean test() {
          return !node.isExpanded();
        }

        @Override
        public String getFailureMessage() {
          return "Timeout for node to collapse";
        }
      }, TIMEOUT_FOR_NODE_TO_COLLAPSE_EXPAND);
    } catch (TimeoutException e) {
      // Try one last time and do not wait anymore
      node.collapse();
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:34,代码来源:CoreSwtbotTools.java

示例7: setUp

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Pre flight initialization (run once for each test _case_)
 */
@Before
public void setUp() throws Exception {
	// Force shell activation to counter, no active Shell when running SWTBot tests in Xvfb/Xvnc
	// see https://wiki.eclipse.org/SWTBot/Troubleshooting#No_active_Shell_when_running_SWTBot_tests_in_Xvfb
	Display.getDefault().syncExec(new Runnable() {
		public void run() {
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive();
		}
	});
	
	bot = new SWTWorkbenchBot();

	// Wait for the Toolbox shell to be available
	final Matcher<Shell> withText = withText("TLA+ Toolbox");
	bot.waitUntil(Conditions.waitForShell(withText), 30000);
	
	// Wait for the Toolbox UI to be fully started.
	final Matcher<MenuItem> withMnemonic = WidgetMatcherFactory.withMnemonic("File");
	final Matcher<MenuItem> matcher = WidgetMatcherFactory.allOf(WidgetMatcherFactory.widgetOfType(MenuItem.class),
			withMnemonic);
	bot.waitUntil(Conditions.waitForMenu(bot.shell("TLA+ Toolbox"), matcher), 30000);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:26,代码来源:AbstractTest.java

示例8: beforeClass

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	RCPTestSetupHelper.beforeClass();
	
	// Force shell activation to counter, no active Shell when running SWTBot tests in Xvfb/Xvnc
	// see https://wiki.eclipse.org/SWTBot/Troubleshooting#No_active_Shell_when_running_SWTBot_tests_in_Xvfb
	Display.getDefault().syncExec(new Runnable() {
		public void run() {
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive();
		}
	});
	
	bot = new SWTWorkbenchBot();

	// Wait for the Toolbox shell to be available
	final Matcher<Shell> withText = withText("TLA+ Toolbox");
	bot.waitUntil(Conditions.waitForShell(withText), 30000);
	
	// Wait for the Toolbox UI to be fully started.
	final Matcher<MenuItem> withMnemonic = WidgetMatcherFactory.withMnemonic("File");
	final Matcher<MenuItem> matcher = WidgetMatcherFactory.allOf(WidgetMatcherFactory.widgetOfType(MenuItem.class),
			withMnemonic);
	bot.waitUntil(Conditions.waitForMenu(bot.shell("TLA+ Toolbox"), matcher), 30000);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:25,代码来源:DeleteSpecHandlerTest.java

示例9: openPerspective

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void openPerspective(SWTWorkbenchBot bot, String perspectiveLabel) {
  SwtBotUtils.print("Opening Perspective: " + perspectiveLabel);

  SWTBotShell shell = null;
  try {
    menu(bot, "Window").menu("Open Perspective").menu("Other...").click();

    shell = bot.shell("Open Perspective");

    bot.waitUntil(ActiveWidgetCondition.widgetMakeActive(shell));
    shell.bot().table().select(perspectiveLabel);

    shell.bot().button("OK").click();
    bot.waitUntil(Conditions.shellCloses(shell));
  } catch (Exception e) {
    if (shell != null && shell.isOpen()) shell.close();
    SwtBotUtils.printError("Couldn't open perspective '" + perspectiveLabel + "'\n"
        + "trying to activate already open perspective instead");
    // maybe somehow the perspective is already opened (by another test before us)
    SWTBotPerspective perspective = bot.perspectiveByLabel(perspectiveLabel);
    perspective.activate();
  }

  SwtBotUtils.print("Opened Perspective: " + perspectiveLabel);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:26,代码来源:SwtBotMenuActions.java

示例10: importProjectFromZip

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void importProjectFromZip(SWTWorkbenchBot bot, String path) {
	int timeout = 10000;
	bot.menu("File").menu("Import...").click();
	bot.waitUntil(Conditions.shellIsActive("Import"));
	SWTBotShell shell = bot.shell("Import").activate();

	shell.bot().tree().expandNode("General").select("Existing Projects into Workspace");
	shell.bot().button("Next >").click();
	shell.bot().radio("Select archive file:").click();

	shell.bot().comboBox(1).setText(path);
	shell.bot().comboBox(1).pressShortcut(SWT.CR, SWT.LF);
	SWTBotButton finishButton = shell.bot().button("Finish");
	ICondition buttonEnabled = new DefaultCondition() {
		@Override
		public boolean test() throws Exception {
			return finishButton.isEnabled();
		}

		@Override
		public String getFailureMessage() {
			return "Finish button not enabled";
		}
	};

	shell.bot().waitUntil(buttonEnabled, timeout);
	finishButton.click();

	bot.waitUntil(Conditions.shellCloses(shell), timeout);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:31,代码来源:ImportHelper.java

示例11: waitUntilTreeHasItems

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Wait until the given tree has items, and return the first item.
 * 
 * @throws TimeoutException if no items appear within the default timeout
 */
public static SWTBotTreeItem waitUntilTreeHasItems(SWTWorkbenchBot bot, final SWTBotTree tree) {
  bot.waitUntil(new DefaultCondition() {
    @Override
    public String getFailureMessage() {
      return "Tree items never appeared";
    }

    @Override
    public boolean test() throws Exception {
      return tree.hasItems();
    }
  });
  return tree.getAllItems()[0];
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:SwtBotTreeUtilities.java

示例12: waitUntilTreeHasNoItems

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Wait until the given tree has not items.
 * 
 * @throws TimeoutException if no items appear within the default timeout
 */
public static void waitUntilTreeHasNoItems(SWTWorkbenchBot bot, final SWTBotTree tree) {
  bot.waitUntil(new DefaultCondition() {
    @Override
    public String getFailureMessage() {
      return "Tree items never disappeared";
    }

    @Override
    public boolean test() throws Exception {
      return !tree.hasItems();
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:SwtBotTreeUtilities.java

示例13: safeBlockingExpand

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Waits until the node expands.
 *
 * @param bot
 *          bot to work with, must not be {@code null}
 * @param node
 *          node to wait for, must not be {@code null}
 */
public static void safeBlockingExpand(final SWTWorkbenchBot bot, final SWTBotTreeItem node) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  Assert.isNotNull(node, ARGUMENT_NODE);
  if (!node.isExpanded()) {
    node.expand();
    try {
      bot.waitUntil(new DefaultCondition() {

        @Override
        @SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
        public boolean test() {
          return node.isExpanded();
        }

        @Override
        public String getFailureMessage() {
          return "Timeout for node to expand";
        }
      }, TIMEOUT_FOR_NODE_TO_COLLAPSE_EXPAND);

    } catch (TimeoutException e) {
      // Try one last time and do not wait anymore
      node.expand();
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:35,代码来源:CoreSwtbotTools.java

示例14: assertTextStyle

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
 * Checks the given offset for the given {@link TextStyle}.
 *
 * @param editor
 *          the {@link XtextEditor}
 * @param offset
 *          the position to check
 * @param textStyle
 *          the expected {@link TextStyle}
 * @param bot
 *          instance of swt bot
 */
public static void assertTextStyle(final XtextEditor editor, final int offset, final TextStyle textStyle, final SWTWorkbenchBot bot) {
  bot.waitUntil(new DefaultCondition() {
    @Override
    public boolean test() {
      return areEqualStyleRanges(createStyleRange(offset, 1, createTextAttribute(textStyle)), getStyleRange(editor, offset));
    }

    @Override
    public String getFailureMessage() {
      return STYLE_ASSERTION_FAILURE_MESSAGE;
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:AbstractSyntaxColoringTest.java

示例15: waitForConsoleOutput

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void waitForConsoleOutput(SWTWorkbenchBot bot, String string, long timeout) {
  bot.waitUntil(waitForConsoleContains(string), timeout);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:4,代码来源:ConsoleViewContains.java


注:本文中的org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.waitUntil方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。