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


Java SWTBotMenu类代码示例

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


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

示例1: removeNature

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public void removeNature() {
	SWTBotTree tree = setupTreeForMenu(this.projectName);
	SWTBotMenu menu = new SWTBotMenu(
			ContextMenuHelper.contextMenu(tree, new String[] { "GW4E", "Remove GW4E Nature" }));
	menu.click();

	bot.waitUntil(new DefaultCondition() {
		@Override
		public boolean test() throws Exception {
			boolean b = ClasspathManager
					.hasGW4EClassPathContainer(ResourceManager.getProject(projectName));
			return !b;
		}

		@Override
		public String getFailureMessage() {
			return "GW4E ClassPath Container not removed";
		}
	});
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:21,代码来源:GW4EProject.java

示例2: assertMenuEnabled

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public void assertMenuEnabled(String[] menus, boolean[] states, String... nodes) {
	SWTBotTree tree = setupTreeForMenu(nodes);

	SWTBotMenu menu = new SWTBotMenu(ContextMenuHelper.contextMenu(tree, menus[0]));
	assertEquals("Invalid state ", states[0], menu.isEnabled());

	String[] submenus = new String[menus.length - 1];
	System.arraycopy(menus, 1, submenus, 0, menus.length - 1);
	boolean[] substates = new boolean[states.length - 1];
	System.arraycopy(states, 1, substates, 0, states.length - 1);
	for (int i = 0; i < submenus.length; i++) {
		String submenu = submenus[i];
		SWTBotMenu sm = menu.contextMenu(submenu);
		assertEquals("Invalid state ", substates[i], sm.isEnabled());
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:17,代码来源:GW4EProject.java

示例3: convertExistingProject

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public void convertExistingProject() throws CoreException {
	SWTBotTree tree = getProjectTree();
	SWTBotTreeItem item = tree.expandNode(this.projectName);
	item.setFocus();
	item.select();
	SWTBotMenu menu = item.contextMenu("Configure").contextMenu("Convert to GW4E");
	menu.click();
	bot.waitUntil(new DefaultCondition() {
		@Override
		public boolean test() throws Exception {
			boolean b = GW4ENature
					.hasGW4ENature(ResourceManager.getProject(projectName));
			return b;
		}

		@Override
		public String getFailureMessage() {
			return "GraphWalker has not GraphWalker Nature ";
		}
	});
	cleanBuild();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:23,代码来源:GW4EProject.java

示例4: prepareConvertTo

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
private ConvertDialog prepareConvertTo(String project, String packageRootFragment, String pkg,
		String targetFilename, String targetFormat, String... nodes) {
	SWTBotTree tree = getProjectTree();
	SWTBotTreeItem item = tree.expandNode(nodes);
	item.select();
	item.setFocus();

	SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Convert to...");
	menu.click();

	bot.waitUntil(Conditions.shellIsActive("GW4E Conversion File"));
	SWTBotShell shell = bot.shell("GW4E Conversion File");

	ConvertDialog cd = new ConvertDialog(shell);
	return cd;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:17,代码来源:GW4EProject.java

示例5: openNewGraphWalkerModel

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public static void openNewGraphWalkerModel(SWTWorkbenchBot bot) {
	
	SWTBotMenu all = bot.menu("File").menu("New");
	
	/*
	Function<String, String>   f =  new Function<String, String> () {

		@Override
		public String apply(String t) {
			return t;
		}
		
	};
	all.menuItems().stream().map(f);
	*/
	
	bot.menu("File").menu("New").menu("GW4E Model").click();
	bot.waitUntil(new ShellActiveCondition("GW4E"));
	SWTBotShell shell = bot.shell("GW4E");
	assertTrue(shell.isOpen());
	shell.bot().button("Cancel").click();
	bot.waitUntil(Conditions.shellCloses(shell));
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:GW4EPerspective.java

示例6: init

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
private void init() {
	ICondition condition = new DefaultCondition () {
		@Override
		public boolean test() throws Exception {
			SWTBotMenu menu = bot.menu("Window");
			menu = menu.menu("Show View");
			menu = menu.menu("Console");
			menu.click();
			try {
				bot.waitUntil(new ViewOpened(ConsoleView.this.bot, "Console"), 3 * 1000);
			} catch (Exception e) {
				return false;
			}
			return true;
		}

		@Override
		public String getFailureMessage() {
			return "Cannot open Console view";
		}
	};
	bot.waitUntil(condition, TIMEOUT);
	botView = getBotView();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:25,代码来源:ConsoleView.java

示例7: openPreferencesDialog

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
/**
 * Opens the preferences dialog from the main Eclipse window.
 * <p>
 * Note: There are some platform-specific intricacies that this abstracts
 * away.
 */
public static void openPreferencesDialog(final SWTWorkbenchBot bot) {
  SwtBotTestingUtilities.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      if (SwtBotTestingUtilities.isMac()) {
        // TODO: Mac has "Preferences..." under the "Eclipse" menu item.
        // However,
        // the "Eclipse" menu item is a system menu item (like the Apple menu
        // item), and can't be reached via SWTBot.
        openPreferencesDialogViaEvents(bot);
      } else {
        SWTBotMenu windowMenu = bot.menu("Window");
        windowMenu.menu("Preferences").click();
      }
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:SwtBotWorkbenchActions.java

示例8: createJavaClass

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
/**
 * Creates a Java class with the specified name.
 *
 * @param projectName the name of the project the class should be created in
 * @param sourceFolder the name of the source folder in which the class should be created.
 *        Typically "src" for normal Java projects, or "src/main/java" for Maven projects
 * @param packageName the name of the package the class should be created in
 * @param className the name of the class to be created
 */
public static void createJavaClass(final SWTWorkbenchBot bot, String sourceFolder,
    String projectName,
    String packageName, final String className) {
  SWTBotTreeItem project = SwtBotProjectActions.selectProject(bot, projectName);
  selectProjectItem(project, sourceFolder, packageName).select();
  SwtBotTestingUtilities.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      MenuItem menuItem = ContextMenuHelper.contextMenu(getProjectRootTree(bot), "New", "Class");
      new SWTBotMenu(menuItem).click();
    }
  });

  SwtBotTestingUtilities.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      bot.activeShell();
      bot.textWithLabel("Name:").setText(className);
      SwtBotTestingUtilities.clickButtonAndWaitForWindowClose(bot, bot.button("Finish"));
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:32,代码来源:SwtBotProjectActions.java

示例9: producePDFInNonUIThread

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
@Test @Ignore("not ready yet")
public void producePDFInNonUIThread() throws InterruptedException {
	
	// Open specA 
	SWTBotMenu fileMenu = bot.menu("File");
	SWTBotMenu openSpecMenu = fileMenu.menu("Open Spec");
	SWTBotMenu addNewSpecMenu = openSpecMenu.menu("Add New Spec...");
	addNewSpecMenu.click();

	bot.textWithLabel("Root-module file:").setText(specA);
	bot.button("Finish").click();
	
	// generate PDF
	SWTBotMenu pdfMenu = fileMenu.menu("Produce PDF Version");
	pdfMenu.click();
	
	// wait for the browser to show up with the generated PDF
	SWTBotEditor swtBotEditor = bot.editorById(OpenSpecHandler.TLA_EDITOR);
	Assert.assertNotNull(swtBotEditor);
	
	assertNoBackendCodeInUIThread();
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:23,代码来源:PDFHandlerThreadingTest.java

示例10: openPreferencesDialog

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
/**
 * Opens the preferences dialog from the main Eclipse window.
 * <p>
 * Note: There are some platform-specific intricacies that this abstracts
 * away.
 */
public static void openPreferencesDialog(final SWTWorkbenchBot bot) {
  SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      if (SwtBotUtils.isMac()) {
        // TODO: Mac has "Preferences..." under the "Eclipse" menu item.
        // However,
        // the "Eclipse" menu item is a system menu item (like the Apple menu
        // item), and can't be reached via SWTBot.
        openPreferencesDialogViaEvents(bot);
      } else {
        SWTBotMenu windowMenu = bot.menu("Window");
        windowMenu.menu("Preferences").click();
      }
    }
  });
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:SwtBotWorkbenchActions.java

示例11: createJavaClass

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
/**
 * Creates a java class with the specified name.
 *
 * @param bot The SWTWorkbenchBot.
 * @param projectName The name of the project the class should be created in.
 * @param packageName The name of the package the class should be created in.
 * @param className The name of the java class to be created.
 */
public static void createJavaClass(final SWTWorkbenchBot bot, String projectName,
    String packageName, final String className) {
  SWTBotTreeItem project = SwtBotProjectActions.selectProject(bot, projectName);
  selectProjectItem(project, SOURCE_FOLDER, packageName).select();
  SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      MenuItem menuItem = ContextMenuHelper.contextMenu(getProjectRootTree(bot), "New", "Class");
      new SWTBotMenu(menuItem).click();
    }
  });

  SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      bot.activeShell();
      bot.textWithLabel("Name:").setText(className);
      SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish"));
    }
  });
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:30,代码来源:SwtBotProjectActions.java

