Java Code Examples for org.eclipse.swtbot.swt.finder.utils.SWTUtils#sleep()
The following examples show how to use
org.eclipse.swtbot.swt.finder.utils.SWTUtils#sleep() .
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: ContextActionUiTestUtil.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Clicks the context menu matching the given labels. * When a context menu 'Compile' exists with the sub context menu 'All Invalids', * then the context menu 'All Invalids' can be clicked by giving the labels 'Compile' and 'All Invalids'. * * @param bot * the {@link AbstractSWTBot} on which to infer the context menu * @param labels * the labels on the context menus * @throw {@link WidgetNotFoundException} if the context menu could not be found */ public static void clickContextMenu(final AbstractSWTBot<? extends Control> bot, final String... labels) { MenuItem menuItem = getContextMenuItem(bot, labels); if (menuItem == null) { long endTime = System.currentTimeMillis() + SWTBotPreferences.TIMEOUT; while (menuItem == null && System.currentTimeMillis() < endTime) { SWTUtils.sleep(SWTBotPreferences.DEFAULT_POLL_DELAY); menuItem = getContextMenuItem(bot, labels); } if (menuItem == null) { throw new WidgetNotFoundException("Could not find menu: " + Arrays.asList(labels)); } } click(menuItem); }
Example 2
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void selectCurrentLine() throws RemoteException { widget.selectCurrentLine(); // It's is necessary to sleep a litte time so that the following // operation like quickfix will be successfully performed. SWTUtils.sleep(500); }
Example 3
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void selectLine(int line) throws RemoteException { widget.selectLine(line); // It's is necessary to sleep a litte time so that the following // operation like quickfix will be successfully performed. SWTUtils.sleep(1000); }
Example 4
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void selectRange(int line, int column, int length) throws RemoteException { widget.selectRange(line, column, length); // It's is necessary to sleep a litte time so that the following // operation like quickfix will be successfully performed. SWTUtils.sleep(800); }
Example 5
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void pressShortRunAsJavaApplication() throws RemoteException { if (WidgetUtil.getOperatingSystem() == WidgetUtil.OperatingSystem.MAC) widget.pressShortcut(SWT.ALT | SWT.COMMAND, 'x'); else widget.pressShortcut(SWT.ALT | SWT.SHIFT, 'x'); SWTUtils.sleep(1000); widget.pressShortcut(SWT.NONE, 'j'); }
Example 6
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void pressShortCutNextAnnotation() throws RemoteException { if (WidgetUtil.getOperatingSystem() == WidgetUtil.OperatingSystem.MAC) widget.pressShortcut(SWT.COMMAND, '.'); else widget.pressShortcut(SWT.CTRL, '.'); SWTUtils.sleep(100); }
Example 7
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void pressShortCutQuickAssignToLocalVariable() throws RemoteException { if (WidgetUtil.getOperatingSystem() == WidgetUtil.OperatingSystem.MAC) widget.pressShortcut(SWT.COMMAND, '2'); else widget.pressShortcut(SWT.CTRL, '2'); SWTUtils.sleep(1000); widget.pressShortcut(SWT.NONE, 'l'); }
Example 8
Source File: DragAndDropUtil.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
/** * Performs the drag and drop from source {@link Point} to destination {@link Point}. * * @param source * the source {@link Point} to start dragging * @param dest * the destination {@link Point} for dropping */ private void doDragAndDrop(final Point source, final Point dest) { // log.debug(MessageFormat.format("Drag-and-dropping from ({0},{1}) to ({2},{3})", // source.x, source.y, dest.x, dest.y)); try { final Robot awtRobot = new Robot(); // the x+10 motion is needed to let native functions register a drag // detect. It did not work under Windows // otherwise and has been reported to be required for linux, too. // But I could not test that. syncExec(new VoidResult() { @Override public void run() { awtRobot.mouseMove(source.x, source.y); awtRobot.mousePress(InputEvent.BUTTON1_MASK); awtRobot.mouseMove(source.x + DRAG_THRESHOLD, source.y); } }); /* drag delay */ SWTUtils.sleep(DRAG_DELAY); syncExec(new VoidResult() { @Override public void run() { awtRobot.mouseMove(dest.x + DRAG_THRESHOLD, dest.y); awtRobot.mouseMove(dest.x, dest.y); } }); /* drop delay */ SWTUtils.sleep(DRAG_DELAY); syncExec(new VoidResult() { @Override public void run() { awtRobot.mouseRelease(InputEvent.BUTTON1_MASK); } }); } catch (final AWTException e) { // log.error(e.getMessage(), e); throw new IllegalStateException(e); } }