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


Java SWTBotTreeItem.doubleClick方法代码示例

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


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

示例1: waitUntilTreeItemHasItem

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Blocks the caller until the tree item has the given item text.
 * 
 * @param tree the tree item to search
 * @param nodeText the item text to look for
 * @throws org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException if the item could not
 *         be found within the timeout period
 */
private static void waitUntilTreeItemHasItem(SWTBot bot, final SWTBotTreeItem tree,
    final String nodeText) {

  // Attempt #1
  if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) {
    // Attempt #2: Something went wrong, try to cautiously reopen it.
    bot.sleep(1000);

    // There isn't a method to collapse, so double-click instead
    tree.doubleClick();
    bot.waitUntil(new TreeCollapsedCondition(tree.widget));

    bot.sleep(1000);

    tree.expand();
    bot.waitUntil(new TreeExpandedCondition(tree.widget));

    if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) {
      printTree(tree.widget);
      throw new TimeoutException(
          String.format("Timed out waiting for %s, giving up...", nodeText));
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:33,代码来源:SwtBotTreeUtilities.java

示例2: testGotoBookmarkOnDoubleClick

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void testGotoBookmarkOnDoubleClick() throws Exception {
	// Given
	Bookmark bookmark = new Bookmark(new BookmarkId(), ImmutableMap.of(Bookmark.PROPERTY_NAME, "bookmark",
			PROP_WORKSPACE_PATH, "/BookmarksViewTest/src/main/java/org/apache/commons/cli/DefaultParser.java",
			PROP_LINE_CONTENT,
			"for (Enumeration<?> enumeration = properties.propertyNames(); enumeration.hasMoreElements();)"));
	addBookmark(getBookmarksRootFolderId(), bookmark);
	SWTBotTreeItem bookmarkTreeItem = waitUntil("Cannot find new bookmark",
			() -> bookmarksViewDriver.tree().getTreeItem("bookmark"));

	// When
	bookmarkTreeItem.doubleClick();

	// Then
	waitUntil("cannot go to bookmark", () -> "DefaultParser.java".equals(getActivePart().getTitle()));
	IWorkbenchPart workbenchPart = getActivePart();
	ITextSelection selection = (ITextSelection) getSelection(workbenchPart);
	assertEquals("DefaultParser.java", workbenchPart.getTitle());
	assertEquals(146, selection.getStartLine());
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:22,代码来源:BookmarksViewTest.java

示例3: testBookmarkProblemAddedOnDoubleClick

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void testBookmarkProblemAddedOnDoubleClick() throws Exception {
	// Given
	Bookmark bookmark = new Bookmark(new BookmarkId(), ImmutableMap.of(Bookmark.PROPERTY_NAME, "bookmark",
			PROP_WORKSPACE_PATH, "/BookmarksViewTest/src/main/java/org/apache/commons/cli/DefaultParser.java",
			PROP_LINE_CONTENT,
			"for (Enumeration<?> enumeration = properties.propertyNames(); enumeration.hasMoreElements();)"));
	addBookmark(getBookmarksRootFolderId(), bookmark);
	SWTBotTreeItem bookmarkTreeItem = waitUntil("Cannot find new bookmark",
			() -> bookmarksViewDriver.tree().getTreeItem("bookmark"));

	// When
	bookmarkTreeItem.doubleClick();

	// Then
	waitUntil("There should be a bookmark problem",
			() -> "One bookmark problem detected".equals(bookmarksViewDriver.form().getMessage()));
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:19,代码来源:BookmarksViewTest.java

示例4: testUpdateBookmarkPropertiesAction

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void testUpdateBookmarkPropertiesAction() throws Exception {
	// Given
	BookmarkId bookmarkId = new BookmarkId();
	Bookmark bookmark = new Bookmark(bookmarkId, ImmutableMap.of(Bookmark.PROPERTY_NAME, "bookmark",
			PROP_WORKSPACE_PATH, "/BookmarksViewTest/src/main/java/org/apache/commons/cli/DefaultParser.java",
			PROP_LINE_CONTENT,
			"for (Enumeration<?> enumeration = properties.propertyNames(); enumeration.hasMoreElements();)"));
	addBookmark(getBookmarksRootFolderId(), bookmark);
	SWTBotTreeItem bookmarkTreeItem = waitUntil("Cannot find new bookmark",
			() -> bookmarksViewDriver.tree().getTreeItem("bookmark"));
	bookmarkTreeItem.doubleClick();
	waitUntil("There should be a bookmark problem",
			() -> "One bookmark problem detected".equals(bookmarksViewDriver.form().getMessage()));

	// When
	bookmarksViewDriver.form().toolbarButtonWithTooltip("Use new properties", 0).click();

	// Then
	waitUntil("There should be no bookmark problem", () -> bookmarksViewDriver.form().getMessage() == null);
	assertEquals("for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();)",
			getBookmarksTree().getBookmark(bookmarkId)
					.getPropertyValue(TextEditorBookmarkProperties.PROP_LINE_CONTENT));
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:25,代码来源:BookmarksViewTest.java

示例5: waitUntilTreeItemHasItem

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Blocks the caller until the tree item has the given item text.
 *
 * @param tree the tree item to search
 * @param nodeText the item text to look for
 * @throws org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException if the item could not
 *         be found within the timeout period
 */
private static void waitUntilTreeItemHasItem(SWTBot bot, final SWTBotTreeItem tree,
    final String nodeText) {

  // Attempt #1
  if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) {
    // Attempt #2: Something went wrong, try to cautiously reopen it.
    bot.sleep(1000);

    // There isn't a method to collapse, so double-click instead
    tree.doubleClick();
    bot.waitUntil(new TreeCollapsedCondition(tree.widget));

    bot.sleep(1000);

    tree.expand();
    bot.waitUntil(new TreeExpandedCondition(tree.widget));

    if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) {
      printTree(tree.widget);
      throw new TimeoutException(
          String.format("Timed out waiting for %s, giving up...", nodeText));
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:33,代码来源:SwtBotTreeActions.java

示例6: waitUntilTreeHasText

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Blocks the caller until all of the direct children of the tree have text. The assumption is
 * that the tree does not have any "empty" children.
 *
 * TODO: Refactor some of this logic; it follows the same general pattern as
 * {@link #waitUntilTreeItemHasItem(SWTBot, SWTBotTreeItem, String)}.
 *
 * @param tree the tree to search
 * @throws TimeoutException if all of the direct children of the tree do not have text within the
 *         timeout period
 */
public static void waitUntilTreeHasText(SWTBot bot, final SWTBotTreeItem tree)
    throws TimeoutException {
  // Attempt #1
  if (!waitUntilTreeHasTextImpl(bot, tree.widget)) {
    // Attempt #2: Something went wrong, try to cautiously reopen it.
    bot.sleep(1000);

    // There isn't a method to collapse, so double-click instead
    tree.doubleClick();
    bot.waitUntil(new TreeCollapsedCondition(tree.widget));

    bot.sleep(1000);

    tree.expand();
    bot.waitUntil(new TreeExpandedCondition(tree.widget));

    if (!waitUntilTreeHasTextImpl(bot, tree.widget)) {
      printTree(tree.widget);
      throw new TimeoutException(
          "Timed out waiting for text of the tree's children, giving up...");
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:35,代码来源:SwtBotTreeActions.java

示例7: openFile

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * @param from
 *            打开文件的入口:右键菜单、双击,请使用 TS 类提供的常量;
 */
public void openFile(Entry from) {
	assertTrue("参数错误,Excel 数据行 row 为 null。", row != null);
	getDataFile();
	SWTBotTreeItem item = select();
	assertTrue("如下选择类型不是文件:" + selectType, selectType == TsUIConstants.ResourceType.FILE);

	switch (from) {
	case DOUBLE_CLICK: {
		item.doubleClick();
		break;
	}
	case CONTEXT_MENU: {
		view.ctxMenuOpenFile().click();
		break;
	}
	default: {
		assertTrue("参数错误,无此入口:" + from, false);
	}
	}
	HSBot.bot().waitUntil(new IsFileOpenedInEditor(fileName));
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:26,代码来源:ProjectFile.java

示例8: waitUntilTreeHasText

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Blocks the caller until all of the direct children of the tree have text. The assumption is
 * that the tree does not have any "empty" children.
 * 
 * @param tree the tree to search
 * @throws TimeoutException if any of the direct children of the tree do not have text within the
 *         timeout period
 */
public static void waitUntilTreeHasText(SWTBot bot, final SWTBotTreeItem tree)
    throws TimeoutException {
  // TODO: Refactor some of this logic; it follows the same general pattern as
  // {@link #waitUntilTreeItemHasItem(SWTBot, SWTBotTreeItem, String)}.

  // Attempt #1
  if (!waitUntilTreeHasTextImpl(bot, tree.widget)) {
    // Attempt #2: Something went wrong, try to cautiously reopen it.
    bot.sleep(1000);

    // There isn't a method to collapse, so double-click instead
    tree.doubleClick();
    bot.waitUntil(new TreeCollapsedCondition(tree.widget));

    bot.sleep(1000);

    tree.expand();
    bot.waitUntil(new TreeExpandedCondition(tree.widget));

    if (!waitUntilTreeHasTextImpl(bot, tree.widget)) {
      printTree(tree.widget);
      throw new TimeoutException(
          "Timed out waiting for text of the tree's children, giving up...");
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:35,代码来源:SwtBotTreeUtilities.java

示例9: selectProjectItem

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Select a file/folder by providing a parent tree, and a list of folders that leads to the
 * file/folder.
 *
 * @param item root tree item
 * @param folderPath list of folder names that lead to file
 * @return the SWTBotTreeItem of the final selected item, or {@code null} if not found
 */
public static SWTBotTreeItem selectProjectItem(SWTBotTreeItem item, String... folderPath) {
  for (String folder : folderPath) {
    if (item == null) {
      return null;
    }
    item.doubleClick();
    item = item.getNode(folder);
  }
  return item;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:SwtBotProjectActions.java

示例10: launchDevModeWithJettyAndWaitForReady

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Goto Debug As > "# MENU_GWT_SUPERDEVMODE"
 */
public static void launchDevModeWithJettyAndWaitForReady(SWTWorkbenchBot bot,
    String projectName) {
  SwtBotUtils.print("Launch DevMode with Jetty");

  // show it has focus
  SWTBotTreeItem project = SwtBotProjectActions.selectProject(bot, projectName);
  project.setFocus();
  project.select();
  project.doubleClick();

  // Since the menus have dynamic numbers in them
  // and with out a built in iteration, this is what I came up with
  for (int i = 1; i < 15; i++) {
    bot.sleep(500);
    if (i < 10) {
      number = i + " ";
    } else {
      number = "";
    }

    final String menuLabel = number + MENU_GWT_SUPERDEVMODE;

    SwtBotUtils.print("Trying to select: Run > Debug As > menuLabel=" + menuLabel);

    try {
      bot.menu("Run").menu("Debug As").menu(menuLabel).click();
      break;
    } catch (Exception e) {
      SwtBotUtils.print("Skipping menu item " + menuLabel);
    }
  }

  // Wait for a successful launch - 60s build server wait time, just in case
  ConsoleViewContains.waitForConsoleOutput(bot, "The code server is ready", 60000);

  SwtBotUtils.print("Launched DevMode with Jetty");
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:41,代码来源:SwtBotProjectDebug.java

示例11: selectProjectItem

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Select a file/folder by providing a parent tree, and a list folders that lead to the
 * file/folder.
 *
 * @param item Root tree item.
 * @param folderPath List of folder names that lead to file.
 * @return Returns a SWTBotTreeItem of the last name in texts.
 */
public static SWTBotTreeItem selectProjectItem(SWTBotTreeItem item, String... folderPath) {
  for (String folder : folderPath) {
    if (item == null) {
      return null;
    }
    item.doubleClick();
    item = item.getNode(folder);
  }
  return item;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:SwtBotProjectActions.java


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