Author: ljelinko
Date: 2012-08-22 07:58:59 -0400 (Wed, 22 Aug 2012)
New Revision: 43160
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/MarkFileAsDeployableTask.java
Log:
Trying to call awt Robot directly
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/MarkFileAsDeployableTask.java
===================================================================
---
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/MarkFileAsDeployableTask.java 2012-08-22
11:56:52 UTC (rev 43159)
+++
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/MarkFileAsDeployableTask.java 2012-08-22
11:58:59 UTC (rev 43160)
@@ -1,7 +1,9 @@
package org.jboss.tools.portlet.ui.bot.task.server;
-import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
-import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+
import org.jboss.tools.portlet.ui.bot.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
import org.jboss.tools.portlet.ui.bot.task.workspace.FileContextMenuSelectingTask;
@@ -24,7 +26,14 @@
public void perform() {
performInnerTask(new FileContextMenuSelectingTask(workspaceFile, "Mark as
Deployable"));
// for the confirmation dialog select OK (the dialog is native and normal swtbot
functions do now work)
- KeyboardFactory.getAWTKeyboard().pressShortcut(Keystrokes.RIGHT);
- KeyboardFactory.getAWTKeyboard().pressShortcut(Keystrokes.CR, Keystrokes.LF);
+ try {
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_RIGHT);
+ robot.keyRelease(KeyEvent.VK_RIGHT);
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ } catch (AWTException e) {
+ throw new IllegalStateException("Cannot create instance of " + Robot.class +
" in order to close native dialog", e);
+ }
}
}
Show replies by date