• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.swtbot.swt.finder.results.Result的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Result类属于org.eclipse.swtbot.swt.finder.results包,在下文中一共展示了Result类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: textEditor

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
private SWTBotEclipseEditor textEditor(String fullyQualifiedType) throws JavaModelException, PartInitException {
	IType type = javaProject.findType(fullyQualifiedType);

	IEditorPart editorPart = UIThreadRunnable.syncExec(new Result<IEditorPart>() {

		public IEditorPart run() {
			try {
				return JavaUI.openInEditor(type, true, true);
			} catch (PartInitException | JavaModelException e) {
				throw new RuntimeException(e);
			}
		}

	});

	// IEditorPart editorPart = JavaUI.openInEditor(type, true, true);
	SWTBotEditor editor = bot.editorById(editorPart.getEditorSite().getId());
	return editor.toTextEditor();
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:20,代码来源:JavaEditorBookmarkPropertiesProviderTest.java


示例2: assertShellWithDataTypeVisible

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的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


示例3: treeItemHasText

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
private static boolean treeItemHasText(final TreeItem widget) {
  return UIThreadRunnable.syncExec(new Result<Boolean>() {
    @Override
    public Boolean run() {
      TreeItem[] items = widget.getItems();
      for (TreeItem item : items) {
        if (item.getText() == null || item.getText().isEmpty()) {
          return false;
        }
      }
      return true;
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:15,代码来源:SwtBotTreeUtilities.java


示例4: isTreeExpanded

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Helper method to check whether a given tree is expanded which can be called from any thread.
 */
private static boolean isTreeExpanded(final TreeItem tree) {
  return UIThreadRunnable.syncExec(new Result<Boolean>() {
    @Override
    public Boolean run() {
      return tree.getExpanded();
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:12,代码来源:SwtBotTreeUtilities.java


示例5: getActiveWorkbenchWindow

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
private IWorkbenchWindow getActiveWorkbenchWindow() {
  return UIThreadRunnable.syncExec(bot.getDisplay(), new Result<IWorkbenchWindow>() {
    @Override
    public IWorkbenchWindow run() {
      return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:9,代码来源:FixedDefaultWorkbench.java


示例6: getContextMenuItems

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Returns the {@link SWTBotMenu}s available on the given widget bot.
 *
 * @param widgetBot
 *          the bot representing the widget, whose {@link SWTBotMenu}s should be returned
 * @return the {@link SWTBotMenu}s on the given widget bot
 */
public static List<SWTBotMenu> getContextMenuItems(final AbstractSWTBot<? extends Control> widgetBot) {
  return UIThreadRunnable.syncExec(new Result<List<SWTBotMenu>>() {
    @Override
    public List<SWTBotMenu> run() {
      List<SWTBotMenu> menuItems = Lists.newArrayList();
      for (MenuItem menuItem : new ContextMenuFinder(widgetBot.widget).findMenus(widgetBot.widget.getShell(), WidgetMatcherFactory.widgetOfType(MenuItem.class), true)) {
        menuItems.add(new SWTBotMenu(menuItem));
      }
      return menuItems;
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:20,代码来源:ContextActionUiTestUtil.java


示例7: getDisabledContextMenuItems

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Returns the disabled {@link SWTBotMenu}s on the given widget bot.
 *
 * @param widgetBot
 *          the bot representing the widget, whose disabled {@link SWTBotMenu}s should be returned
 * @return the disabled {@link SWTBotMenu}s on the given widget bot
 */
public static List<SWTBotMenu> getDisabledContextMenuItems(final AbstractSWTBot<? extends Control> widgetBot) {
  return UIThreadRunnable.syncExec(new Result<List<SWTBotMenu>>() {
    @Override
    public List<SWTBotMenu> run() {
      List<SWTBotMenu> disabledMenuItems = Lists.newArrayList();
      for (MenuItem menuItem : new ContextMenuFinder(widgetBot.widget).findMenus(widgetBot.widget.getShell(), WidgetMatcherFactory.widgetOfType(MenuItem.class), true)) {
        if (!menuItem.isEnabled()) {
          disabledMenuItems.add(new SWTBotMenu(menuItem));
        }
      }
      return disabledMenuItems;
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:ContextActionUiTestUtil.java


示例8: isEnabled

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Whether the context menu with the given labels is enabled.
 *
 * @param widgetBot
 *          the bot representing the widget on which it should be checked, whether the context menu
 *          with the given labels is enabled
 * @param labels
 *          the labels on the context menus
 * @return {@code true} if the context menu is enabled, else {@code false}
 * @throw {@link WidgetNotFoundException} if the context menu could not be found
 */
public static boolean isEnabled(final AbstractSWTBot<? extends Control> widgetBot, final String... labels) {
  final MenuItem menuItem = getContextMenuItem(widgetBot, labels);
  if (menuItem == null) {
    throw new WidgetNotFoundException("Could not find menu: " + Arrays.asList(labels));
  }
  return UIThreadRunnable.syncExec(new Result<Boolean>() {
    @Override
    public Boolean run() {
      return menuItem.isEnabled();
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:24,代码来源:ContextActionUiTestUtil.java


示例9: absoluteLocation

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
@Override
protected Rectangle absoluteLocation() {
  return UIThreadRunnable.syncExec(new Result<Rectangle>() {
    @Override
    public Rectangle run() {
      return display.map(widget.getParent(), null, widget.getBounds());
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:10,代码来源:DragAndDropUtil.java


示例10: clipboardContent

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Content from the clipboard.
 * 
 * @param bot
 *          to work with
 * @return clipboard content
 */
public static String clipboardContent(final SWTWorkbenchBot bot) {
  return UIThreadRunnable.syncExec(new Result<String>() {
    public String run() {
      Clipboard clipboard = new Clipboard(bot.getDisplay());
      return (String) clipboard.getContents(TextTransfer.getInstance());
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:16,代码来源:ClipboardUiTestUtil.java


示例11: getClipboardContent

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Get text content from the clipboard.
 *
 * @param bot
 *          to work with, must not be {@code null}
 * @return clipboard text content, or {@code null} if no text data is available
 */
public static String getClipboardContent(final SWTWorkbenchBot bot) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  return UIThreadRunnable.syncExec(new Result<String>() {
    @Override
    public String run() {
      final Clipboard clipboard = new Clipboard(bot.getDisplay());
      return (String) clipboard.getContents(TextTransfer.getInstance());
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:18,代码来源:CoreSwtbotTools.java


示例12: openEditor

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Opens an {@link IEditorPart} for a provided {@link org.eclipse.emf.common.util.URI}.
 *
 * @param uri
 *          {@link org.eclipse.emf.common.util.URI} to open editor for
 * @param activate
 *          true if focus is to be set to the opened editor
 * @return {@link IEditorPart} created
 */
private IEditorPart openEditor(final org.eclipse.emf.common.util.URI uri, final boolean activate) {
  UiAssert.isNotUiThread();
  final IEditorPart editorPart = UIThreadRunnable.syncExec(getBot().getDisplay(), new Result<IEditorPart>() {
    @Override
    public IEditorPart run() {
      IEditorPart editor = getXtextTestUtil().get(GlobalURIEditorOpener.class).open(uri, activate);
      editor.setFocus();
      return editor;
    }
  });

  waitForEditorJobs(editorPart);

  getBot().waitUntil(new DefaultCondition() {
    @Override
    public boolean test() {
      if (editorPart.getEditorSite() != null && editorPart.getEditorInput() != null) {
        IEditorInput input = editorPart.getEditorInput();
        if (input instanceof IFileEditorInput) {
          return !((IFileEditorInput) input).getFile().isReadOnly();
        }
      }
      return false;
    }

    @Override
    public String getFailureMessage() {
      return "Editor must be initialized.";
    }
  }, EDITOR_ENABLED_TIMEOUT);

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


示例13: getStyleRange

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Retrieves the {@link StyleRange} found at a given offset in the given {@link XtextEditor}.
 *
 * @param editor
 *          the {@link XtextEditor}
 * @param offset
 *          the position for which to retrieve the {@link StyleRange}
 * @return the {@link StyleRange} found at the given offset
 */
public static StyleRange getStyleRange(final XtextEditor editor, final int offset) {
  StyleRange styleRange = UIThreadRunnable.syncExec(new Result<StyleRange>() {
    @Override
    public StyleRange run() {
      StyledText styledText = editor.getInternalSourceViewer().getTextWidget();
      return styledText.getStyleRangeAtOffset(offset);
    }
  });
  if (styleRange == null) {
    // if no style range was found, then the default style is used
    return createStyleRange(offset, 1, createTextAttribute(TEXT_STYLE_DEFAULT));
  }
  return styleRange;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:24,代码来源:AbstractSyntaxColoringTest.java


示例14: getOffsetHyperlinks

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Retrieves the hyperlinks found in a given source at a given offset.
 *
 * @param resource
 *          the resource in which to look for hyperlinks, must not be {@code null}
 * @param offset
 *          the position at which to look for hyperlinks
 * @return a list of hyperlinks, never {@code null}
 */
protected List<IHyperlink> getOffsetHyperlinks(final XtextResource resource, final int offset) {
  IHyperlink[] hyperlinks = UIThreadRunnable.syncExec(new Result<IHyperlink[]>() {
    @Override
    public IHyperlink[] run() {
      return getTestUtil().get(IHyperlinkHelper.class).createHyperlinksByOffset(resource, offset, true);
    }
  });
  return hyperlinks != null ? Arrays.asList(hyperlinks) : new ArrayList<IHyperlink>();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:19,代码来源:AbstractHyperlinkHelperTest.java


示例15: doesTreeItemHaveText

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
private static boolean doesTreeItemHaveText(final TreeItem widget) {
  return UIThreadRunnable.syncExec(new Result<Boolean>() {
    @Override
    public Boolean run() {
      TreeItem[] items = widget.getItems();
      for (TreeItem item : items) {
        if (item.getText() == null || item.getText().length() == 0) {
          return false;
        }
      }
      return true;
    }
  });
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:15,代码来源:SwtBotTreeActions.java


示例16: isTreeExpanded

import org.eclipse.swtbot.swt.finder.results.Result; //导入依赖的package包/类
/**
 * Helper method to check whether a given tree is expanded which can be called from any thread.
 */
public static boolean isTreeExpanded(final TreeItem tree) {
  return UIThreadRunnable.syncExec(new Result<Boolean>() {
    @Override
    public Boolean run() {
      return tree.getExpanded();
    }
  });
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:12,代码来源:SwtBotTreeActions.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PolicyAssertionValidator类代码示例发布时间:2022-05-23
下一篇:
Java ElementDescriptionUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap