Commit | Line | Data |
---|---|---|
6e512b93 | 1 | /******************************************************************************* |
8827c197 | 2 | * Copyright (c) 2009, 2010 Ericsson |
6e512b93 | 3 | * |
dfaf8391 FC |
4 | * All rights reserved. This program and the accompanying materials are made |
5 | * available under the terms of the Eclipse Public License v1.0 which | |
6e512b93 ASL |
6 | * accompanies this distribution, and is available at |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
dfaf8391 | 9 | * Contributors: Alvaro Sanchez-Leon - Initial implementation |
6e512b93 | 10 | *******************************************************************************/ |
8b29a712 | 11 | package org.eclipse.linuxtools.lttng.ui.views.resources; |
8035003b | 12 | |
dfaf8391 FC |
13 | import org.eclipse.jface.action.Action; |
14 | import org.eclipse.jface.action.IMenuListener; | |
15 | import org.eclipse.jface.action.IMenuManager; | |
16 | import org.eclipse.jface.action.IToolBarManager; | |
17 | import org.eclipse.jface.action.MenuManager; | |
18 | import org.eclipse.jface.action.Separator; | |
8827c197 FC |
19 | import org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest; |
20 | import org.eclipse.linuxtools.lttng.state.evProcessor.ITransEventProcessor; | |
dfaf8391 | 21 | import org.eclipse.linuxtools.lttng.ui.TraceDebug; |
8827c197 | 22 | import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer; |
dfaf8391 | 23 | import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeViewerProvider; |
41dc35d0 | 24 | import org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView; |
dfaf8391 | 25 | import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater; |
8827c197 | 26 | import org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor.ResourcesEventToHandlerFactory; |
dfaf8391 | 27 | import org.eclipse.linuxtools.lttng.ui.views.resources.model.ResourceModelFactory; |
8827c197 | 28 | import org.eclipse.linuxtools.tmf.event.TmfEvent; |
dfaf8391 | 29 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
8827c197 | 30 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; |
9b635e61 | 31 | import org.eclipse.linuxtools.tmf.request.ITmfDataRequest.ExecutionType; |
8827c197 FC |
32 | import org.eclipse.linuxtools.tmf.signal.TmfExperimentSelectedSignal; |
33 | import org.eclipse.linuxtools.tmf.signal.TmfRangeSynchSignal; | |
dfaf8391 | 34 | import org.eclipse.linuxtools.tmf.signal.TmfSignalHandler; |
dfaf8391 FC |
35 | import org.eclipse.linuxtools.tmf.signal.TmfTimeSynchSignal; |
36 | import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewerFactory; | |
dfaf8391 FC |
37 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeScaleSelectionListener; |
38 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeSelectionListener; | |
39 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent; | |
40 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent; | |
41 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry; | |
dfaf8391 FC |
42 | import org.eclipse.swt.SWT; |
43 | import org.eclipse.swt.layout.FillLayout; | |
6e512b93 | 44 | import org.eclipse.swt.widgets.Composite; |
dfaf8391 FC |
45 | import org.eclipse.swt.widgets.Display; |
46 | import org.eclipse.swt.widgets.Menu; | |
47 | import org.eclipse.ui.IActionBars; | |
48 | import org.eclipse.ui.IWorkbenchActionConstants; | |
49 | import org.eclipse.ui.PlatformUI; | |
50 | import org.eclipse.ui.plugin.AbstractUIPlugin; | |
6e512b93 ASL |
51 | |
52 | /** | |
dfaf8391 FC |
53 | * @author alvaro |
54 | * | |
6e512b93 | 55 | */ |
41dc35d0 FC |
56 | public class ResourcesView extends AbsTimeUpdateView implements |
57 | ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener { | |
dfaf8391 FC |
58 | |
59 | // ======================================================================== | |
60 | // Data | |
61 | // ======================================================================== | |
62 | public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.resources"; | |
dfaf8391 FC |
63 | |
64 | // private int totalNumItems = 0; | |
65 | // Actions | |
66 | private Action resetScale; | |
67 | private Action nextEvent; | |
68 | private Action prevEvent; | |
69 | private Action nextTrace; | |
70 | private Action prevTrace; | |
71 | private Action showLegend; | |
72 | private Action filterTraces; | |
73 | private Action zoomIn; | |
74 | private Action zoomOut; | |
8827c197 | 75 | private Action zoomFilter; |
dfaf8391 FC |
76 | private Composite top; |
77 | ||
78 | // private static SimpleDateFormat stimeformat = new SimpleDateFormat( | |
79 | // "yy/MM/dd HH:mm:ss"); | |
6e512b93 | 80 | |
dfaf8391 FC |
81 | // private TraceModelImplFactory fact; |
82 | ||
83 | // ======================================================================== | |
41dc35d0 | 84 | // Constructor |
dfaf8391 | 85 | // ======================================================================== |
6e512b93 ASL |
86 | |
87 | /** | |
dfaf8391 | 88 | * The constructor. |
6e512b93 ASL |
89 | */ |
90 | public ResourcesView() { | |
41dc35d0 | 91 | super(ID); |
6e512b93 ASL |
92 | } |
93 | ||
41dc35d0 FC |
94 | // ======================================================================== |
95 | // Methods | |
96 | // ======================================================================== | |
97 | ||
dfaf8391 FC |
98 | /** |
99 | * This is a callback that will allow us to create the viewer and initialize | |
100 | * it. | |
6e512b93 ASL |
101 | */ |
102 | @Override | |
103 | public void createPartControl(Composite parent) { | |
dfaf8391 FC |
104 | top = new Composite(parent, SWT.BORDER); |
105 | ||
106 | top.setLayout(new FillLayout()); | |
a72a38d9 | 107 | tsfviewer = TmfViewerFactory.createViewer(top, new TimeRangeViewerProvider(getParamsUpdater())); |
dfaf8391 FC |
108 | |
109 | tsfviewer.addWidgetSelectionListner(this); | |
110 | tsfviewer.addWidgetTimeScaleSelectionListner(this); | |
111 | ||
41dc35d0 | 112 | // Traces shall not be grouped to allow synchronisation |
dfaf8391 FC |
113 | tsfviewer.groupTraces(true); |
114 | tsfviewer.setAcceptSelectionAPIcalls(true); | |
115 | ||
116 | // Viewer to notify selection to this class | |
41dc35d0 | 117 | // This class will synchronise selections with table. |
0c2a2e08 FC |
118 | // tsfviewer.addWidgetSelectionListner(this); |
119 | // tsfviewer.addWidgetTimeScaleSelectionListner(this); | |
dfaf8391 FC |
120 | |
121 | // Create the help context id for the viewer's control | |
122 | // TODO: Associate with help system | |
123 | PlatformUI.getWorkbench().getHelpSystem().setHelp( | |
124 | tsfviewer.getControl(), | |
125 | "org.eclipse.linuxtools.lttng.ui.views.resource.view"); //$NON-NLS-1$ | |
126 | ||
127 | makeActions(); | |
128 | hookContextMenu(); | |
129 | contributeToActionBars(); | |
130 | ||
0c2a2e08 FC |
131 | // // Read relevant values |
132 | // int timeSpaceWidth = tsfviewer.getTimeSpace(); | |
133 | // if (timeSpaceWidth < 0) { | |
134 | // timeSpaceWidth = -timeSpaceWidth; | |
135 | // } | |
dfaf8391 | 136 | |
8827c197 FC |
137 | TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment(); |
138 | if (experiment != null) { | |
139 | TmfTimeRange experimentTRange = experiment.getTimeRange(); | |
140 | if (experimentTRange != null) { | |
141 | long time0 = experimentTRange.getStartTime().getValue(); | |
142 | long time1 = experimentTRange.getEndTime().getValue(); | |
143 | ParamsUpdater paramUpdater = getParamsUpdater(); | |
0c2a2e08 | 144 | paramUpdater.update(time0, time1); // , timeSpaceWidth); |
8827c197 FC |
145 | } |
146 | // send the initial request and obtained the adjusted time used | |
147 | TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this, experimentTRange); | |
148 | ||
149 | // initialize widget time boundaries and filtering parameters | |
150 | ModelUpdateInit(experimentTRange, adjustedTimeRange, this); | |
151 | } else { | |
152 | TraceDebug.debug("No selected experiment information available"); | |
153 | } | |
dfaf8391 FC |
154 | } |
155 | ||
156 | private void hookContextMenu() { | |
157 | MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ | |
158 | menuMgr.setRemoveAllWhenShown(true); | |
159 | menuMgr.addMenuListener(new IMenuListener() { | |
d4011df2 | 160 | @Override |
dfaf8391 FC |
161 | public void menuAboutToShow(IMenuManager manager) { |
162 | ResourcesView.this.fillContextMenu(manager); | |
163 | } | |
164 | }); | |
165 | ||
166 | Menu menu = menuMgr.createContextMenu(tsfviewer.getControl()); | |
167 | tsfviewer.getControl().setMenu(menu); | |
168 | getSite() | |
169 | .registerContextMenu(menuMgr, tsfviewer.getSelectionProvider()); | |
170 | } | |
171 | ||
172 | private void contributeToActionBars() { | |
173 | IActionBars bars = getViewSite().getActionBars(); | |
174 | fillLocalPullDown(bars.getMenuManager()); | |
175 | fillLocalToolBar(bars.getToolBarManager()); | |
176 | } | |
177 | ||
178 | private void fillLocalPullDown(IMenuManager manager) { | |
179 | manager.add(new Separator()); | |
180 | // manager.add(showLegend); | |
181 | manager.add(new Separator()); | |
182 | manager.add(resetScale); | |
183 | manager.add(nextEvent); | |
184 | manager.add(prevEvent); | |
185 | manager.add(nextTrace); | |
186 | manager.add(prevTrace); | |
187 | // manager.add(filterTraces); | |
188 | manager.add(zoomIn); | |
189 | manager.add(zoomOut); | |
8827c197 | 190 | manager.add(zoomFilter); |
dfaf8391 FC |
191 | manager.add(new Separator()); |
192 | } | |
6e512b93 | 193 | |
dfaf8391 FC |
194 | private void fillContextMenu(IMenuManager manager) { |
195 | // manager.add(showLegend); | |
196 | manager.add(new Separator()); | |
197 | manager.add(resetScale); | |
198 | manager.add(nextEvent); | |
199 | manager.add(prevEvent); | |
200 | manager.add(nextTrace); | |
201 | manager.add(prevTrace); | |
202 | // manager.add(showLegend); | |
203 | // manager.add(filterTraces); | |
204 | manager.add(zoomIn); | |
205 | manager.add(zoomOut); | |
8827c197 | 206 | manager.add(zoomFilter); |
dfaf8391 FC |
207 | manager.add(new Separator()); |
208 | manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); | |
6e512b93 ASL |
209 | } |
210 | ||
dfaf8391 FC |
211 | private void fillLocalToolBar(IToolBarManager manager) { |
212 | // manager.add(showLegend); | |
213 | manager.add(new Separator()); | |
214 | manager.add(resetScale); | |
215 | manager.add(nextEvent); | |
216 | manager.add(prevEvent); | |
217 | manager.add(nextTrace); | |
218 | manager.add(prevTrace); | |
219 | // manager.add(filterTraces); | |
220 | manager.add(zoomIn); | |
221 | manager.add(zoomOut); | |
8827c197 | 222 | manager.add(zoomFilter); |
dfaf8391 FC |
223 | manager.add(new Separator()); |
224 | } | |
225 | ||
226 | private void makeActions() { | |
227 | // action4 | |
228 | resetScale = new Action() { | |
229 | @Override | |
230 | public void run() { | |
231 | if (tsfviewer != null) { | |
232 | tsfviewer.resetStartFinishTime(); | |
233 | } | |
234 | ||
235 | } | |
236 | }; | |
237 | resetScale.setText(Messages.getString("ResourcesView.Action.Reset")); //$NON-NLS-1$ | |
238 | resetScale.setToolTipText(Messages | |
239 | .getString("ResourcesView.Action.Reset.ToolTip")); //$NON-NLS-1$ | |
240 | resetScale.setImageDescriptor(AbstractUIPlugin | |
241 | .imageDescriptorFromPlugin(Messages | |
242 | .getString("ResourcesView.tmf.UI"), | |
243 | "icons/home_nav.gif")); | |
244 | ||
245 | // action5 | |
246 | nextEvent = new Action() { | |
247 | @Override | |
248 | public void run() { | |
249 | if (tsfviewer != null) { | |
250 | tsfviewer.selectNextEvent(); | |
251 | } | |
252 | } | |
253 | }; | |
254 | nextEvent.setText(Messages.getString("ResourcesView.Action.NextEvent")); //$NON-NLS-1$ | |
255 | nextEvent.setToolTipText(Messages | |
256 | .getString("ResourcesView.Action.NextEvent.Tooltip")); //$NON-NLS-1$ | |
257 | nextEvent.setImageDescriptor(AbstractUIPlugin | |
258 | .imageDescriptorFromPlugin(Messages | |
259 | .getString("ResourcesView.tmf.UI"), | |
260 | "icons/next_event.gif")); | |
261 | ||
262 | // action6 | |
263 | prevEvent = new Action() { | |
264 | @Override | |
265 | public void run() { | |
266 | if (tsfviewer != null) { | |
267 | tsfviewer.selectPrevEvent(); | |
268 | } | |
269 | } | |
270 | }; | |
271 | prevEvent.setText(Messages.getString("ResourcesView.Action.PrevEvent")); //$NON-NLS-1$ | |
272 | prevEvent.setToolTipText(Messages | |
273 | .getString("ResourcesView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$ | |
274 | prevEvent.setImageDescriptor(AbstractUIPlugin | |
275 | .imageDescriptorFromPlugin(Messages | |
276 | .getString("ResourcesView.tmf.UI"), | |
277 | "icons/prev_event.gif")); | |
278 | ||
279 | // action7 | |
280 | nextTrace = new Action() { | |
281 | @Override | |
282 | public void run() { | |
283 | if (tsfviewer != null) { | |
284 | tsfviewer.selectNextTrace(); | |
285 | } | |
286 | } | |
287 | }; | |
288 | nextTrace.setText(Messages | |
289 | .getString("ResourcesView.Action.NextResource")); //$NON-NLS-1$ | |
290 | nextTrace.setToolTipText(Messages | |
291 | .getString("ResourcesView.Action.NextResource.ToolTip")); //$NON-NLS-1$ | |
292 | nextTrace.setImageDescriptor(AbstractUIPlugin | |
293 | .imageDescriptorFromPlugin(Messages | |
294 | .getString("ResourcesView.tmf.UI"), | |
295 | "icons/next_item.gif")); | |
296 | ||
297 | // action8 | |
298 | prevTrace = new Action() { | |
299 | @Override | |
300 | public void run() { | |
301 | if (tsfviewer != null) { | |
302 | tsfviewer.selectPrevTrace(); | |
303 | } | |
304 | } | |
305 | }; | |
306 | prevTrace.setText(Messages | |
307 | .getString("ResourcesView.Action.PreviousResource")); //$NON-NLS-1$ | |
308 | prevTrace.setToolTipText(Messages | |
309 | .getString("ResourcesView.Action.PreviousResource.Tooltip")); //$NON-NLS-1$ | |
310 | prevTrace.setImageDescriptor(AbstractUIPlugin | |
311 | .imageDescriptorFromPlugin(Messages | |
312 | .getString("ResourcesView.tmf.UI"), | |
313 | "icons/prev_item.gif")); | |
314 | ||
315 | // action9 | |
316 | showLegend = new Action() { | |
317 | @Override | |
318 | public void run() { | |
319 | if (tsfviewer != null) { | |
320 | tsfviewer.showLegend(); | |
321 | } | |
322 | } | |
323 | }; | |
324 | showLegend.setText(Messages.getString("ResourcesView.Action.Legend")); //$NON-NLS-1$ | |
325 | showLegend.setToolTipText(Messages | |
326 | .getString("ResourcesView.Action.Legend.ToolTip")); //$NON-NLS-1$ | |
327 | ||
328 | // action10 | |
329 | filterTraces = new Action() { | |
330 | @Override | |
331 | public void run() { | |
332 | if (tsfviewer != null) { | |
333 | tsfviewer.filterTraces(); | |
334 | } | |
335 | } | |
336 | }; | |
337 | filterTraces.setText(Messages.getString("ResourcesView.Action.Filter")); //$NON-NLS-1$ | |
338 | filterTraces.setToolTipText(Messages | |
339 | .getString("ResourcesView.Action.Filter.ToolTip")); //$NON-NLS-1$ | |
340 | filterTraces.setImageDescriptor(AbstractUIPlugin | |
341 | .imageDescriptorFromPlugin(Messages | |
342 | .getString("ResourcesView.tmf.UI"), | |
343 | "icons/filter_items.gif")); | |
344 | ||
345 | // action10 | |
346 | zoomIn = new Action() { | |
347 | @Override | |
348 | public void run() { | |
349 | if (tsfviewer != null) { | |
350 | tsfviewer.zoomIn(); | |
351 | } | |
352 | } | |
353 | }; | |
354 | zoomIn.setText(Messages.getString("ResourcesView.Action.ZoomIn")); //$NON-NLS-1$ | |
355 | zoomIn.setToolTipText(Messages | |
356 | .getString("ResourcesView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$ | |
357 | zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( | |
358 | Messages.getString("ResourcesView.tmf.UI"), | |
359 | "icons/zoomin_nav.gif")); | |
360 | ||
361 | // action10 | |
362 | zoomOut = new Action() { | |
363 | @Override | |
364 | public void run() { | |
365 | if (tsfviewer != null) { | |
366 | tsfviewer.zoomOut(); | |
367 | } | |
368 | } | |
369 | }; | |
370 | zoomOut.setText(Messages.getString("ResourcesView.Action.ZoomOut")); //$NON-NLS-1$ | |
371 | zoomOut.setToolTipText(Messages | |
372 | .getString("ResourcesView.Action.ZoomOut.tooltip")); //$NON-NLS-1$ | |
373 | zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( | |
374 | Messages.getString("ResourcesView.tmf.UI"), | |
375 | "icons/zoomout_nav.gif")); | |
376 | ||
8827c197 FC |
377 | // zoomFilter |
378 | zoomFilter = new Action() { | |
dfaf8391 FC |
379 | @Override |
380 | public void run() { | |
8827c197 FC |
381 | // Nothing to do, however the selection status is needed by the |
382 | // application | |
dfaf8391 FC |
383 | } |
384 | }; | |
8827c197 FC |
385 | |
386 | zoomFilter.setText(Messages.getString("ResourcesView.Action.ZoomFilter")); //$NON-NLS-1$ | |
387 | zoomFilter.setToolTipText(Messages.getString("ResourcesView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$ | |
388 | zoomFilter.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Messages | |
389 | .getString("ResourcesView.tmf.UI"), "icons/filter_items.gif")); | |
390 | zoomFilter.setChecked(false); | |
391 | ||
dfaf8391 FC |
392 | // PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED); |
393 | } | |
394 | ||
395 | /** | |
396 | * Passing the focus request to the viewer's control. | |
6e512b93 ASL |
397 | */ |
398 | @Override | |
399 | public void setFocus() { | |
dfaf8391 FC |
400 | tsfviewer.getControl().setFocus(); |
401 | } | |
402 | ||
8827c197 FC |
403 | /* |
404 | * (non-Javadoc) | |
405 | * | |
406 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
407 | * tsfTmProcessSelEvent | |
408 | * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent | |
409 | * ) | |
410 | */ | |
550d787e | 411 | @Override |
dfaf8391 | 412 | public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) { |
8827c197 FC |
413 | // common implementation |
414 | super.tsfTmProcessSelEvent(event); | |
dfaf8391 FC |
415 | } |
416 | ||
41dc35d0 FC |
417 | /* |
418 | * (non-Javadoc) | |
419 | * | |
420 | * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis. | |
421 | * ITmfTimeScaleSelectionListener | |
422 | * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools | |
423 | * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent) | |
424 | */ | |
550d787e | 425 | @Override |
dfaf8391 | 426 | public void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) { |
8827c197 | 427 | super.tsfTmProcessTimeScaleEvent(event); |
dfaf8391 FC |
428 | } |
429 | ||
8827c197 FC |
430 | /* |
431 | * (non-Javadoc) | |
dfaf8391 | 432 | * |
8827c197 FC |
433 | * @see |
434 | * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel | |
435 | * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model. | |
436 | * ITmfTimeAnalysisEntry[], long, long, boolean, long, long, | |
437 | * java.lang.Object) | |
dfaf8391 | 438 | */ |
550d787e | 439 | @Override |
8827c197 FC |
440 | public void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime, |
441 | final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow, | |
442 | final long endVisibleWindow, final Object source) { | |
db1ea19b FC |
443 | |
444 | // Return if disposed | |
445 | if ((tsfviewer == null) || (tsfviewer.getControl().isDisposed())) return; | |
446 | ||
8827c197 FC |
447 | Display display = tsfviewer.getControl().getDisplay(); |
448 | display.asyncExec(new Runnable() { | |
d4011df2 | 449 | @Override |
dfaf8391 | 450 | public void run() { |
db1ea19b FC |
451 | if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) { |
452 | tsfviewer.display(items, startBoundTime, endBoundTime, updateTimeBounds); | |
453 | // validate visible boundaries | |
454 | if (startVisibleWindow > -1 && endVisibleWindow > -1) { | |
455 | tsfviewer.setSelectVisTimeWindow(startVisibleWindow, endVisibleWindow, source); | |
456 | } | |
457 | tsfviewer.resizeControls(); | |
8827c197 | 458 | } |
dfaf8391 FC |
459 | } |
460 | }); | |
461 | } | |
462 | ||
463 | @Override | |
464 | public void dispose() { | |
465 | // dispose parent resources | |
466 | super.dispose(); | |
dfaf8391 FC |
467 | |
468 | tsfviewer.removeWidgetSelectionListner(this); | |
469 | tsfviewer.removeWidgetTimeScaleSelectionListner(this); | |
470 | tsfviewer = null; | |
471 | } | |
472 | ||
41dc35d0 | 473 | /** |
8827c197 | 474 | * Registers as listener of time selection from other tmf views |
dfaf8391 | 475 | * |
8827c197 | 476 | * @param signal |
dfaf8391 | 477 | */ |
550d787e | 478 | @Override |
8827c197 FC |
479 | @TmfSignalHandler |
480 | public void synchToTime(TmfTimeSynchSignal signal) { | |
481 | super.synchToTime(signal); | |
dfaf8391 FC |
482 | } |
483 | ||
484 | /** | |
8827c197 FC |
485 | * Annotation Registers as listener of time range selection from other views |
486 | * The implementation handles the entry of the signal. | |
41dc35d0 FC |
487 | * |
488 | * @param signal | |
dfaf8391 | 489 | */ |
41dc35d0 | 490 | @TmfSignalHandler |
8827c197 FC |
491 | public void synchToTimeRange(TmfRangeSynchSignal signal) { |
492 | if (zoomFilter != null) { | |
493 | synchToTimeRange(signal, zoomFilter.isChecked()); | |
dfaf8391 | 494 | } |
dfaf8391 FC |
495 | } |
496 | ||
39332b5c | 497 | @Override |
8827c197 FC |
498 | public void modelIncomplete(ILttngSyntEventRequest request) { |
499 | // Nothing to do | |
500 | // The data will be refreshed on the next request | |
41dc35d0 | 501 | } |
dfaf8391 | 502 | |
41dc35d0 FC |
503 | /* |
504 | * (non-Javadoc) | |
505 | * | |
8827c197 FC |
506 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# |
507 | * getEventProcessor() | |
41dc35d0 | 508 | */ |
39332b5c | 509 | @Override |
8827c197 FC |
510 | public ITransEventProcessor getEventProcessor() { |
511 | return ResourcesEventToHandlerFactory.getInstance(); | |
512 | } | |
513 | ||
514 | /** | |
515 | * @param signal | |
516 | */ | |
517 | @TmfSignalHandler | |
518 | public void experimentSelected(TmfExperimentSelectedSignal<? extends TmfEvent> signal) { | |
519 | if (signal != null) { | |
520 | TmfTimeRange experimentTRange = signal.getExperiment().getTimeRange(); | |
d712a5f3 | 521 | |
8827c197 FC |
522 | // prepare time intervals in widget |
523 | ModelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); | |
d712a5f3 | 524 | |
8827c197 FC |
525 | // request initial data |
526 | initialExperimentDataRequest(signal.getSource(), experimentTRange); | |
d712a5f3 | 527 | } |
41dc35d0 | 528 | } |
dfaf8391 | 529 | |
8827c197 FC |
530 | /** |
531 | * @param source | |
532 | * @param experimentTRange | |
533 | * @return Adjusted time window used for the request (smaller window to | |
534 | * initialize view) | |
41dc35d0 | 535 | */ |
8827c197 FC |
536 | private TmfTimeRange initialExperimentDataRequest(Object source, TmfTimeRange experimentTRange) { |
537 | // Adjust the initial time window to a shorter interval to allow | |
538 | // user to select the interesting area based on the perspective | |
539 | TmfTimeRange initTimeWindow = getInitTRange(experimentTRange); | |
dfaf8391 | 540 | |
f6b14ce2 | 541 | dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND); |
8827c197 FC |
542 | if (TraceDebug.isDEBUG()) { |
543 | TraceDebug.debug("Initialization request time range is: " + initTimeWindow.getStartTime().toString() + "-" | |
544 | + initTimeWindow.getEndTime().toString()); | |
dfaf8391 FC |
545 | } |
546 | ||
8827c197 FC |
547 | return initTimeWindow; |
548 | } | |
dfaf8391 | 549 | |
8827c197 FC |
550 | /* |
551 | * (non-Javadoc) | |
552 | * | |
553 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
554 | * getParamsUpdater() | |
555 | */ | |
550d787e | 556 | @Override |
8827c197 FC |
557 | protected ParamsUpdater getParamsUpdater() { |
558 | return ResourceModelFactory.getParamsUpdater(); | |
559 | } | |
dfaf8391 | 560 | |
8827c197 FC |
561 | /* |
562 | * (non-Javadoc) | |
563 | * | |
564 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
565 | * getItemContainer() | |
566 | */ | |
567 | @Override | |
568 | protected ItemContainer<?> getItemContainer() { | |
569 | return ResourceModelFactory.getResourceContainer(); | |
dfaf8391 | 570 | } |
dfaf8391 | 571 | } |