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


Java SWTBotTreeItem.isExpanded方法代码示例

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


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

示例1: selectTreeItem

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Select a tree item.
 *
 * @param treeItem
 *          the tree node
 * @param name
 *          the name of the item to look for
 * @return true, if item was found and selected
 */
private static boolean selectTreeItem(final SWTBotTreeItem treeItem, final String name) {
  if (name.equals(treeItem.getText())) {
    treeItem.select();
    return true;
  }
  if (!treeItem.isExpanded()) {
    treeItem.expand();
  }
  for (SWTBotTreeItem item : treeItem.getItems()) {
    if (selectTreeItem(item, name)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:25,代码来源:SwtBotWizardUtil.java

示例2: safeBlockingCollapse

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的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

示例3: expandNode

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Attempts to expand all nodes along the path specified by the node array parameter.
 * The method is copied from SWTBotTree with an additional check if the node is already expanded.
 *
 * @param bot
 *          tree bot, must not be {@code null}
 * @param nodes
 *          node path to expand, must not be {@code null} or empty
 * @return the last tree item that was expanded, or {@code null} if no item was found
 */
public static SWTBotTreeItem expandNode(final SWTBotTree bot, final String... nodes) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  Assert.isNotNull(nodes, ARGUMENT_NODES);
  assertArgumentIsNotEmpty(nodes, ARGUMENT_NODES);
  new SWTBot().waitUntil(widgetIsEnabled(bot));
  SWTBotTreeItem item = bot.getTreeItem(nodes[0]);
  if (!item.isExpanded()) {
    item.expand();
  }

  final List<String> asList = new ArrayList<String>(Arrays.asList(nodes));
  asList.remove(0);
  if (!asList.isEmpty()) {
    item = expandNode(item, asList.toArray(new String[asList.size()]));
  }

  return item;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:29,代码来源:CoreSwtbotTools.java

示例4: safeBlockingExpand

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的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

示例5: expandIfNotExpanded

import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
 * Expands the given {@link SWTBotTreeItem} if it is not expanded already.
 *
 * @param treeItem
 *          the tree item to be expanded
 */
protected void expandIfNotExpanded(final SWTBotTreeItem treeItem) {
  if (!treeItem.isExpanded()) {
    treeItem.expand();
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:12,代码来源:AbstractOutlineViewTest.java


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