当前位置: 首页>>代码示例>>Java>>正文


Java WidgetNotFoundException类代码示例

本文整理汇总了Java中org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java WidgetNotFoundException类的具体用法?Java WidgetNotFoundException怎么用?Java WidgetNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WidgetNotFoundException类属于org.eclipse.swtbot.swt.finder.exceptions包,在下文中一共展示了WidgetNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public boolean test() throws Exception {
	try {
		
		SWTBotTreeItem item = this.problemView.expandErrorItem ();
		SWTBotTreeItem[] child = item.getItems();
		for (int i = 0; i < child.length; i++) {
			if (child[i].isSelected() && child[i].row().get(0).equalsIgnoreCase(checkedItem.row().get(0))) {
				return true;
			}
		}
		retry ();
		return false;
	} catch (WidgetNotFoundException e) {
		retry ();
		return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:IsItemSelectedInErrors.java

示例2: getUniqueTreeItem

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
/**
 * Given a tree that contains an entry with <code>itemName</code> and a direct child with a name
 * matching <code>subchildName</code>, return its tree item.
 *
 * This method is useful when there is the possibility of a tree having two similarly-named
 * top-level nodes.
 *
 * @param mainTree the tree
 * @param itemName the name of a top-level node in the tree
 * @param subchildName the name of a direct child of the top-level node (used to uniquely select
 *        the appropriate tree item for the given top-level node name)
 * @return the tree item corresponding to the top-level node with <code>itemName</code>that has a
 *         direct child with <code>subchildName</code>. If there are multiple tree items that
 *         satisfy this criteria, then the first one (in the UI) will be returned
 *
 * @throws WidgetNotFoundException if no such node can be found
 */
public static SWTBotTreeItem getUniqueTreeItem(final SWTBot bot, final SWTBotTree mainTree,
    String itemName, String subchildName) {
  for (SWTBotTreeItem item : mainTree.getAllItems()) {
    if (itemName.equals(item.getText())) {
      try {
        item.expand();
        waitUntilTreeHasText(bot, item);
        if (item.getNode(subchildName) != null) {
          return item;
        }
      } catch (WidgetNotFoundException ex) {
        // Ignore
      }
    }
  }

  throw new WidgetNotFoundException(
      "The " + itemName + " node with a child of " + subchildName + " must exist in the tree.");
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:37,代码来源:SwtBotTreeUtilities.java

示例3: beforeClass

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public static void beforeClass() {
	UIThreadRunnable.syncExec(new VoidResult() {
		public void run() {
			resetWorkbench();
			resetToolbox();
			
			// close browser-based welcome screen (if open)
			SWTWorkbenchBot bot = new SWTWorkbenchBot();
			try {
				SWTBotView welcomeView = bot.viewByTitle("Welcome");
				welcomeView.close();
			} catch (WidgetNotFoundException e) {
				return;
			}
		}
	});
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:18,代码来源:RCPTestSetupHelper.java

示例4: getUniqueTreeItem

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
/**
 * Given a tree that contains an entry with <code>itemName</code> and a direct child with a name
 * matching <code>subchildName</code>, return its tree item.
 *
 * This method is useful when there is the possibility of a tree having two similarly-named
 * top-level nodes.
 *
 * @param mainTree the tree
 * @param itemName the name of a top-level node in the tree
 * @param subchildName the name of a direct child of the top-level node (used to uniquely select
 *        the appropriate tree item for the given top-level node name)
 * @return the tree item corresponding to the top-level node with <code>itemName</code>that has a
 *         direct child with <code>subchildName</code>. If there are multiple tree items that
 *         satisfy this criteria, then the first one (in the UI) will be returned
 *
 * @throws IllegalStateException if no such node can be found
 */
public static SWTBotTreeItem getUniqueTreeItem(final SWTBot bot, final SWTBotTree mainTree,
    String itemName, String subchildName) {
  for (SWTBotTreeItem item : mainTree.getAllItems()) {
    if (itemName.equals(item.getText())) {
      try {
        item.expand();
        SwtBotTreeActions.waitUntilTreeHasText(bot, item);
        if (item.getNode(subchildName) != null) {
          return item;
        }
      } catch (WidgetNotFoundException e) {
        // Ignore
      }
    }
  }

  throw new IllegalStateException("The '" + itemName + "' node with a child of '" + subchildName
      + "' must exist in the tree.");
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:37,代码来源:SwtBotTreeActions.java

示例5: doesProjectExist

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
/**
 * Returns true if the specified project can be found in the 'Package Explorer' or 'Project View',
 * otherwise returns false. Throws a WidgetNotFoundException exception if the 'Package Explorer'
 * or 'Project Explorer' view cannot be found.
 *
 * @param bot The SWTWorkbenchBot.
 * @param projectName The name of the project to be found.
 * @return if the project exists
 */
public static boolean doesProjectExist(final SWTWorkbenchBot bot, String projectName) {
  SWTBotView explorer = getPackageExplorer(bot);
  if (explorer == null) {
    throw new WidgetNotFoundException(
        "Could not find the 'Package Explorer' or 'Project Explorer' view.");
  }

  // Select the root of the project tree in the explorer view
  Widget explorerWidget = explorer.getWidget();
  Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
  SWTBotTreeItem[] allItems = new SWTBotTree(explorerTree).getAllItems();
  for (int i = 0; i < allItems.length; i++) {
    if (allItems[i].getText().equals(projectName)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:28,代码来源:SwtBotProjectActions.java

示例6: selectProject

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
/**
 * Returns the specified project. Throws a WidgetNotFoundException if the 'Package Explorer' or
 * 'Project Explorer' view cannot be found or if the specified project cannot be found.
 *
 * @param bot The SWTWorkbenchBot.
 * @param projectName The name of the project to select.
 * @return the tree
 */
public static SWTBotTreeItem selectProject(final SWTWorkbenchBot bot, String projectName) {
  /*
   * Choose either the Package Explorer View or the Project Explorer view. Eclipse 3.3 and 3.4
   * start with the Java Perspective, which has the Package Explorer View open by default, whereas
   * Eclipse 3.5 starts with the Resource Perspective, which has the Project Explorer View open.
   */
  SWTBotView explorer = getPackageExplorer(bot);
  for (SWTBotView view : bot.views()) {
    if (view.getTitle().equals("Package Explorer")
        || view.getTitle().equals("Project Explorer")) {
      explorer = view;
      break;
    }
  }

  if (explorer == null) {
    throw new WidgetNotFoundException(
        "Could not find the 'Package Explorer' or 'Project Explorer' view.");
  }

  // Select the root of the project tree in the explorer view
  Widget explorerWidget = explorer.getWidget();
  Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
  return new SWTBotTree(explorerTree).getTreeItem(projectName).select();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:34,代码来源:SwtBotProjectActions.java

示例7: baseBeforeTest

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
@Before
public void baseBeforeTest() {
	// Sets codenvy fake API
	CodenvyAPI.setClient(new FakeCodenvyClient());
	    	
    UIThreadRunnable.syncExec(new VoidResult() {
        @Override
        public void run() {
            final Shell eclipseShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            eclipseShell.forceFocus();
        }
    });

    try {

        final SWTBotView welcomeView = bot.viewByTitle("Welcome");
        welcomeView.close();

    } catch (WidgetNotFoundException e) {
        // ignore the exception
    }
}
 
开发者ID:codenvy-legacy,项目名称:eclipse-plugin,代码行数:23,代码来源:SWTBotBaseTest.java

示例8: beforeClass

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	bot = new SWTWorkbenchBot();
	try {
		bot.viewByTitle("Welcome").close();
	} catch (WidgetNotFoundException e) {
		// OK, no Welcome view, that's fine :)
	}

	// Change the perspective via the Open Perspective dialog
	bot.menu("Window").menu("Open Perspective").menu("Other...").click();
	SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
	openPerspectiveShell.activate();

	// select the dialog
	bot.table().select("Plug-in Development");
	bot.button("OK").click();

	// in Luna the Error Log is not shown by default in the Plug-in Development perspective
	// bot.viewByPartName("Error Log").close();

	// in SwtBot 2.2.0 we must use viewByPartName instead of viewByTitle
	bot.viewByPartName("Problems").show();
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:25,代码来源:SmallJavaProjectWizardTests.java

示例9: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public boolean test() throws Exception {
	try {
		return fileItem.isSelected() & fileItem.isVisible();
	} catch (WidgetNotFoundException e) {
		return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:8,代码来源:GW4EProject.java

示例10: isProjectCreated

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
protected boolean isProjectCreated(String name) {
	try {
		getProjectTreeItem(name);
		return true;
	} catch (WidgetNotFoundException e) {
		return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:GW4EProject.java

示例11: findToolBarButton

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
private SWTBotToolbarButton findToolBarButton (String text) {
	List<SWTBotToolbarButton> items = this.botView.getToolbarButtons();
	for (SWTBotToolbarButton button : items) {
	    if (text.equals(button.getToolTipText())) {
	        return button;
	    }
	}
	throw new WidgetNotFoundException (text);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:GW4EPerformanceView.java

示例12: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
@Override
public boolean test() throws Exception {
	try {
		return botTree.contextMenu(mMenuText).isVisible();
	} catch (WidgetNotFoundException e) {
		return false;
	}

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:ContextMenuAppears.java

示例13: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public boolean test() throws Exception {
	try {
		return pbView.countErrorWithText(text) == count;
	} catch (WidgetNotFoundException e) {
		 return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:8,代码来源:ErrorCountInProblemView.java

示例14: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public boolean test() throws Exception {
	try {
		this.problemView.findErrorItemWithText (error);
		return  false;
	} catch (WidgetNotFoundException e) {
		 return true;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:NoMoreError.java

示例15: test

import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; //导入依赖的package包/类
public boolean test() throws Exception {
	try {
		SWTBotCTabItem tabItem = bot.cTabItem(title);
		return tabItem!=null;
	} catch (WidgetNotFoundException e) {
		 return false;
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:EditorOpenedCondition.java


注:本文中的org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。