protected void focusOut(SWTBotGefEditPart part,SWTBotStyledText text,String tab ) { editor.setFocus(); selectPart(part); selectTab(part, tab); try { text.setFocus(); } catch (Throwable e) { } }
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(); } }); }
public void setGuard(SWTBotGefEditPart part, String script) { selectPart(part); selectTab(part, GUARD); SWTBotStyledText st = bot.styledTextWithId(WIDGET_ID, WIDGET_GUARD_SCRIPT); st.setText(script); UIThreadRunnable.syncExec(Display.getDefault(), new VoidResult() { @Override public void run() { st.widget.notifyListeners(SWT.FocusOut, null); editor.setFocus(); } }); }
public String getGuard(SWTBotGefEditPart part) { selectPart(part); selectTab(part, GUARD); SWTBotStyledText st = bot.styledTextWithId(WIDGET_ID, WIDGET_GUARD_SCRIPT); String s = st.getText(); if (s==null) return ""; return s; }
public void setAction(SWTBotGefEditPart part, String script) { selectPart(part); selectTab(part, ACTION); SWTBotStyledText st = bot.styledTextWithId(WIDGET_ID, WIDGET_ACTION_SCRIPT); st.setText(script); UIThreadRunnable.syncExec(Display.getDefault(), new VoidResult() { @Override public void run() { st.widget.notifyListeners(SWT.FocusOut, null); editor.setFocus(); } }); }
public String getAction(SWTBotGefEditPart part) { selectPart(part); selectTab(part, ACTION); SWTBotStyledText st = bot.styledTextWithId(WIDGET_ID, WIDGET_ACTION_SCRIPT); String s = st.getText(); if (s==null) return ""; return s; }
public void assertTexts(SWTBotShell page, String[] texts) { SWTBotStyledText styledText = page.bot().styledText(); for (String text : texts) { if (styledText.getText().indexOf(text) == -1) { org.junit.Assert.fail("Text does not contain " + text); } } }
public void assertActionAndResult(SWTBotShell page, String description, String result) { SWTBotStyledText styledTextDescription = page.bot().styledTextWithId( org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_STEP_PAGE_DESCRIPTION_ID); SWTBotStyledText styledTextResult = page.bot().styledTextWithId( org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_STEP_PAGE_RESULT_ID); org.junit.Assert.assertEquals("Invalid Result", result, styledTextResult.getText()); org.junit.Assert.assertEquals("Invalid Description", description, styledTextDescription.getText()); }
public StepPage setResult(SWTBotShell page, String result) { SWTBotStyledText styledTextResult = page.bot().styledTextWithId( org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, org.gw4e.eclipse.wizard.runasmanual.StepPage.GW4E_STEP_PAGE_RESULT_ID); styledTextResult.setText(result); return this; }
/** * Wait until the given text widget contains the provided string */ public static void waitUntilStyledTextContains(SWTBot bot, final String text, final SWTBotStyledText widget) { bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return widget.getText().contains(text); } @Override public String getFailureMessage() { return "Text not found!"; } }); }
@Override public boolean test() throws Exception { msg = "Could not open Console view"; SWTBotView consoleView = bot.viewById("org.eclipse.ui.console.ConsoleView"); msg = "Could not find textWidget in Console view"; SWTBotStyledText textWidget = consoleView.bot().styledText(); msg = "Could not get the text from the Console view"; String text = textWidget.getText(); msg = "Looking for: '" + searchString + "' but found \n\t------\n\t" + text + "\n\t-----"; return text.contains(searchString); }
public String getConsoleText() { SWTBotView console = waitForConsoleBeDisplayed (); SWTBotStyledText textWidget = console.bot().styledText(); return textWidget.getText(); }