Java 类org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory 实例源码

项目:tlaplus    文件:AbstractTest.java   
/**
 * 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);
}
项目:tlaplus    文件:DeleteSpecHandlerTest.java   
@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);
}
项目:tlaplus    文件:AddSpecWizardTest.java   
@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);
}
项目:gw4e.project    文件:GraphModelProperties.java   
public GraphModelProperties(SWTBot bot, String project, String folder,String pkg,  String filename) {
    super();
    this.bot = bot;
    this.project = project;
    this.folder = folder;
    this.pkg = pkg;
    this.filename = filename;
    bot.tree().setFocus();

    bot.tree().select("GW4E");
    bot.waitUntil(Conditions.waitForWidget(WidgetMatcherFactory.withId(GraphModelPropertyPage.GW4E_LABEL_ID, GraphModelPropertyPage.GW4E_LABEL_ID)));
}
项目:gw4e.project    文件:GW4EProjectPreference.java   
public GW4EProjectProperties openPropertiesPage ( ) {
    SWTBotTree tree = getProjectTree();
    SWTBotTreeItem item = tree.expandNode(this.projectName);
    item.setFocus();
    item.select();

    ICondition condition = new DefaultCondition () {
        @Override
        public boolean test() throws Exception {
            SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
            return treeItem.isSelected();
        }

        @Override
        public String getFailureMessage() {
            return "Project " + projectName + " not selected ";
        }

    };
    bot.waitUntil(condition);
    bot.menu( "File").menu("Properties").click();        
    bot.waitUntil(Conditions.shellIsActive("Properties for " + projectName));
    SWTBotShell shell = bot.shell("Properties for " + projectName).activate();
    shell.bot().tree().select("GW4E");
    bot.waitUntil(Conditions.waitForWidget(WidgetMatcherFactory.withId( ProjectPropertyPage.PROJECT_PROPERTY_PAGE_WIDGET_ID, ProjectPropertyPage.PROJECT_PROPERTY_PAGE_WIDGET_SECURITY_LEVEL_FOR_ABSTRACT_CONTEXT)));
    return new GW4EProjectProperties(bot,shell);
}
项目:gw4e.project    文件:GW4EManualRunner.java   
@Override
protected ICondition getWaitConditionWhenOpeningConfiguration() {
    ICondition condition = Conditions.waitForWidget(
            WidgetMatcherFactory.withId(
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_BUTTON_ID_OMIT_EMPTY_EDGE));
    return condition;
}
项目:gw4e.project    文件:GW4ETestRunner.java   
@Override
protected ICondition getWaitConditionWhenOpeningConfiguration() {
    ICondition condition = Conditions.waitForWidget(
            WidgetMatcherFactory.withId(
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_TEST_CONFIGURATION_PROJECT));
    return condition;
}
项目:gw4e.project    文件:GW4EOfflineRunner.java   
@Override
protected ICondition getWaitConditionWhenOpeningConfiguration() {
    ICondition condition = Conditions.waitForWidget(
            WidgetMatcherFactory.withId(
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,
                    GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_TEXT_ID_PROJECT));
    return condition;
}
项目:google-cloud-eclipse    文件:RunAppEngineShortcutTest.java   
private static boolean appEngineMenuExists(IProject project) {
  SWTBotTreeItem selected = SwtBotProjectActions.selectProject(
      new SWTWorkbenchBot(), project.getName());
  Menu runAsMenu = selected.contextMenu("Run As").widget.getMenu();
  Matcher<MenuItem> matcher = WidgetMatcherFactory.withRegex("App Engine");

  List<MenuItem> menuItems = new MenuFinder().findMenus(runAsMenu, matcher, false);
  return !menuItems.isEmpty();
}
项目:dsl-devkit    文件:SwtBotWizardUtil.java   
/**
 * Select a folder in a project.
 *
 * @param bot
 *          the bot
 * @param folderName
 *          the folder name
 */
public static void selectProjectFolder(final SwtWorkbenchBot bot, final String folderName) {
  SWTBotView packageExplorer = bot.viewByTitle("Project Explorer");
  packageExplorer.show();
  Composite comp = (Composite) packageExplorer.getWidget();
  final Tree tree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), comp);
  PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
    SWTBotTree botTree = new SWTBotTree(tree);
    if (!selectItem(botTree, folderName)) {
      fail("folder was not found");
    }
  });
}
项目:gw4e.project    文件:AbstractRunner.java   
private static Matcher<Widget> getConsoleMatcher () {
    Matcher<Widget> console = WidgetMatcherFactory.withMnemonic("Console");
    return console;
}
项目:dsl-devkit    文件:TreeItemUiTestUtil.java   
WaitForTreeItem(final Tree parent) {
  super(WidgetMatcherFactory.widgetOfType(TreeItem.class));
  this.parent = parent;
}
项目:dsl-devkit    文件:SwtWorkbenchBot.java   
/**
 * Creates an {@link SwtBotRadio} with the given label and the given index.
 * <p>
 * <em>Note</em>: This method may throw a {@link org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException} if the widget is not found or is disposed.
 * </p>
 *
 * @param label
 *          the label on the widget, must not be {@code null}
 * @param index
 *          the index of the widget, must not be {@code null}
 * @return a {@link SwtBotRadio} with the specified {@Code label}, never {@code null}
 */
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public SwtBotRadio radioWithLabel(final String label, final int index) {
  Matcher matcher = allOf(widgetOfType(Button.class), WidgetMatcherFactory.withLabel(label, finder), withStyle(SWT.RADIO, "SWT.RADIO"));
  return new SwtBotRadio((Button) widget(matcher, index), matcher);
}
项目:dsl-devkit    文件:SwtWorkbenchBot.java   
/**
 * Creates an {@link SwtBotRadio} with the given label, the given group and the given index.
 * <p>
 * <em>Note</em>: This method may throw a {@link org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException} if the widget is not found or is disposed.
 * </p>
 *
 * @param label
 *          the label on the widget, must not be {@code null}
 * @param inGroup
 *          the inGroup on the widget, must not be {@code null}
 * @param index
 *          the index of the widget, must not be {@code null}
 * @return a {@link SwtBotRadio} with the specified {@code label} with the specified {@code inGroup}, never {@code null}
 */
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public SwtBotRadio radioWithLabelInGroup(final String label, final String inGroup, final int index) {
  Matcher matcher = allOf(widgetOfType(Button.class), WidgetMatcherFactory.withLabel(label, finder), inGroup(inGroup), withStyle(SWT.RADIO, "SWT.RADIO"));
  return new SwtBotRadio((Button) widget(matcher, index), matcher);
}