Author: vpakan(a)redhat.com
Date: 2010-03-29 07:16:58 -0400 (Mon, 29 Mar 2010)
New Revision: 21100
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/WidgetFinderHelper.java
Log:
When browser not found return null from method browserInEditorText().
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/WidgetFinderHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/WidgetFinderHelper.java 2010-03-29
11:14:41 UTC (rev 21099)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/WidgetFinderHelper.java 2010-03-29
11:16:58 UTC (rev 21100)
@@ -16,6 +16,7 @@
import org.eclipse.swt.browser.Browser;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.StringResult;
@@ -47,19 +48,24 @@
String browserText = null;
- SWTBotEditor editor = bot.editorByTitle(editorTitle);
-
- final Browser browser = browserInEditor(editor);
-
- browserText = UIThreadRunnable
- .syncExec(new StringResult() {
- public String run() {
- return browser.getText();
+ try{
+
+ SWTBotEditor editor = bot.editorByTitle(editorTitle);
+ final Browser browser = browserInEditor(editor);
+
+ browserText = UIThreadRunnable
+ .syncExec(new StringResult() {
+ public String run() {
+ return browser.getText();
+ }
+ });
+
+ if (closeEditor){
+ editor.close();
}
- });
-
- if (closeEditor){
- editor.close();
+
+ } catch (WidgetNotFoundException wnfe){
+ // do nothing returns null
}
return browserText;