Java Code Examples for org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#closeAllEditors()
The following examples show how to use
org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#closeAllEditors() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwtBotWorkbenchActions.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Reimplementation of {@link SWTWorkbenchBot#resetWorkbench()} due to Eclipse bug 511729 on * Oxygen. */ public static void resetWorkbench(SWTWorkbenchBot bot) { closeAllShells(bot); bot.saveAllEditors(); bot.closeAllEditors(); bot.resetActivePerspective(); bot.defaultPerspective().activate(); bot.resetActivePerspective(); }
Example 2
Source File: CtfTmfExperimentTrimmingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Setup before the test suite * * @throws IOException * failed to load the file */ @BeforeClass public static void beforeClass() throws IOException { SWTBotUtils.initialize(); /* set up for swtbot */ SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */ fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); File parentDir = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.TRACE_EXPERIMENT.getTraceURL())); File[] traceFiles = parentDir.listFiles(); ITmfTrace traceValidator = new CtfTmfTrace(); fBot = new SWTWorkbenchBot(); SWTBotUtils.createProject(PROJECT_NAME); int openedTraces = 0; for (File traceFile : traceFiles) { String absolutePath = traceFile.getAbsolutePath(); if (traceValidator.validate(null, absolutePath).isOK()) { SWTBotUtils.openTrace(PROJECT_NAME, absolutePath, TRACE_TYPE); fBot.closeAllEditors(); openedTraces++; if (openedTraces >= NUM_TRACES) { break; } } } traceValidator.dispose(); /* finish waiting for eclipse to load */ WaitUtils.waitForJobs(); }
Example 3
Source File: TimeGraphViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Put things back the way they were */ @AfterClass public static void afterClass() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); bot.closeAllEditors(); fLogger.removeAllAppenders(); }
Example 4
Source File: XYChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Put things back the way they were */ @AfterClass public static void afterClass() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); bot.closeAllEditors(); fLogger.removeAllAppenders(); }
Example 5
Source File: XYChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Put things back the way they were */ @AfterClass public static void afterClass() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); bot.closeAllEditors(); fLogger.removeAllAppenders(); }
Example 6
Source File: SystemCallLatencyDensityViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test with an actual trace, this is more of an integration test than a * unit test. This test is a slow one too. If some analyses are not well * configured, this test will also generates null pointer exceptions. These * will be logged. * * @throws IOException * trace not found? * @throws SecurityException * If a security manager is present and any the wrong class is * loaded or the class loader is not the same as its ancestor's * loader. * * @throws NoSuchFieldException * Field not available * @throws IllegalAccessException * Field is inaccessible * @throws IllegalArgumentException * the object is not the correct class type * */ @Test public void testWithTrace() throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String tracePath = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL())).getAbsolutePath(); SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotUtils.closeViewById(VIEW_ID, fBot); SWTBotUtils.createProject(PROJECT_NAME); SWTBotUtils.openTrace(PROJECT_NAME, tracePath, TRACE_TYPE); WaitUtils.waitForJobs(); createDensityViewer(); WaitUtils.waitForJobs(); SWTBotTable tableBot = new SWTBotTable(fDensityViewer.getTableViewer().getTable()); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,600", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,600", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,001,046,400", 0, 2)); final Chart densityChart = fDensityChart; assertNotNull(densityChart); bot.waitUntil(ConditionHelpers.numberOfSeries(densityChart, 1)); SWTBotChart chartBot = new SWTBotChart(densityChart); assertVisible(chartBot); assertEquals("", chartBot.getToolTipText()); final Range range = densityChart.getAxisSet().getXAxes()[0].getRange(); assertTrue(0 > range.lower); assertTrue(1001046400 < range.upper); bot.closeAllEditors(); SWTBotUtils.deleteProject(PROJECT_NAME, bot); }
Example 7
Source File: LamiChartViewerTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Delete the project and de-register the LAMI analyses */ @AfterClass public static void afterClass() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); bot.closeAllEditors(); SWTBotUtils.deleteProject(PROJECT_NAME, bot); fLogger.removeAllAppenders(); OnDemandAnalysisManager.getInstance().unregisterAnalysis(LamiAnalyses.MULTIPLE_ROW.getAnalysis()); OnDemandAnalysisManager.getInstance().unregisterAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW.getAnalysis()); }
Example 8
Source File: ImportAndReadKernelSmokeTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void testStateSystemExplorer(String tracePath) { // Set up SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotUtils.openView(CpuUsageView.ID); SWTBotView cpuUsageBot = bot.viewById(CpuUsageView.ID); // Open the view SWTBotUtils.openView(TmfStateSystemExplorer.ID); SWTBotView sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); Set<@NonNull Entry<String, Set<String>>> actualAnalyses = getSsNames(sseBot); assertTrue("Wrong state systems: expected: " + EXPECTED_ANALYSES + ", actual: " + actualAnalyses, actualAnalyses.containsAll(EXPECTED_ANALYSES)); // Re-open the view and make sure it has the same results sseBot.close(); SWTBotUtils.openView(TmfStateSystemExplorer.ID); sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); actualAnalyses = getSsNames(sseBot); assertTrue("Wrong state systems: expected: " + EXPECTED_ANALYSES + ", actual: " + actualAnalyses, actualAnalyses.containsAll(EXPECTED_ANALYSES)); // Close the trace, and re-open it, let's compare one last time bot.closeAllEditors(); bot.waitUntil(treeHasRows(sseBot.bot().tree(), 0)); // re-open the trace SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE); actualAnalyses = getSsNames(sseBot); assertTrue("Wrong state systems: expected: " + EXPECTED_ANALYSES + ", actual: " + actualAnalyses, actualAnalyses.containsAll(EXPECTED_ANALYSES)); sseBot.close(); cpuUsageBot.close(); }
Example 9
Source File: TimeGraphViewTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Before the test is run, make the view see the items. * * Reset the perspective and close all the views. * * @throws TmfTraceException * could not load a trace */ @Before public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } SWTBotUtils.openView(TimeGraphViewStub.ID); fViewBot = fBot.viewById(TimeGraphViewStub.ID); fViewBot.show(); fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } @Override public ITmfTimestamp getInitialRangeOffset() { return TmfTimestamp.fromNanos(80); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); fTimeGraph = new SWTBotTimeGraph(fViewBot.bot()); // Wait for trace to be loaded fViewBot.bot().waitUntil(new TgConditionHelper(t -> fTimeGraph.getEntries().length == 0)); fBounds = getBounds(); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); // Wait for trace to be loaded fViewBot.bot().waitUntil(new TgConditionHelper(t -> fTimeGraph.getEntries().length >= 2)); resetTimeRange(); // Make sure the thumb is over 1 in size fBot.waitUntil(new TgConditionHelper(t -> fViewBot.bot().slider().getThumb() > 1)); }
Example 10
Source File: XYChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Before the test is run, make the view see the items. * * Reset the perspective and close all the views. * * @throws TmfTraceException * could not load a trace */ @Before public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); // Register trace to trace manager UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); // Open view SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); TmfChartView viewPart = (TmfChartView) fViewBot.getViewReference().getView(true); fXyViewer = viewPart.getChartViewer(); // Wait till SWT chart is constructed fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); // Wait for trace to be loaded resetTimeRange(); }
Example 11
Source File: XYChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Before the test is run, make the view see the items. * * Reset the perspective and close all the views. * * @throws TmfTraceException * could not load a trace */ @Before public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); // Register trace to trace manager UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); // Open view SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); TmfChartView viewPart = (TmfChartView) fViewBot.getViewReference().getView(true); fXyViewer = viewPart.getChartViewer(); // Wait till SWT chart is constructed fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); // Wait for trace to be loaded resetTimeRange(); }
Example 12
Source File: EditorConfigTest.java From editorconfig-eclipse with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { bot = new SWTWorkbenchBot(); context = new EditorConfigTestContext(bot, "editorconfig-test"); bot.closeAllEditors(); }