Commit | Line | Data |
---|---|---|
f2a4ccd3 PT |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Patrick Tasse - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests; | |
14 | ||
9cb4e90c | 15 | import static org.junit.Assert.assertEquals; |
f2a4ccd3 PT |
16 | import static org.junit.Assert.assertFalse; |
17 | import static org.junit.Assert.assertTrue; | |
18 | ||
19 | import org.eclipse.jdt.annotation.NonNull; | |
20 | import org.eclipse.jface.bindings.keys.KeyStroke; | |
21 | import org.eclipse.swt.SWT; | |
9cb4e90c PT |
22 | import org.eclipse.swt.graphics.Point; |
23 | import org.eclipse.swt.widgets.Control; | |
f2a4ccd3 PT |
24 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; |
25 | import org.eclipse.swtbot.swt.finder.SWTBot; | |
9cb4e90c | 26 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; |
f2a4ccd3 PT |
27 | import org.eclipse.swtbot.swt.finder.keyboard.Keyboard; |
28 | import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory; | |
29 | import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; | |
9cb4e90c PT |
30 | import org.eclipse.swtbot.swt.finder.matchers.WidgetOfType; |
31 | import org.eclipse.swtbot.swt.finder.results.Result; | |
32 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotCanvas; | |
f2a4ccd3 PT |
33 | import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal; |
34 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; | |
35 | import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal; | |
36 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; | |
f2a4ccd3 | 37 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; |
b2c971ec | 38 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; |
f2a4ccd3 PT |
39 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; |
40 | import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView; | |
9cb4e90c PT |
41 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl; |
42 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphMarkerAxis; | |
f2a4ccd3 PT |
43 | import org.eclipse.ui.IWorkbenchPart; |
44 | import org.junit.Before; | |
45 | import org.junit.Ignore; | |
46 | import org.junit.Test; | |
47 | ||
48 | /** | |
49 | * SWTBot tests for Resources view | |
50 | * | |
51 | * @author Patrick Tasse | |
52 | */ | |
b0d2c558 | 53 | public class ResourcesViewTest extends KernelTestBase { |
f2a4ccd3 PT |
54 | |
55 | private static final String NEXT_MARKER = "Next Marker"; | |
56 | private static final String PREVIOUS_MARKER = "Previous Marker"; | |
57 | private static final String SELECT_NEXT_EVENT = "Select Next Event"; | |
58 | private static final String SELECT_PREVIOUS_EVENT = "Select Previous Event"; | |
59 | private static final String ADD_BOOKMARK = "Add Bookmark..."; | |
60 | private static final String REMOVE_BOOKMARK = "Remove Bookmark"; | |
61 | private static final String ADD_BOOKMARK_DIALOG = "Add Bookmark"; | |
62 | private static final String LOST_EVENTS = "Lost Events"; | |
63 | private static final String OK = "OK"; | |
64 | private static final Keyboard KEYBOARD = KeyboardFactory.getSWTKeyboard(); | |
b2c971ec MK |
65 | private static final @NonNull ITmfTimestamp START_TIME = TmfTimestamp.fromNanos(1368000272650993664L); |
66 | private static final @NonNull ITmfTimestamp LOST_EVENT_TIME1 = TmfTimestamp.fromNanos(1368000272681793477L); | |
67 | private static final @NonNull ITmfTimestamp LOST_EVENT_END1 = TmfTimestamp.fromNanos(1368000272681793477L + 7425331L); | |
68 | private static final @NonNull ITmfTimestamp LOST_EVENT_TIME2 = TmfTimestamp.fromNanos(1368000272820875850L); | |
69 | private static final @NonNull ITmfTimestamp LOST_EVENT_END2 = TmfTimestamp.fromNanos(1368000272820875850L + 6640670L); | |
70 | private static final @NonNull ITmfTimestamp LOST_EVENT_TIME3 = TmfTimestamp.fromNanos(1368000272882715015L); | |
71 | private static final @NonNull ITmfTimestamp LOST_EVENT_END3 = TmfTimestamp.fromNanos(1368000272882715015L + 11373385L); | |
72 | private static final @NonNull ITmfTimestamp CPU0_TIME1 = TmfTimestamp.fromNanos(1368000272651208412L); | |
73 | private static final @NonNull ITmfTimestamp CPU0_TIME2 = TmfTimestamp.fromNanos(1368000272651852656L); | |
74 | private static final @NonNull ITmfTimestamp CPU0_TIME3 = TmfTimestamp.fromNanos(1368000272652067404L); | |
75 | private static final @NonNull ITmfTimestamp CPU0_TIME4 = TmfTimestamp.fromNanos(1368000272652282152L); | |
76 | private static final @NonNull ITmfTimestamp CPU0_TIME5 = TmfTimestamp.fromNanos(1368000272653141144L); | |
9cb4e90c PT |
77 | private static final int TOP_MARGIN = 1; |
78 | private static final Point TOGGLE_SIZE = new Point(7, 8); | |
79 | private static final Point HIDE_SIZE = new Point(16, 16); | |
f2a4ccd3 PT |
80 | |
81 | private SWTBotView fViewBot; | |
82 | ||
83 | /** | |
84 | * Before Test | |
85 | */ | |
86 | @Override | |
87 | @Before | |
88 | public void before() { | |
89 | fViewBot = fBot.viewByTitle("Resources"); | |
90 | fViewBot.show(); | |
91 | super.before(); | |
92 | fViewBot.setFocus(); | |
93 | } | |
94 | ||
95 | /** | |
96 | * Test keyboard marker navigation using '.' and ',' | |
97 | */ | |
98 | @Test | |
99 | public void testKeyboardSelectNextPreviousMarker() { | |
100 | testNextPreviousMarker( | |
101 | () -> KEYBOARD.pressShortcut(KeyStroke.getInstance('.')), | |
102 | () -> KEYBOARD.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance('.')), | |
103 | () -> KEYBOARD.pressShortcut(KeyStroke.getInstance(',')), | |
104 | () -> KEYBOARD.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(','))); | |
105 | } | |
106 | ||
107 | /** | |
108 | * Test tool bar buttons "Next Marker" and "Previous Marker" | |
109 | */ | |
110 | @Test | |
111 | public void testToolBarSelectNextPreviousMarker() { | |
112 | testNextPreviousMarker( | |
113 | () -> fViewBot.toolbarButton(NEXT_MARKER).click(), | |
114 | () -> fViewBot.toolbarButton(NEXT_MARKER).click(SWT.SHIFT), | |
115 | () -> fViewBot.toolbarButton(PREVIOUS_MARKER).click(), | |
116 | () -> fViewBot.toolbarButton(PREVIOUS_MARKER).click(SWT.SHIFT)); | |
117 | } | |
118 | ||
119 | private void testNextPreviousMarker(Runnable nextMarker, Runnable shiftNextMarker, Runnable previousMarker, Runnable shiftPreviousMarker) { | |
120 | /* set selection to trace start time */ | |
121 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
122 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME); | |
123 | ||
124 | /* select first item */ | |
125 | KEYBOARD.pressShortcut(Keystrokes.HOME); | |
126 | ||
127 | /* click "Next Marker" 3 times */ | |
128 | nextMarker.run(); | |
129 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1); | |
130 | nextMarker.run(); | |
131 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2); | |
132 | nextMarker.run(); | |
133 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_TIME3); | |
134 | ||
135 | /* shift-click "Previous Marker" 3 times */ | |
136 | shiftPreviousMarker.run(); | |
137 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME3), LOST_EVENT_TIME3); | |
138 | shiftPreviousMarker.run(); | |
139 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME2), LOST_EVENT_TIME2); | |
140 | shiftPreviousMarker.run(); | |
141 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME1), LOST_EVENT_TIME1); | |
142 | ||
143 | /* shift-click "Next Marker" 3 times */ | |
144 | shiftNextMarker.run(); | |
145 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END1), LOST_EVENT_END1); | |
146 | shiftNextMarker.run(); | |
147 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END2), LOST_EVENT_END2); | |
148 | shiftNextMarker.run(); | |
149 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_END3); | |
150 | ||
151 | /* click "Previous Marker" 3 times */ | |
152 | previousMarker.run(); | |
153 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2); | |
154 | previousMarker.run(); | |
155 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1); | |
156 | previousMarker.run(); | |
157 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1); | |
158 | } | |
159 | ||
160 | /** | |
161 | * Test "Show Markers" view menu | |
162 | */ | |
f2a4ccd3 PT |
163 | @Test |
164 | public void testShowMarkers() { | |
165 | /* set selection to trace start time */ | |
166 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
167 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME); | |
168 | ||
169 | /* select first item */ | |
170 | KEYBOARD.pressShortcut(Keystrokes.HOME); | |
171 | ||
172 | /* check that "Next Marker" and "Previous Marker" are enabled */ | |
173 | assertTrue(fViewBot.toolbarButton(NEXT_MARKER).isEnabled()); | |
174 | assertTrue(fViewBot.toolbarButton(PREVIOUS_MARKER).isEnabled()); | |
175 | ||
176 | /* disable Lost Events markers */ | |
fb25a6ad | 177 | fViewBot.viewMenu(LOST_EVENTS).click(); |
f2a4ccd3 PT |
178 | |
179 | /* check that "Next Marker" and "Previous Marker" are disabled */ | |
180 | assertFalse(fViewBot.toolbarButton(NEXT_MARKER).isEnabled()); | |
181 | assertFalse(fViewBot.toolbarButton(PREVIOUS_MARKER).isEnabled()); | |
182 | ||
183 | /* enable Lost Events markers */ | |
fb25a6ad | 184 | fViewBot.viewMenu(LOST_EVENTS).click(); |
f2a4ccd3 PT |
185 | |
186 | /* check that "Next Marker" and "Previous Marker" are enabled */ | |
187 | assertTrue(fViewBot.toolbarButton(NEXT_MARKER).isEnabled()); | |
188 | assertTrue(fViewBot.toolbarButton(PREVIOUS_MARKER).isEnabled()); | |
189 | } | |
190 | ||
191 | /** | |
192 | * Test "Next Event" tool bar button sub-menu | |
193 | */ | |
194 | /* SWTBot doesn't support clicking the same tool bar sub-menu twice */ | |
195 | @Ignore | |
196 | @Test | |
197 | public void testMarkerNavigationSubMenu() { | |
198 | /* set selection to trace start time */ | |
199 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
200 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME); | |
201 | ||
202 | /* select first item */ | |
203 | KEYBOARD.pressShortcut(Keystrokes.HOME); | |
204 | ||
205 | /* disable Lost Events navigation */ | |
206 | fViewBot.toolbarDropDownButton(NEXT_MARKER).menuItem(LOST_EVENTS).click(); | |
207 | ||
208 | /* click "Next Marker" */ | |
209 | fViewBot.toolbarButton(NEXT_MARKER).click(); | |
210 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME); | |
211 | ||
212 | /* enable Lost Events navigation */ | |
213 | fViewBot.toolbarDropDownButton(NEXT_MARKER).menuItem(LOST_EVENTS).click(); | |
214 | ||
215 | /* click "Next Marker" */ | |
216 | fViewBot.toolbarButton(NEXT_MARKER).click(); | |
217 | timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1); | |
218 | } | |
219 | ||
220 | /** | |
221 | * Test tool bar button "Add Bookmark..." and "Remove Bookmark" | |
222 | */ | |
223 | @Test | |
224 | public void testAddRemoveBookmark() { | |
225 | /* change window range to 10 ms */ | |
226 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
227 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
228 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
229 | ||
230 | /* set selection to trace start time */ | |
231 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
232 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME); | |
233 | ||
234 | /* select first CPU resource */ | |
235 | KEYBOARD.pressShortcut(Keystrokes.HOME); | |
236 | KEYBOARD.pressShortcut(Keystrokes.DOWN); | |
237 | ||
238 | /* click "Select Next Event" 2 times */ | |
239 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
240 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME1, CPU0_TIME1), CPU0_TIME1); | |
241 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
242 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2); | |
243 | ||
244 | /* click "Add Bookmark..." and fill Add Bookmark dialog */ | |
245 | fViewBot.toolbarButton(ADD_BOOKMARK).click(); | |
246 | SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot(); | |
247 | dialogBot.text().setText("B1"); | |
248 | dialogBot.button(OK).click(); | |
249 | ||
250 | /* click "Select Next Event" 2 times and shift-click "Select Next Event*/ | |
251 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
252 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME3, CPU0_TIME3), CPU0_TIME3); | |
253 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
254 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4); | |
255 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
256 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5); | |
257 | ||
258 | /* click "Add Bookmark..." and fill Add Bookmark dialog */ | |
259 | fViewBot.toolbarButton(ADD_BOOKMARK).click(); | |
260 | dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot(); | |
261 | dialogBot.text().setText("B2"); | |
262 | dialogBot.button(OK).click(); | |
263 | ||
264 | /* click "Previous Marker" */ | |
265 | fViewBot.toolbarButton(PREVIOUS_MARKER).click(); | |
266 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2); | |
267 | ||
268 | /* click "Remove Bookmark" */ | |
269 | fViewBot.toolbarButton(REMOVE_BOOKMARK).click(); | |
270 | ||
271 | /* click "Next Marker" */ | |
272 | fViewBot.toolbarButton(NEXT_MARKER).click(); | |
273 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5); | |
274 | ||
275 | /* click "Remove Bookmark" */ | |
276 | fViewBot.toolbarButton(REMOVE_BOOKMARK).click(); | |
277 | ||
278 | /* click "Previous Marker" */ | |
279 | fViewBot.toolbarButton(PREVIOUS_MARKER).click(); | |
280 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5); | |
281 | ||
282 | /* click "Select Previous Event" */ | |
283 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
284 | timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4); | |
285 | } | |
286 | ||
9cb4e90c PT |
287 | /** |
288 | * Test the marker axis | |
289 | */ | |
290 | @Test | |
291 | public void testMarkerAxis() { | |
292 | /* center window range of first lost event range */ | |
293 | ITmfTimestamp startTime = LOST_EVENT_TIME1.normalize(-10000000L, ITmfTimestamp.NANOSECOND_SCALE); | |
294 | ITmfTimestamp endTime = LOST_EVENT_END1.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE); | |
295 | TmfTimeRange range = new TmfTimeRange(startTime, endTime); | |
296 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
297 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
298 | ||
299 | /* set selection to window start time */ | |
300 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, startTime)); | |
301 | timeGraphIsReadyCondition(new TmfTimeRange(startTime, startTime), startTime); | |
302 | ||
303 | /* get marker axis size with one category */ | |
304 | final TimeGraphMarkerAxis markerAxis = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphMarkerAxis.class)); | |
305 | final Point size1 = getSize(markerAxis); | |
306 | ||
307 | /* add bookmark at window start time */ | |
308 | fViewBot.toolbarButton(ADD_BOOKMARK).click(); | |
309 | SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot(); | |
310 | dialogBot.text().setText("B"); | |
311 | dialogBot.button(OK).click(); | |
312 | ||
313 | /* get marker axis size with two categories */ | |
314 | final Point size2 = getSize(markerAxis); | |
315 | final int rowHeight = size2.y - size1.y; | |
316 | ||
317 | /* get the state area bounds, since we don't know the name space width */ | |
318 | final TimeGraphControl timeGraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
319 | int x0 = getXForTime(timeGraph, startTime.toNanos()); | |
320 | int x1 = getXForTime(timeGraph, endTime.toNanos()); | |
321 | ||
322 | /* click at the center of the marker axis width and first row height, it should be within the lost event range */ | |
323 | final SWTBotCanvas markerAxisCanvas = new SWTBotCanvas(markerAxis); | |
324 | markerAxisCanvas.click((x0 + x1) / 2, TOP_MARGIN + rowHeight / 2); | |
325 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1))); | |
326 | ||
327 | /* click near the left of the marker axis width and center of second row height, it should be on the bookmark label */ | |
328 | markerAxisCanvas.click(x0 + 2, TOP_MARGIN + rowHeight + rowHeight / 2); | |
329 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(startTime, startTime))); | |
330 | ||
331 | /* click "Remove Bookmark" */ | |
332 | fViewBot.toolbarButton(REMOVE_BOOKMARK).click(); | |
333 | assertEquals(size1, getSize(markerAxis)); | |
334 | ||
335 | /* click the 'expanded' icon to collapse */ | |
336 | markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2); | |
337 | assertEquals(TOGGLE_SIZE.y, getSize(markerAxis).y); | |
338 | ||
339 | /* click the 'collapsed' icon to expand */ | |
340 | markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2); | |
341 | assertEquals(size1, getSize(markerAxis)); | |
342 | ||
343 | /* click on the 'X' icon to hide the 'Lost Events' marker category */ | |
344 | markerAxisCanvas.click(TOGGLE_SIZE.x + HIDE_SIZE.x / 2, TOP_MARGIN + HIDE_SIZE.y / 2); | |
345 | assertEquals(0, getSize(markerAxis).y); | |
346 | ||
347 | /* show Lost Events markers */ | |
348 | fViewBot.viewMenu(LOST_EVENTS).click(); | |
349 | assertEquals(size1, getSize(markerAxis)); | |
350 | } | |
351 | ||
f2a4ccd3 PT |
352 | private void timeGraphIsReadyCondition(@NonNull TmfTimeRange selectionRange, @NonNull ITmfTimestamp visibleTime) { |
353 | IWorkbenchPart part = fViewBot.getViewReference().getPart(false); | |
354 | fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, selectionRange, visibleTime)); | |
355 | } | |
9cb4e90c PT |
356 | |
357 | private static int getXForTime(TimeGraphControl timeGraph, long time) { | |
358 | return UIThreadRunnable.syncExec(new Result<Integer>() { | |
359 | @Override | |
360 | public Integer run() { | |
361 | return timeGraph.getXForTime(time); | |
362 | } | |
363 | }); | |
364 | } | |
365 | ||
366 | private static Point getSize(Control control) { | |
367 | return UIThreadRunnable.syncExec(new Result<Point>() { | |
368 | @Override | |
369 | public Point run() { | |
370 | return control.getSize(); | |
371 | } | |
372 | }); | |
373 | } | |
f2a4ccd3 | 374 | } |