Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotShell#isOpen()
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell#isOpen() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwtBotMenuActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
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); }
Example 2
Source File: SwtWorkbenchBot.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Closes the shell with the given title if it exists. This call does not wait for the shell to appear. * * @param title * the title of the shell to close * @return {@code true} if the shell existed and was open, {@code false} otherwise */ public boolean closeShell(final String title) { SWTBotShell shell = getShell(title); if (shell != null && shell.isOpen()) { shell.close(); return true; } return false; }
Example 3
Source File: SWTGefBotRule.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void closeAllShells(SWTWorkbenchBot bot, Exception e) { final SWTBotShell[] shells = bot.shells(); for (final SWTBotShell shell : shells) { if (shell.isOpen() && !isEclipseShell(shell)) { System.out.println(String.format("Trying to close shell '%s' after test failure %s", shell.getText(), e)); try { shell.close(); } catch (TimeoutException e1) { System.out.println(String.format("Failed to close shell %s: %s", shell.getText(), e1)); } } } }
Example 4
Source File: SwtWorkbenchBot.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Checks if a {@link SWTBotShell} with the given title exists and is open. This call does not wait for the shell to appear. * * @param title * the title of the {@link SWTBotShell} to look for * @return {@code true} if the shell was found open, {@code false} otherwise */ public boolean hasShell(final String title) { SWTBotShell shell = getShell(title); return shell != null && shell.isOpen(); }