Author: jgargula
Date: 2012-02-13 02:34:47 -0500 (Mon, 13 Feb 2012)
New Revision: 38645
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
Log:
Improved isProjectInPackageExplorer method.
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-02-13
01:48:57 UTC (rev 38644)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-02-13
07:34:47 UTC (rev 38645)
@@ -1134,28 +1134,28 @@
return SWTEclipseExt.isProjectInPackageExplorer(bot, projectName);
}
- /**
- * Returns true when projectName is present in Package Explorer static
- * version
- *
- * @param bot
- * @param projectName
- * @return
- */
- public static boolean isProjectInPackageExplorer(SWTBotExt bot,
- String projectName) {
- boolean found = false;
+ /**
+ * Returns <code>true</code> when projectName is present in Package
Explorer static
+ * version, <code>false</code> otherwise.
+ *
+ * @param bot
+ * @param projectName
+ * @return
+ */
+ public static boolean isProjectInPackageExplorer(SWTBotExt bot, String projectName)
{
+ if (bot == null || projectName == null) {
+ throw new NullPointerException();
+ }
- SWTBot innerBot = SWTEclipseExt
- .showView(bot, ViewType.PACKAGE_EXPLORER);
- SWTBotTree tree = innerBot.tree();
- try {
- tree.getTreeItem(projectName);
- found = true;
- } catch (WidgetNotFoundException e) {
- }
- return found;
- }
+ SWTBot innerBot = SWTEclipseExt.showView(bot, ViewType.PACKAGE_EXPLORER);
+ SWTBotTreeItem[] treeItems = innerBot.tree().getAllItems();
+ for (int i = 0; i < treeItems.length; i++) {
+ if (projectName.equals(treeItems[i].getText())) {
+ return true;
+ }
+ }
+ return false;
+ }
/**
* Returns Tree Item with specified label and located on path
Show replies by date