[jbosstools-commits] JBoss Tools SVN: r40781 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri May 4 02:05:49 EDT 2012


Author: jpeterka
Date: 2012-05-04 02:05:48 -0400 (Fri, 04 May 2012)
New Revision: 40781

Modified:
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java
Log:
Avoid Error log delete method fail when error log is empty

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java	2012-05-04 05:22:09 UTC (rev 40780)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java	2012-05-04 06:05:48 UTC (rev 40781)
@@ -1,6 +1,7 @@
 package org.jboss.tools.ui.bot.ext.view;
 
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -48,13 +49,18 @@
 	 * deletes error log permanently
 	 */
 	public void delete() {
-		ContextMenuHelper.clickContextMenu(getView().bot().tree(),
-				"Delete Log");
-		
-		SWTBotShell shell = bot.shell("Confirm Delete").activate();
-		shell.bot().button("OK").click();
-		bot.waitUntil(Conditions.shellCloses(shell));
-		log.info("Error log content deleted");		
+
+		try {
+			ContextMenuHelper.clickContextMenu(getView().bot().tree(),
+					"Delete Log");
+			
+			SWTBotShell shell = bot.shell("Confirm Delete").activate();
+			shell.bot().button("OK").click();
+			bot.waitUntil(Conditions.shellCloses(shell));
+			log.info("Error log content deleted");
+		} catch (WidgetNotFoundException e) {
+			log.warn("Error log is empty or can't be deleted");
+		}
 	}
 
 	private SWTBotView getView() {



More information about the jbosstools-commits mailing list