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


Java SWTBotMenu.menu方法代码示例

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


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

示例1: 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

示例2: 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

示例3: parseSpecInNonUIThread

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
/**
 * Adds a new spec to the toolbox, opens it and tests if parsing is done on
 * a non-UI thread
 * 
 * @see Bug #103 in general/bugzilla/index.html
 */
@Test
public void parseSpecInNonUIThread() {

	// 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(specB);
	bot.button("Finish").click();

	assertNoBackendCodeInUIThread();

	// Open specB
	addNewSpecMenu.click();

	bot.textWithLabel("Root-module file:").setText(specA);
	bot.button("Finish").click();

	assertNoBackendCodeInUIThread();

	final String specName = getSpecName(new File(specB));

	// increase timeout since farsite spec takes a long time to parse
	final long timeout = SWTBotPreferences.TIMEOUT * 4;

	// specs are created in non-UI thread asynchronously which causes a
	// delay before the menu entry becomes available
	bot.waitUntil(Conditions.waitForMenu(waitForToolboxShell(), WithText.<MenuItem> withText(specName)), timeout);

	// Go back to previous spec
	openSpecMenu.menu(specName);

	assertNoBackendCodeInUIThread();
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:43,代码来源:HandlerThreadingTest.java

示例4: setUp

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	super.setUp();
	
	// create a dummy spec "ToBeRenamedSpec"
	SWTBotMenu fileMenu = bot.menu("File");
	SWTBotMenu openSpecMenu = fileMenu.menu("Open Spec");
	SWTBotMenu addNewSpecMenu = openSpecMenu.menu("Add New Spec...");
	addNewSpecMenu.click();
	
	String path = System.getProperty("java.io.tmpdir") + File.separator + "RSHTest"
			+ System.currentTimeMillis();
	path += File.separator + TEST_SPEC + TLA_SUFFIX;

	bot.textWithLabel("Root-module file:").setText(path);
	bot.button("Finish").click();

	final String specName = getSpecName(new File(path));
	bot.waitUntil(Conditions.waitForMenu(bot.activeShell(), WithText.<MenuItem> withText(specName)));
	
	// create a new dummy model
	final SWTBotMenu modelMenu = bot.menu("TLC Model Checker");
	final SWTBotMenu newModelMenu = modelMenu.menu("New Model...");
	newModelMenu.click();
	bot.button("OK").click();
	bot.waitUntil(new ModelEditorOpenCondition(TEST_MODEL));
	
	// save and close model editor
	SWTBotEditor activeEditor = bot.activeEditor();
	activeEditor.saveAndClose();
	
	checkSpecAndModelExistenceAPI(TEST_SPEC);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:34,代码来源:CloneModelTest.java

示例5: cloneModelMainMenu

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
@Test
public void cloneModelMainMenu() {
	final SWTBotMenu modelMenu = bot.menu("TLC Model Checker");
	final SWTBotMenu cloneModelMenu = modelMenu.menu("Clone Model");
	final SWTBotMenu cloneModelSubMenu = cloneModelMenu.click();
	cloneModelSubMenu.menu(TEST_MODEL).click();

	bot.button("OK").click();
	bot.waitUntil(new ModelEditorOpenCondition(TEST_MODEL_RENAME));
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:11,代码来源:CloneModelTest.java

示例6: openSpecExplorer

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
private void openSpecExplorer() {
	SWTBotMenu windowMenu = bot.menu("Window");
	SWTBotMenu specExplorerMenu = windowMenu.menu(SPEC_EXPLORER);
	specExplorerMenu.click();
	
	// spec context menu
	SWTBotView packageExplorerView = bot.viewByTitle(SPEC_EXPLORER);
	packageExplorerView.setFocus();
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:10,代码来源:RenameSpecHandlerTest.java

示例7: doNotAcceptInvalidSpecNames

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
/**
 * Test to make sure the "Add Spec" wizard does not accept invalid spec names
 */
@Test
public void doNotAcceptInvalidSpecNames() {
	
	// Open specA 
	SWTBotMenu fileMenu = bot.menu("File");
	SWTBotMenu openSpecMenu = fileMenu.menu("Open Spec");
	SWTBotMenu addNewSpecMenu = openSpecMenu.menu("Add New Spec...");
	addNewSpecMenu.click();

	// get a handle for the button before invoking the UI (widget not found exception otherwise)
	SWTBotButton button = bot.button("Finish");
	
	// create a valid path
	String path = System.getProperty("java.io.tmpdir");
	path += File.separator + "Invalid-Name.tla";
	
	// set an invalid spec name
	bot.textWithLabel("Root-module file:").setText(path);
	
	// check if the wizard can finish
	Assert.assertTrue(
			"Finish button must not be enabled with invalid spec name",
			!button.isEnabled());
	
	//TODO could change the wizard marker/error area for the correct string too
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:30,代码来源:AddSpecWizardTest.java

示例8: executeExit

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
@Test
public void executeExit() {
	// testing on hard-coded String just to have
	// a simple example

	SWTBotMenu fileMenu = bot.menu("File");
	Assert.assertNotNull(fileMenu);
	SWTBotMenu exitMenu = fileMenu.menu("Exit");
	Assert.assertNotNull(exitMenu);
	exitMenu.click();
}
 
开发者ID:scenarioo,项目名称:scenarioo-example-swtbot-e4,代码行数:12,代码来源:ExitHandlerTest.java

示例9: isEnabled

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
public boolean isEnabled () {
	SWTBotMenu fileMenu = bot.menu("Edit");
	SWTBotMenu copyMenu = fileMenu.menu("Copy");
	return copyMenu.isEnabled();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:6,代码来源:ToolBarEditor.java

示例10: click

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
public void click () {
	SWTBotMenu fileMenu = bot.menu("Edit");
	SWTBotMenu copyMenu = fileMenu.menu("Copy");
	copyMenu.click();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:6,代码来源:ToolBarEditor.java

示例11: testNewModel

import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; //导入方法依赖的package包/类
@Test
public void testNewModel() {
	// 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();

	final String specName = getSpecName(new File(specA));

	// specs are created in non-UI thread asynchronously which causes a
	// delay before the menu entry becomes available
	bot.waitUntil(Conditions.waitForMenu(bot.activeShell(), WithText.<MenuItem> withText(specName)));
	
	// create a new model
	final SWTBotMenu modelMenu = bot.menu("TLC Model Checker");
	final SWTBotMenu newModelMenu = modelMenu.menu("New Model...");
	newModelMenu.click();
	bot.button("OK").click();

	// wait for model editor to show up and parse
	bot.waitUntil(new ModelEditorOpenCondition("Model_"));
	
	// register job listener who listens for the model checker job
	final String modelName = UIHelper.getActiveEditor().getTitle();
	final Model model = ToolboxHandle.getCurrentSpec().getAdapter(TLCSpec.class).getModel(modelName);
	final IJobChangeListener listener = new DummyJobChangeListener(model);
	Job.getJobManager().addJobChangeListener(listener);
	
	// start model checking by clicking the menu. This is more robust
	// compared to the f11 keystroke which can get lost when fired during
	// initialization of the model editor.
	bot.menu("TLC Model Checker").menu("Run model").click();

	// make unit test wait for model checker job to finish
	bot.waitUntil((ICondition) listener, SWTBotPreferences.TIMEOUT * 3);

	// Do some unregistration prior to model deletion:
	Job.getJobManager().removeJobChangeListener(listener);
	
	// close corresponding editor if open
	final IEditorPart editorWithModelOpened = model.getAdapter(ModelEditor.class);
	if (editorWithModelOpened != null) {
		UIHelper.runUISync(new Runnable() {
			public void run() {
				UIHelper.getActivePage().closeEditor(editorWithModelOpened,
						false);
			}
		});
	}

	// Delete the newly created model again. It does not use the UI because
	// SWTBot cannot handle the modal confirmation dialog do delete the
	// model.
	// Deleting the model is necessary because repeated test execution would
	// leave huge numbers of model leftovers contributing to slowed down test
	// execution (see SizeControlContribution for reason why).
	try {
		model.delete(new NullProgressMonitor());
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:67,代码来源:ModelCheckerTest.java


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