本文整理汇总了Java中org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable类的典型用法代码示例。如果您正苦于以下问题:Java UIThreadRunnable类的具体用法?Java UIThreadRunnable怎么用?Java UIThreadRunnable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIThreadRunnable类属于org.eclipse.swtbot.swt.finder.finders包,在下文中一共展示了UIThreadRunnable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImportSession
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
@Test
public void testImportSession() {
// given
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.eclemma.ui.CoverageView");
} catch (PartInitException e) {
e.printStackTrace();
}
}
});
// when
SWTBotView view = bot.viewByTitle("Coverage");
view.bot().tree().contextMenu("Import Session...").click();
// then
bot.shell("Import").activate();
bot.text(" Please select an existing execution data file.");
}
示例2: testShowInBookmarksView
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
@Test
public void testShowInBookmarksView() throws TimeoutException {
// Given
IWorkbenchPage activePage = UIThreadRunnable
.syncExec(() -> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage());
assertNotNull(activePage);
// When
bookmarksService.showInBookmarksView(activePage, new BookmarkId("bookmark21"), true);
// Then
SWTBotTree botTree = bookmarksViewDriver.tree();
Waiter.waitUntil("bookmark not selected", () -> {
assertThat(botTree.selection().get(0).get(0)).isEqualTo("bookmark21");
return true;
});
}
示例3: textEditor
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
private SWTBotEclipseEditor textEditor(String fullyQualifiedType) throws JavaModelException, PartInitException {
IType type = javaProject.findType(fullyQualifiedType);
IEditorPart editorPart = UIThreadRunnable.syncExec(new Result<IEditorPart>() {
public IEditorPart run() {
try {
return JavaUI.openInEditor(type, true, true);
} catch (PartInitException | JavaModelException e) {
throw new RuntimeException(e);
}
}
});
// IEditorPart editorPart = JavaUI.openInEditor(type, true, true);
SWTBotEditor editor = bot.editorById(editorPart.getEditorSite().getId());
return editor.toTextEditor();
}
示例4: testStarted
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public void testStarted(final Description description) {
if (!screenshotsCleared) {
deleteDirectoryContents(new File(screenshotFolder));
screenshotsCleared = true;
}
testFailed = false;
testStepStarted = false;
if (description.getTestClass() != null) {
testClassName = description.getTestClass().getName();
} else {
testClassName = testClass.getSimpleName();
}
testMethodName = description.getMethodName();
AbstractTestStep.registerTestStepListener(this);
UIThreadRunnable.syncExec(new VoidResult() {
@Override
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addMouseListener(TestRunRecording.this);
}
});
start();
}
示例5: testFinished
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public void testFinished(final Description description) {
stop();
AbstractTestStep.removeTestStepListener(this);
UIThreadRunnable.syncExec(new VoidResult() {
@Override
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().removeMouseListener(TestRunRecording.this);
}
});
if (!testFailed) {
deleteScreenshots();
}
}
示例6: click
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
/**
* Clicks on the {@link MenuItem}.
*
* @param menuItem
* the {@link MenuItem} to click on
*/
private static void click(final MenuItem menuItem) {
final Event event = new Event();
event.time = (int) System.currentTimeMillis();
event.widget = menuItem;
event.display = menuItem.getDisplay();
event.type = SWT.Selection;
UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() {
@Override
public void run() {
if (SWTUtils.hasStyle(menuItem, SWT.CHECK) || SWTUtils.hasStyle(menuItem, SWT.RADIO)) {
menuItem.setSelection(!menuItem.getSelection());
}
menuItem.notifyListeners(SWT.Selection, event);
}
});
}
示例7: assertShellWithDataTypeVisible
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
/**
* Tests if a shell with a specific type of data contained (e.g. Window).
*
* @param bot
* to use
* @param clazz
* class of data contained to check for
*/
@SuppressWarnings("rawtypes")
public static void assertShellWithDataTypeVisible(final SWTWorkbenchBot bot, final Class clazz) {
bot.waitUntil(Conditions.waitForShell(new BaseMatcher<Shell>() {
@SuppressWarnings("unchecked")
public boolean matches(final Object item) {
return UIThreadRunnable.syncExec(new Result<Boolean>() {
public Boolean run() {
if (item instanceof Shell) {
Object shellData = ((Shell) item).getData();
if (shellData != null) {
return clazz.isAssignableFrom(shellData.getClass());
}
}
return false;
}
});
}
public void describeTo(final Description description) {
description.appendText("Shell for " + clazz.getName());
}
}));
}
示例8: beforeClass
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的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;
}
}
});
}
示例9: testController
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
@Override
@Test
public void testController() throws ESException {
final Player player = createPlayerAndCommit();
UIThreadRunnable.asyncExec(new VoidResult() {
public void run() {
final UIShowHistoryController showHistoryController =
new UIShowHistoryController(bot.getDisplay().getActiveShell(), player);
showHistoryController.execute();
}
});
final SWTBotView historyView = bot.viewById(
"org.eclipse.emf.emfstore.client.ui.views.historybrowserview.HistoryBrowserView");
assertNotNull(historyView);
}
示例10: testController
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
@Override
@Test
public void testController() throws ESException {
createPlayerAndCommit();
UIThreadRunnable.asyncExec(new VoidResult() {
public void run() {
final UIShowHistoryController showHistoryController =
new UIShowHistoryController(bot.getDisplay().getActiveShell(), localProject);
showHistoryController.execute();
}
});
final SWTBotView historyView = bot.viewById(
"org.eclipse.emf.emfstore.client.ui.views.historybrowserview.HistoryBrowserView");
assertNotNull(historyView);
}
示例11: createTag
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
private ESPathQuery createTag() throws ESException {
ESPrimaryVersionSpec baseVersion = localProject.getBaseVersion();
createPlayerAndCommit();
ESPathQuery pathQuery = ESHistoryQuery.FACTORY
.pathQuery(baseVersion, localProject.getBaseVersion(), true, true);
List<ESHistoryInfo> historyInfos = localProject.getHistoryInfos(pathQuery, new NullProgressMonitor());
assertEquals(2, historyInfos.size());
final ESHistoryInfo historyInfo = historyInfos.get(1);
assertEquals(2, historyInfo.getTagSpecs().size());
UIThreadRunnable.asyncExec(
new VoidResult() {
public void run() {
UIAddTagController addTagController = new UIAddTagController(bot.getDisplay().getActiveShell(),
localProject, historyInfo);
addTagController.execute();
}
});
bot.table(0).select(0);
SWTBotButton button = bot.button("OK");
button.click();
return pathQuery;
}
示例12: addServer
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
private void addServer() {
final int howManyServers = ESWorkspaceProvider.INSTANCE.getWorkspace().getServers().size();
UIThreadRunnable.asyncExec(new VoidResult() {
public void run() {
final UIAddServerController addServerController = new UIAddServerController(
bot.getDisplay().getActiveShell());
addServerController.execute();
}
});
bot.button("Finish").click();
bot.waitUntil(new DefaultCondition() {
// BEGIN SUPRESS CATCH EXCEPTION
public boolean test() throws Exception {
return howManyServers + 1 == ESWorkspaceProvider.INSTANCE.getWorkspace().getServers().size();
}
public String getFailureMessage() {
return "Add server did not succeed.";
}
// END SUPRESS CATCH EXCEPTION
});
assertEquals(howManyServers + 1, ESWorkspaceProvider.INSTANCE.getWorkspace().getServers().size());
}
示例13: baseBeforeTest
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的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
}
}
示例14: selectTab
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
protected void selectTab(SWTBotGefEditPart part, String label) {
selectPart(part);
Matcher<TabbedPropertyList> matcher = new BaseMatcher<TabbedPropertyList>() {
@Override
public boolean matches(Object item) {
if (item instanceof TabbedPropertyList) {
return true;
}
return false;
}
@Override
public void describeTo(Description description) {
}
};
List<TabbedPropertyList> allWidgets = widget(matcher);
UIThreadRunnable.syncExec(Display.getDefault(), new VoidResult() {
@Override
public void run() {
for (final TabbedPropertyList tabbedProperty : allWidgets) {
final ListElement tabItem = getTabItem(label, tabbedProperty);
if (tabItem != null) {
final Event mouseEvent = createEvent(tabItem);
tabItem.notifyListeners(SWT.MouseUp, mouseEvent);
tabItem.setFocus();
return;
}
}
throw new IllegalStateException("Unable to select the tab " + label);
}
});
}
示例15: setInit
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; //导入依赖的package包/类
public void setInit(SWTBotGefEditPart part, String script) {
selectPart(part);
selectTab(part, INIT);
SWTBotStyledText st = bot.styledTextWithId( WIDGET_ID, WIDGET_SCRIPT);
st.setText(script);
UIThreadRunnable.syncExec(Display.getDefault(), new VoidResult() {
@Override
public void run() {
st.widget.notifyListeners(SWT.FocusOut, null);
editor.setFocus();
}
});
}