示例12: getGraphmlProperties

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public GraphModelProperties getGraphmlProperties(String folder, String pkg, String filename) {
	SWTBotTreeItem pti = getProjectTreeItem(this.projectName);
	pti.expand();

	SWTBotTreeItem fileItem = null;
	if (pkg == null) {
		fileItem = pti.expandNode(folder, filename);
	} else {
		fileItem = pti.expandNode(folder, pkg, filename);
	}

	bot.waitUntil(new isItemExpandedInTree(pti.getNode(folder)));

	fileItem.setFocus();
	fileItem.select();
	bot.waitUntil(new isItemSelectedInTree(fileItem));

	fileItem.click();

	bot.waitUntil(new isItemSelected(fileItem));

	SWTBotMenu fileMenu = bot.menu("File");
	fileMenu.menu("Properties").click();

	bot.waitUntil(Conditions.shellIsActive("Properties for " + filename));
	SWTBotShell shell = bot.shell("Properties for " + filename);
	GraphModelProperties gp = new GraphModelProperties(shell.bot(), this.projectName, folder, pkg, filename);

	return gp;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:31,代码来源:GW4EProject.java

示例13: canGenerateSource

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public SWTBotMenu canGenerateSource(boolean enabled, String... nodes) {
	SWTBotTree tree = getProjectTree();
	SWTBotTreeItem item = tree.expandNode(nodes);
	item.setFocus();
	item.select();
	SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Generate Test and Interface");
	assertEquals("Invalid state ", enabled, menu.isEnabled());
	return menu;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:GW4EProject.java

示例14: generateSource

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public void generateSource(String... nodes) {
	SWTBotTree tree = getProjectTree();
	SWTBotTreeItem item = tree.expandNode(nodes);
	item.setFocus();
	item.select();
	SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Generate Test and Interface");
	assertEquals("Invalid state ", true, menu.isEnabled());
	Display.getDefault().asyncExec(new Runnable() {
		@Override
		public void run() {
			menu.click();
		}
	});

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

示例15: refactorModelName

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入依赖的package包/类
public void refactorModelName (String newName,String [] nodes) {
	SWTBotTree tree = getProjectTree();
	SWTBotTreeItem item = tree.expandNode(nodes);
	item.select();
	item.setFocus();

	SWTBotMenu menu = item.contextMenu("Refactor").contextMenu("Rename...");
	menu.click();

	bot.waitUntil(Conditions.shellIsActive("Rename Resource"));
	SWTBotShell shell = bot.shell("Rename Resource");
	
	SWTBotText text = shell.bot().textWithLabel("New name:");
	text.setText(newName);
	
	ICondition condition = new DefaultCondition () {
		@Override
		public boolean test() throws Exception {
			return shell.bot().button("OK").isEnabled();
		}

		@Override
		public String getFailureMessage() {
			return "OK button not enabled";
		}
	};
	
	bot.waitUntil(condition);
	
	shell.bot().button("OK").click();
	
	bot.waitUntil(Conditions.shellCloses(shell));
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:34,代码来源:ModelRefactoring.java


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