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.controlflow; |
6e512b93 | 12 | |
dfaf8391 FC |
13 | import java.util.Vector; |
14 | ||
15 | import org.eclipse.jface.action.Action; | |
16 | import org.eclipse.jface.action.IMenuListener; | |
17 | import org.eclipse.jface.action.IMenuManager; | |
18 | import org.eclipse.jface.action.IToolBarManager; | |
19 | import org.eclipse.jface.action.MenuManager; | |
20 | import org.eclipse.jface.action.Separator; | |
21 | import org.eclipse.jface.dialogs.MessageDialog; | |
22 | import org.eclipse.jface.viewers.DoubleClickEvent; | |
23 | import org.eclipse.jface.viewers.IDoubleClickListener; | |
24 | import org.eclipse.jface.viewers.ISelection; | |
25 | import org.eclipse.jface.viewers.ISelectionChangedListener; | |
26 | import org.eclipse.jface.viewers.IStructuredContentProvider; | |
27 | import org.eclipse.jface.viewers.IStructuredSelection; | |
28 | import org.eclipse.jface.viewers.ITableLabelProvider; | |
29 | import org.eclipse.jface.viewers.LabelProvider; | |
30 | import org.eclipse.jface.viewers.SelectionChangedEvent; | |
31 | import org.eclipse.jface.viewers.StructuredViewer; | |
32 | import org.eclipse.jface.viewers.TableViewer; | |
33 | import org.eclipse.jface.viewers.Viewer; | |
34 | import org.eclipse.jface.viewers.ViewerFilter; | |
35 | import org.eclipse.linuxtools.lttng.event.LttngTimestamp; | |
8827c197 FC |
36 | import org.eclipse.linuxtools.lttng.request.ILttngSyntEventRequest; |
37 | import org.eclipse.linuxtools.lttng.state.evProcessor.ITransEventProcessor; | |
dfaf8391 | 38 | import org.eclipse.linuxtools.lttng.ui.TraceDebug; |
8827c197 | 39 | import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer; |
dfaf8391 FC |
40 | import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess; |
41 | import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeViewerProvider; | |
41dc35d0 | 42 | import org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView; |
dfaf8391 | 43 | import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater; |
8827c197 | 44 | import org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor.FlowEventToHandlerFactory; |
dfaf8391 | 45 | import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowModelFactory; |
8827c197 | 46 | import org.eclipse.linuxtools.tmf.event.TmfEvent; |
dfaf8391 | 47 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
8827c197 | 48 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; |
9b635e61 | 49 | import org.eclipse.linuxtools.tmf.request.ITmfDataRequest.ExecutionType; |
8827c197 FC |
50 | import org.eclipse.linuxtools.tmf.signal.TmfExperimentSelectedSignal; |
51 | import org.eclipse.linuxtools.tmf.signal.TmfRangeSynchSignal; | |
dfaf8391 | 52 | import org.eclipse.linuxtools.tmf.signal.TmfSignalHandler; |
dfaf8391 FC |
53 | import org.eclipse.linuxtools.tmf.signal.TmfTimeSynchSignal; |
54 | import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewerFactory; | |
dfaf8391 FC |
55 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeFilterSelectionListener; |
56 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeScaleSelectionListener; | |
57 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.ITmfTimeSelectionListener; | |
58 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeFilterSelectionEvent; | |
59 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent; | |
60 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent; | |
61 | import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry; | |
dfaf8391 FC |
62 | import org.eclipse.swt.SWT; |
63 | import org.eclipse.swt.custom.SashForm; | |
64 | import org.eclipse.swt.custom.ScrolledComposite; | |
dfaf8391 FC |
65 | import org.eclipse.swt.events.KeyEvent; |
66 | import org.eclipse.swt.events.KeyListener; | |
67 | import org.eclipse.swt.graphics.Image; | |
68 | import org.eclipse.swt.graphics.Point; | |
69 | import org.eclipse.swt.graphics.Rectangle; | |
6e512b93 | 70 | import org.eclipse.swt.widgets.Composite; |
dfaf8391 FC |
71 | import org.eclipse.swt.widgets.Display; |
72 | import org.eclipse.swt.widgets.Menu; | |
73 | import org.eclipse.swt.widgets.ScrollBar; | |
74 | import org.eclipse.swt.widgets.Table; | |
75 | import org.eclipse.swt.widgets.TableColumn; | |
76 | import org.eclipse.swt.widgets.TableItem; | |
77 | import org.eclipse.ui.IActionBars; | |
78 | import org.eclipse.ui.IWorkbenchActionConstants; | |
79 | import org.eclipse.ui.PlatformUI; | |
80 | import org.eclipse.ui.plugin.AbstractUIPlugin; | |
6e512b93 ASL |
81 | |
82 | /** | |
83 | * <b><u>ControlFlowView</u></b> | |
84 | */ | |
41dc35d0 FC |
85 | /** |
86 | * @author alvaro | |
87 | * | |
88 | */ | |
89 | public class ControlFlowView extends AbsTimeUpdateView implements | |
dfaf8391 | 90 | ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener, |
41dc35d0 | 91 | ITmfTimeFilterSelectionListener { |
6e512b93 | 92 | |
62d1696a | 93 | public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.controlflow"; |
41dc35d0 | 94 | |
dfaf8391 FC |
95 | // ======================================================================== |
96 | // Table data | |
97 | // ======================================================================== | |
98 | private final String PROCESS_COLUMN = "Process"; | |
99 | private final String BRAND_COLUMN = "Brand"; | |
100 | private final String PID_COLUMN = "PID"; | |
101 | private final String TGID_COLUMN = "TGID"; | |
102 | private final String PPID_COLUMN = "PPID"; | |
103 | private final String CPU_COLUMN = "CPU"; | |
104 | private final String BIRTH_SEC_COLUMN = "Birth sec"; | |
105 | private final String BIRTH_NSEC_COLUMN = "Birth nsec"; | |
106 | private final String TRACE = "TRACE"; | |
107 | ||
108 | private final String[] columnNames = new String[] { PROCESS_COLUMN, /* */ | |
109 | BRAND_COLUMN,/* */ | |
110 | PID_COLUMN,/* */ | |
111 | TGID_COLUMN,/* */ | |
112 | PPID_COLUMN,/* */ | |
113 | CPU_COLUMN, /* */ | |
114 | BIRTH_SEC_COLUMN,/* */ | |
115 | BIRTH_NSEC_COLUMN,/* */ | |
116 | TRACE /* */ | |
117 | }; | |
118 | ||
119 | // ======================================================================== | |
120 | // Data | |
121 | // ======================================================================== | |
dfaf8391 FC |
122 | private TableViewer tableViewer; |
123 | // private int totalNumItems = 0; | |
124 | // Actions | |
125 | private Action doubleClickAction; | |
126 | private Action resetScale; | |
127 | private Action nextEvent; | |
128 | private Action prevEvent; | |
129 | private Action nextTrace; | |
130 | private Action prevTrace; | |
131 | private Action showLegend; | |
132 | private Action filterTraces; | |
133 | private Action zoomIn; | |
134 | private Action zoomOut; | |
8827c197 | 135 | private Action zoomFilter; |
dfaf8391 | 136 | |
dfaf8391 FC |
137 | private ViewProcessFilter tableFilter = null; |
138 | private ScrolledComposite scrollFrame = null; | |
dfaf8391 FC |
139 | |
140 | // private static SimpleDateFormat stimeformat = new SimpleDateFormat( | |
141 | // "yy/MM/dd HH:mm:ss"); | |
142 | ||
143 | // private TraceModelImplFactory fact; | |
144 | ||
145 | // ======================================================================== | |
146 | // Methods | |
147 | // ======================================================================== | |
148 | /* | |
149 | * The content provider class is responsible for providing objects to the | |
150 | * view. It can wrap existing objects in adapters or simply return objects | |
151 | * as-is. These objects may be sensitive to the current input of the view, | |
152 | * or ignore it and always show the same content (like Task List, for | |
153 | * example). | |
154 | */ | |
155 | ||
156 | class ViewContentProvider implements | |
157 | /* ILazyContentProvider, */IStructuredContentProvider { | |
158 | private TableViewer cviewer = null; | |
159 | private ITmfTimeAnalysisEntry[] elements = null; | |
160 | ||
161 | public ViewContentProvider(TableViewer v) { | |
162 | cviewer = v; | |
163 | } | |
164 | ||
165 | public void inputChanged(Viewer v, Object oldInput, Object newInput) { | |
166 | this.elements = (ITmfTimeAnalysisEntry[]) newInput; | |
167 | if (elements != null) { | |
8827c197 | 168 | TraceDebug.debug("Total number of processes provided to Control Flow view: " + elements.length); |
dfaf8391 FC |
169 | } else { |
170 | TraceDebug.debug("New input = null"); | |
171 | } | |
172 | } | |
173 | ||
174 | public void dispose() { | |
175 | ||
176 | } | |
177 | ||
178 | // Needed with the use of virtual tables in order to initialize items | |
179 | // which were not initially visible. | |
180 | public void updateElement(int index) { | |
181 | cviewer.replace(elements[index], index); | |
182 | } | |
183 | ||
184 | // @Override | |
185 | public Object[] getElements(Object inputElement) { | |
dfaf8391 FC |
186 | return elements; |
187 | } | |
188 | } | |
189 | ||
190 | class ViewLabelProvider extends LabelProvider implements | |
191 | ITableLabelProvider { | |
192 | public String getColumnText(Object obj, int index) { | |
193 | String strRes = ""; //$NON-NLS-1$ | |
194 | LttngTimestamp time; | |
195 | if (obj instanceof TimeRangeEventProcess) { | |
196 | TimeRangeEventProcess process = (TimeRangeEventProcess) obj; | |
197 | switch (index) { | |
198 | case 0: | |
199 | strRes = process.getName(); | |
200 | break; | |
201 | case 1: | |
202 | strRes = process.getBrand(); | |
203 | break; | |
204 | case 2: | |
205 | strRes = process.getPid().toString(); | |
206 | break; | |
207 | case 3: | |
208 | strRes = process.getTgid().toString(); | |
209 | break; | |
210 | case 4: | |
211 | strRes = process.getPpid().toString(); | |
212 | break; | |
213 | case 5: | |
214 | strRes = process.getCpu().toString(); | |
215 | break; | |
216 | case 6: | |
217 | time = new LttngTimestamp(process.getCreationTime() | |
218 | .longValue()); | |
219 | strRes = time.getSeconds(); | |
220 | break; | |
221 | case 7: | |
222 | time = new LttngTimestamp(process.getCreationTime() | |
223 | .longValue()); | |
224 | strRes = time.getNanoSeconds(); | |
225 | break; | |
226 | case 8: | |
227 | strRes = process.getTraceID(); | |
228 | break; | |
229 | default: | |
230 | break; | |
231 | } | |
232 | } else { | |
233 | return getText(obj); | |
234 | } | |
235 | ||
236 | return strRes; | |
237 | } | |
238 | ||
239 | public Image getColumnImage(Object obj, int index) { | |
240 | return getImage(obj); | |
241 | } | |
242 | ||
243 | @Override | |
244 | public Image getImage(Object obj) { | |
245 | // No image needed for the time being | |
246 | // return PlatformUI.getWorkbench().getSharedImages().getImage( | |
247 | // ISharedImages.IMG_OBJ_ELEMENT); | |
248 | return null; | |
249 | } | |
250 | } | |
251 | ||
252 | class ViewProcessFilter extends ViewerFilter { | |
253 | ||
254 | private Vector<ITmfTimeAnalysisEntry> filteredSet = new Vector<ITmfTimeAnalysisEntry>(); | |
255 | StructuredViewer viewer; | |
256 | ||
257 | public ViewProcessFilter(StructuredViewer rviewer) { | |
258 | this.viewer = rviewer; | |
259 | } | |
260 | ||
261 | public void setFilter(Vector<ITmfTimeAnalysisEntry> filtered) { | |
262 | if (filtered != null) { | |
263 | this.filteredSet = filtered; | |
264 | viewer.refresh(); | |
265 | } | |
266 | } | |
267 | ||
268 | @Override | |
269 | public boolean select(Viewer viewer, Object parentElement, | |
270 | Object element) { | |
271 | boolean filteredIn = true; | |
272 | if (element instanceof ITmfTimeAnalysisEntry) { | |
273 | ITmfTimeAnalysisEntry process = (ITmfTimeAnalysisEntry) element; | |
274 | if (filteredSet.contains(process)) { | |
275 | // The element is marked to be filtered out | |
276 | return false; | |
277 | } | |
278 | } else { | |
279 | TraceDebug.debug("Unexpected type of filter element received: " | |
280 | + element.toString()); | |
281 | } | |
282 | // Compare element versus a list of filtered out | |
283 | return filteredIn; | |
284 | } | |
285 | } | |
286 | ||
6e512b93 | 287 | /** |
dfaf8391 | 288 | * The constructor. |
6e512b93 ASL |
289 | */ |
290 | public ControlFlowView() { | |
41dc35d0 | 291 | super(ID); |
6e512b93 ASL |
292 | } |
293 | ||
dfaf8391 FC |
294 | /** |
295 | * This is a callback that will allow us to create the viewer and initialize | |
296 | * it. | |
6e512b93 | 297 | */ |
8827c197 FC |
298 | /* |
299 | * (non-Javadoc) | |
300 | * | |
301 | * @see | |
302 | * org.eclipse.linuxtools.tmf.ui.views.TmfView#createPartControl(org.eclipse | |
303 | * .swt.widgets.Composite) | |
304 | */ | |
6e512b93 ASL |
305 | @Override |
306 | public void createPartControl(Composite parent) { | |
dfaf8391 | 307 | |
8827c197 FC |
308 | scrollFrame = new ScrolledComposite(parent, SWT.V_SCROLL); |
309 | ||
dfaf8391 FC |
310 | scrollFrame.setExpandVertical(true); |
311 | scrollFrame.setExpandHorizontal(true); | |
dfaf8391 | 312 | scrollFrame.setAlwaysShowScrollBars(true); |
8827c197 FC |
313 | |
314 | SashForm sash = new SashForm(scrollFrame, SWT.NONE); | |
315 | scrollFrame.setContent(sash); | |
316 | ||
317 | tableViewer = new TableViewer(sash, SWT.FULL_SELECTION | SWT.H_SCROLL); | |
dfaf8391 FC |
318 | tableViewer.setContentProvider(new ViewContentProvider(tableViewer)); |
319 | tableViewer.setLabelProvider(new ViewLabelProvider()); | |
320 | Table table = tableViewer.getTable(); | |
8827c197 FC |
321 | tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
322 | public void selectionChanged(SelectionChangedEvent event) { | |
323 | ISelection sel = event.getSelection(); | |
324 | if (!sel.isEmpty()) { | |
325 | Object firstSel = null; | |
326 | if (sel instanceof IStructuredSelection) { | |
327 | firstSel = ((IStructuredSelection) sel).getFirstElement(); | |
328 | ||
329 | // Make sure the selection is visible | |
330 | updateScrollOrigin(); | |
331 | ||
332 | if (firstSel instanceof ITmfTimeAnalysisEntry) { | |
333 | ITmfTimeAnalysisEntry trace = (ITmfTimeAnalysisEntry) firstSel; | |
334 | tsfviewer.setSelectedTrace(trace); | |
dfaf8391 FC |
335 | } |
336 | } | |
8827c197 FC |
337 | } |
338 | } | |
dfaf8391 | 339 | |
8827c197 FC |
340 | /** |
341 | * Make sure the selected item is visible | |
342 | */ | |
343 | private void updateScrollOrigin() { | |
344 | Table table = tableViewer.getTable(); | |
345 | if (table != null && table.getItemCount() > 0) { | |
346 | TableItem item = table.getSelection()[0]; | |
347 | if (item == null) { | |
348 | // no selected reference to go up or down | |
349 | return; | |
350 | } | |
dfaf8391 | 351 | |
8827c197 FC |
352 | Rectangle itemRect = item.getBounds(); |
353 | int step = itemRect.height; | |
dfaf8391 | 354 | |
8827c197 FC |
355 | // calculate height of horizontal bar |
356 | int hscrolly = 0; | |
357 | ScrollBar hbar = scrollFrame.getHorizontalBar(); | |
358 | if (hbar != null) { | |
359 | hscrolly = hbar.getSize().y; | |
360 | } | |
dfaf8391 | 361 | |
8827c197 | 362 | int visibleHeight = scrollFrame.getSize().y - hscrolly; |
dfaf8391 | 363 | |
8827c197 FC |
364 | // the current scrollbar offset to adjust i.e. start |
365 | // of | |
366 | // the visible window | |
367 | Point origin = scrollFrame.getOrigin(); | |
368 | // end of visible window | |
369 | int endy = origin.y + visibleHeight; | |
dfaf8391 | 370 | |
8827c197 FC |
371 | int itemStartPos = itemRect.y + table.getHeaderHeight() + table.getBorderWidth() |
372 | + table.getParent().getBorderWidth(); | |
dfaf8391 | 373 | |
8827c197 FC |
374 | // Item End Position |
375 | int itemEndPos = itemStartPos + step; | |
dfaf8391 | 376 | |
8827c197 FC |
377 | // check if need to go up |
378 | if (origin.y >= step && itemStartPos < origin.y) { | |
379 | // one step up | |
380 | scrollFrame.setOrigin(origin.x, origin.y - step); | |
8035003b | 381 | |
8827c197 | 382 | } |
dfaf8391 FC |
383 | |
384 | // check if it needs to go down | |
8827c197 FC |
385 | if (itemEndPos > endy) { |
386 | // one step down | |
387 | scrollFrame.setOrigin(origin.x, origin.y + step); | |
dfaf8391 FC |
388 | |
389 | } | |
8827c197 FC |
390 | } |
391 | } | |
392 | }); | |
393 | ||
dfaf8391 FC |
394 | // Listen to page up /down and Home / Enc keys |
395 | tableViewer.getTable().addKeyListener(new KeyListener() { | |
396 | public void keyPressed(KeyEvent e) { | |
397 | Table table = tableViewer.getTable(); | |
398 | Point origin = scrollFrame.getOrigin(); | |
399 | if (table == null || table.getItemCount() < 1) { | |
400 | // nothing to page | |
401 | return; | |
402 | } | |
403 | ||
404 | TableItem item; | |
405 | int count; | |
406 | ||
407 | switch (e.keyCode) { | |
408 | case SWT.PAGE_DOWN: | |
409 | updateScrollPageDown(); | |
410 | break; | |
411 | case SWT.PAGE_UP: | |
412 | updateScrollUp(); | |
413 | break; | |
414 | case SWT.HOME: | |
415 | // Home | |
416 | count = table.getItemCount(); | |
417 | item = table.getItem(0); | |
418 | // Go to the top | |
419 | scrollFrame.setOrigin(origin.x, 0); | |
420 | break; | |
421 | case SWT.END: | |
422 | // End Selected | |
423 | count = table.getItemCount(); | |
424 | item = table.getItem(count - 1); | |
425 | int itemStartPos = item.getBounds().y; | |
426 | // Get to the bottom | |
427 | scrollFrame.setOrigin(origin.x, itemStartPos); | |
428 | break; | |
429 | default: | |
430 | break; | |
431 | } | |
432 | } | |
433 | ||
434 | public void keyReleased(KeyEvent e) { | |
435 | // Nothing to do | |
436 | ||
437 | } | |
438 | ||
439 | /** | |
440 | * Scroll one page down | |
441 | */ | |
442 | private void updateScrollPageDown() { | |
443 | // null protection before calling private method | |
444 | Table table = tableViewer.getTable(); | |
445 | int step = table.getItemHeight(); | |
446 | ||
447 | int hscrolly = 0; | |
448 | ScrollBar hbar = scrollFrame.getHorizontalBar(); | |
449 | if (hbar != null) { | |
450 | hscrolly = hbar.getSize().y; | |
451 | } | |
452 | ||
453 | Point origin = scrollFrame.getOrigin(); | |
454 | int visibleHeight = scrollFrame.getSize().y - hscrolly; | |
455 | int endy = origin.y + visibleHeight; | |
456 | ||
457 | scrollFrame.setOrigin(origin.x, endy - step); | |
458 | } | |
459 | ||
460 | /** | |
461 | * Scroll one page up | |
462 | */ | |
463 | private void updateScrollUp() { | |
464 | // null protection before calling private method | |
465 | Table table = tableViewer.getTable(); | |
466 | int step = table.getItemHeight(); | |
467 | ||
468 | int hscrolly = 0; | |
469 | ScrollBar hbar = scrollFrame.getHorizontalBar(); | |
470 | if (hbar != null) { | |
471 | hscrolly = hbar.getSize().y; | |
472 | } | |
473 | ||
474 | Point origin = scrollFrame.getOrigin(); | |
475 | int visibleHeight = scrollFrame.getSize().y - hscrolly; | |
476 | int pageUpPos = origin.y - visibleHeight + step; | |
477 | pageUpPos = pageUpPos > 0 ? pageUpPos : 0; | |
478 | scrollFrame.setOrigin(origin.x, pageUpPos); | |
479 | } | |
480 | ||
481 | }); | |
482 | // Describe table | |
483 | applyTableLayout(table); | |
484 | ||
485 | int borderWidth = table.getBorderWidth(); | |
486 | ||
8827c197 | 487 | int itemHeight = table.getItemHeight() + checkForSWTBugItemHeightAdjustement(); |
dfaf8391 FC |
488 | int headerHeight = table.getHeaderHeight(); |
489 | table.getVerticalBar().setVisible(false); | |
490 | ||
491 | tsfviewer = TmfViewerFactory.createViewer(sash, | |
a72a38d9 | 492 | new TimeRangeViewerProvider(getParamsUpdater())); |
dfaf8391 FC |
493 | |
494 | tsfviewer.addWidgetSelectionListner(this); | |
495 | tsfviewer.addWidgetTimeScaleSelectionListner(this); | |
496 | ||
41dc35d0 | 497 | // Traces shall not be grouped to allow synchronisation |
dfaf8391 | 498 | tsfviewer.groupTraces(false); |
8827c197 | 499 | tsfviewer.setItemHeight(itemHeight); |
dfaf8391 FC |
500 | tsfviewer.setBorderWidth(borderWidth); |
501 | tsfviewer.setHeaderHeight(headerHeight); | |
502 | tsfviewer.setVisibleVerticalScroll(false); | |
503 | // Names provided by the table | |
504 | tsfviewer.setNameWidthPref(0); | |
505 | tsfviewer.setAcceptSelectionAPIcalls(true); | |
506 | ||
507 | // Viewer to notify selection to this class | |
41dc35d0 | 508 | // This class will synchronise selections with table. |
dfaf8391 FC |
509 | tsfviewer.addWidgetSelectionListner(this); |
510 | tsfviewer.addFilterSelectionListner(this); | |
511 | tsfviewer.addWidgetTimeScaleSelectionListner(this); | |
512 | ||
513 | sash.setWeights(new int[] { 1, 1 }); | |
514 | // Create the help context id for the viewer's control | |
515 | // TODO: Associate with help system | |
516 | PlatformUI.getWorkbench().getHelpSystem().setHelp( | |
517 | tableViewer.getControl(), | |
518 | "org.eclipse.linuxtools.lttnng.ui.views.flow.viewer"); //$NON-NLS-1$ | |
519 | ||
520 | makeActions(); | |
521 | hookContextMenu(); | |
522 | hookDoubleClickAction(); | |
523 | contributeToActionBars(); | |
524 | ||
8827c197 FC |
525 | // scrollFrame.addControlListener(new ControlAdapter() { |
526 | // | |
527 | // @Override | |
528 | // public void controlResized(ControlEvent e) { | |
529 | // tsfviewer.resizeControls(); | |
530 | // updateScrolls(scrollFrame); | |
531 | // } | |
532 | // }); | |
dfaf8391 FC |
533 | |
534 | // set the initial view parameter values | |
535 | // Experiment start and end time | |
536 | // as well as time space width in pixels, used by the time analysis | |
537 | // widget | |
dfaf8391 FC |
538 | // Read relevant values |
539 | int timeSpaceWidth = tsfviewer.getTimeSpace(); | |
8827c197 FC |
540 | if (timeSpaceWidth < 0) { |
541 | timeSpaceWidth = -timeSpaceWidth; | |
dfaf8391 FC |
542 | } |
543 | ||
8827c197 FC |
544 | TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment(); |
545 | if (experiment != null) { | |
546 | TmfTimeRange experimentTRange = experiment.getTimeRange(); | |
547 | ||
548 | // send request and received the adjusted time used | |
549 | TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this, | |
550 | experimentTRange); | |
551 | ||
552 | // initialize widget time boundaries and filtering parameters | |
553 | ModelUpdateInit(experimentTRange, adjustedTimeRange, this); | |
554 | } else { | |
555 | TraceDebug.debug("No selected experiment information available"); | |
556 | } | |
6e512b93 ASL |
557 | } |
558 | ||
dfaf8391 FC |
559 | private void hookContextMenu() { |
560 | MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ | |
561 | menuMgr.setRemoveAllWhenShown(true); | |
562 | menuMgr.addMenuListener(new IMenuListener() { | |
563 | public void menuAboutToShow(IMenuManager manager) { | |
564 | ControlFlowView.this.fillContextMenu(manager); | |
565 | } | |
566 | }); | |
567 | Menu menu = menuMgr.createContextMenu(tableViewer.getControl()); | |
568 | tableViewer.getControl().setMenu(menu); | |
569 | getSite().registerContextMenu(menuMgr, tableViewer); | |
570 | } | |
571 | ||
572 | private void contributeToActionBars() { | |
573 | IActionBars bars = getViewSite().getActionBars(); | |
574 | fillLocalPullDown(bars.getMenuManager()); | |
575 | fillLocalToolBar(bars.getToolBarManager()); | |
576 | } | |
577 | ||
578 | private void fillLocalPullDown(IMenuManager manager) { | |
579 | manager.add(new Separator()); | |
580 | // manager.add(showLegend); | |
581 | manager.add(new Separator()); | |
582 | manager.add(resetScale); | |
583 | manager.add(nextEvent); | |
584 | manager.add(prevEvent); | |
585 | manager.add(nextTrace); | |
586 | manager.add(prevTrace); | |
587 | // manager.add(filterTraces); | |
588 | manager.add(zoomIn); | |
589 | manager.add(zoomOut); | |
8827c197 | 590 | manager.add(zoomFilter); |
dfaf8391 FC |
591 | manager.add(new Separator()); |
592 | } | |
593 | ||
594 | private void fillContextMenu(IMenuManager manager) { | |
595 | // manager.add(showLegend); | |
596 | manager.add(new Separator()); | |
597 | manager.add(resetScale); | |
598 | manager.add(nextEvent); | |
599 | manager.add(prevEvent); | |
600 | manager.add(nextTrace); | |
601 | manager.add(prevTrace); | |
602 | // manager.add(showLegend); | |
603 | // manager.add(filterTraces); | |
604 | manager.add(zoomIn); | |
605 | manager.add(zoomOut); | |
8827c197 | 606 | manager.add(zoomFilter); |
dfaf8391 FC |
607 | manager.add(new Separator()); |
608 | manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); | |
609 | } | |
610 | ||
611 | private void fillLocalToolBar(IToolBarManager manager) { | |
612 | // manager.add(showLegend); | |
613 | manager.add(new Separator()); | |
614 | manager.add(resetScale); | |
615 | manager.add(nextEvent); | |
616 | manager.add(prevEvent); | |
617 | manager.add(nextTrace); | |
618 | manager.add(prevTrace); | |
619 | // manager.add(filterTraces); | |
620 | manager.add(zoomIn); | |
621 | manager.add(zoomOut); | |
8827c197 | 622 | manager.add(zoomFilter); |
dfaf8391 FC |
623 | manager.add(new Separator()); |
624 | } | |
625 | ||
626 | private void makeActions() { | |
f1eb6a6b | 627 | // resetScale |
dfaf8391 FC |
628 | resetScale = new Action() { |
629 | @Override | |
630 | public void run() { | |
631 | if (tsfviewer != null) { | |
632 | tsfviewer.resetStartFinishTime(); | |
633 | } | |
634 | ||
635 | } | |
636 | }; | |
637 | resetScale.setText(Messages.getString("ControlFlowView.Action.Reset")); //$NON-NLS-1$ | |
638 | resetScale.setToolTipText(Messages | |
639 | .getString("ControlFlowView.Action.Reset.ToolTip")); //$NON-NLS-1$ | |
640 | resetScale.setImageDescriptor(AbstractUIPlugin | |
641 | .imageDescriptorFromPlugin(Messages | |
642 | .getString("ControlFlowView.tmf.UI"), | |
643 | "icons/home_nav.gif")); | |
644 | ||
f1eb6a6b | 645 | // nextEvent |
dfaf8391 FC |
646 | nextEvent = new Action() { |
647 | @Override | |
648 | public void run() { | |
649 | if (tsfviewer != null) { | |
650 | tsfviewer.selectNextEvent(); | |
651 | } | |
652 | } | |
653 | }; | |
654 | nextEvent.setText(Messages | |
655 | .getString("ControlFlowView.Action.NextEvent")); //$NON-NLS-1$ | |
656 | nextEvent.setToolTipText(Messages | |
657 | .getString("ControlFlowView.Action.NextEvent.Tooltip")); //$NON-NLS-1$ | |
658 | nextEvent.setImageDescriptor(AbstractUIPlugin | |
659 | .imageDescriptorFromPlugin(Messages | |
660 | .getString("ControlFlowView.tmf.UI"), | |
661 | "icons/next_event.gif")); | |
662 | ||
f1eb6a6b | 663 | // prevEvent |
dfaf8391 | 664 | prevEvent = new Action() { |
41dc35d0 FC |
665 | @Override |
666 | public void run() { | |
dfaf8391 FC |
667 | if (tsfviewer != null) { |
668 | tsfviewer.selectPrevEvent(); | |
669 | } | |
670 | } | |
671 | }; | |
672 | prevEvent.setText(Messages | |
673 | .getString("ControlFlowView.Action.PrevEvent")); //$NON-NLS-1$ | |
674 | prevEvent.setToolTipText(Messages | |
675 | .getString("ControlFlowView.Action.PrevEvent.Tooltip")); //$NON-NLS-1$ | |
676 | prevEvent.setImageDescriptor(AbstractUIPlugin | |
677 | .imageDescriptorFromPlugin(Messages | |
678 | .getString("ControlFlowView.tmf.UI"), | |
679 | "icons/prev_event.gif")); | |
680 | ||
f1eb6a6b | 681 | // nextTrace |
dfaf8391 FC |
682 | nextTrace = new Action() { |
683 | @Override | |
684 | public void run() { | |
685 | if (tsfviewer != null) { | |
686 | tsfviewer.selectNextTrace(); | |
687 | } | |
688 | } | |
689 | }; | |
690 | nextTrace.setText(Messages | |
691 | .getString("ControlFlowView.Action.NextProcess")); //$NON-NLS-1$ | |
692 | nextTrace.setToolTipText(Messages | |
693 | .getString("ControlFlowView.Action.NextProcess.ToolTip")); //$NON-NLS-1$ | |
694 | nextTrace.setImageDescriptor(AbstractUIPlugin | |
695 | .imageDescriptorFromPlugin(Messages | |
696 | .getString("ControlFlowView.tmf.UI"), | |
697 | "icons/next_item.gif")); | |
698 | ||
f1eb6a6b | 699 | // prevTrace |
dfaf8391 FC |
700 | prevTrace = new Action() { |
701 | @Override | |
702 | public void run() { | |
703 | if (tsfviewer != null) { | |
704 | tsfviewer.selectPrevTrace(); | |
705 | } | |
706 | } | |
707 | }; | |
708 | prevTrace.setText(Messages | |
709 | .getString("ControlFlowView.Action.PreviousProcess")); //$NON-NLS-1$ | |
710 | prevTrace.setToolTipText(Messages | |
711 | .getString("ControlFlowView.Action.PreviousProcess.Tooltip")); //$NON-NLS-1$ | |
712 | prevTrace.setImageDescriptor(AbstractUIPlugin | |
713 | .imageDescriptorFromPlugin(Messages | |
714 | .getString("ControlFlowView.tmf.UI"), | |
715 | "icons/prev_item.gif")); | |
716 | ||
f1eb6a6b | 717 | // showLegend |
dfaf8391 FC |
718 | showLegend = new Action() { |
719 | @Override | |
720 | public void run() { | |
721 | if (tsfviewer != null) { | |
722 | tsfviewer.showLegend(); | |
723 | } | |
724 | } | |
725 | }; | |
726 | showLegend.setText(Messages.getString("ControlFlowView.Action.Legend")); //$NON-NLS-1$ | |
727 | showLegend.setToolTipText(Messages | |
728 | .getString("ControlFlowView.Action.Legend.ToolTip")); //$NON-NLS-1$ | |
729 | ||
f1eb6a6b | 730 | // filterTraces |
dfaf8391 FC |
731 | filterTraces = new Action() { |
732 | @Override | |
733 | public void run() { | |
734 | if (tsfviewer != null) { | |
735 | tsfviewer.filterTraces(); | |
736 | } | |
737 | } | |
738 | }; | |
739 | filterTraces.setText(Messages | |
740 | .getString("ControlFlowView.Action.Filter")); //$NON-NLS-1$ | |
741 | filterTraces.setToolTipText(Messages | |
742 | .getString("ControlFlowView.Action.Filter.ToolTip")); //$NON-NLS-1$ | |
743 | filterTraces.setImageDescriptor(AbstractUIPlugin | |
744 | .imageDescriptorFromPlugin(Messages | |
745 | .getString("ControlFlowView.tmf.UI"), | |
746 | "icons/filter_items.gif")); | |
747 | ||
f1eb6a6b | 748 | // zoomIn |
dfaf8391 FC |
749 | zoomIn = new Action() { |
750 | @Override | |
751 | public void run() { | |
752 | if (tsfviewer != null) { | |
753 | tsfviewer.zoomIn(); | |
754 | } | |
755 | } | |
756 | }; | |
757 | zoomIn.setText(Messages.getString("ControlFlowView.Action.ZoomIn")); //$NON-NLS-1$ | |
758 | zoomIn.setToolTipText(Messages | |
759 | .getString("ControlFlowView.Action.ZoomIn.Tooltip")); //$NON-NLS-1$ | |
760 | zoomIn.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( | |
761 | Messages.getString("ControlFlowView.tmf.UI"), | |
762 | "icons/zoomin_nav.gif")); | |
763 | ||
f1eb6a6b | 764 | // zoomOut |
dfaf8391 FC |
765 | zoomOut = new Action() { |
766 | @Override | |
767 | public void run() { | |
768 | if (tsfviewer != null) { | |
769 | tsfviewer.zoomOut(); | |
770 | } | |
771 | } | |
772 | }; | |
773 | zoomOut.setText(Messages.getString("ControlFlowView.Action.ZoomOut")); //$NON-NLS-1$ | |
774 | zoomOut.setToolTipText(Messages | |
775 | .getString("ControlFlowView.Action.ZoomOut.tooltip")); //$NON-NLS-1$ | |
776 | zoomOut.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( | |
777 | Messages.getString("ControlFlowView.tmf.UI"), | |
778 | "icons/zoomout_nav.gif")); | |
8827c197 FC |
779 | |
780 | // zoomFilter | |
781 | zoomFilter = new Action() { | |
dfaf8391 FC |
782 | @Override |
783 | public void run() { | |
8827c197 FC |
784 | // Nothing to do, however the selection status is needed by the |
785 | // application | |
dfaf8391 FC |
786 | } |
787 | }; | |
8827c197 FC |
788 | zoomFilter.setText(Messages |
789 | .getString("ControlFlowView.Action.ZoomFilter")); //$NON-NLS-1$ | |
790 | zoomFilter.setToolTipText(Messages | |
791 | .getString("ControlFlowView.Action.ZoomFilter.tooltip")); //$NON-NLS-1$ | |
792 | zoomFilter.setImageDescriptor(AbstractUIPlugin | |
793 | .imageDescriptorFromPlugin(Messages | |
794 | .getString("ControlFlowView.tmf.UI"), | |
795 | "icons/filter_items.gif")); | |
796 | zoomFilter.setChecked(false); | |
797 | ||
dfaf8391 FC |
798 | // PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_SYNCED); |
799 | ||
800 | doubleClickAction = new Action() { | |
801 | @Override | |
802 | public void run() { | |
803 | ISelection selection = tableViewer.getSelection(); | |
804 | Object obj = ((IStructuredSelection) selection) | |
805 | .getFirstElement(); | |
806 | showMessage("Double-click detected on " + obj.toString()); //$NON-NLS-1$ | |
807 | } | |
808 | }; | |
809 | } | |
810 | ||
811 | private void hookDoubleClickAction() { | |
812 | tableViewer.addDoubleClickListener(new IDoubleClickListener() { | |
813 | public void doubleClick(DoubleClickEvent event) { | |
814 | doubleClickAction.run(); | |
815 | } | |
816 | }); | |
817 | } | |
818 | ||
819 | private void showMessage(String message) { | |
820 | MessageDialog.openInformation(tableViewer.getControl().getShell(), | |
821 | Messages.getString("ControlFlowView.msgSlogan"), message); //$NON-NLS-1$ | |
822 | } | |
823 | ||
824 | /** | |
825 | * Passing the focus request to the viewer's control. | |
6e512b93 ASL |
826 | */ |
827 | @Override | |
828 | public void setFocus() { | |
dfaf8391 FC |
829 | tableViewer.getControl().setFocus(); |
830 | } | |
831 | ||
8827c197 FC |
832 | /* |
833 | * (non-Javadoc) | |
834 | * | |
835 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
836 | * tsfTmProcessSelEvent | |
837 | * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeSelectionEvent | |
838 | * ) | |
839 | */ | |
550d787e | 840 | @Override |
dfaf8391 | 841 | public void tsfTmProcessSelEvent(TmfTimeSelectionEvent event) { |
8827c197 FC |
842 | // common implementation |
843 | super.tsfTmProcessSelEvent(event); | |
dfaf8391 FC |
844 | |
845 | // Reselect the table viewer to widget selection | |
846 | ISelection sel = tsfviewer.getSelectionTrace(); | |
847 | if (sel != null && !sel.isEmpty()) { | |
848 | tableViewer.setSelection(sel); | |
849 | } | |
dfaf8391 FC |
850 | } |
851 | ||
8827c197 FC |
852 | /* |
853 | * (non-Javadoc) | |
dfaf8391 | 854 | * |
8827c197 FC |
855 | * @see org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis. |
856 | * ITmfTimeScaleSelectionListener | |
857 | * #tsfTmProcessTimeScaleEvent(org.eclipse.linuxtools | |
858 | * .tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent) | |
dfaf8391 | 859 | */ |
550d787e | 860 | @Override |
8827c197 FC |
861 | public synchronized void tsfTmProcessTimeScaleEvent(TmfTimeScaleSelectionEvent event) { |
862 | super.tsfTmProcessTimeScaleEvent(event); | |
dfaf8391 | 863 | } |
8035003b | 864 | |
dfaf8391 FC |
865 | private void applyTableLayout(Table table) { |
866 | for (int i = 0; i < columnNames.length; i++) { | |
867 | TableColumn tableColumn = new TableColumn(table, SWT.LEFT); | |
868 | tableColumn.setText(columnNames[i]); | |
869 | tableColumn.pack(); | |
870 | } | |
871 | table.setHeaderVisible(true); | |
872 | table.setLinesVisible(true); | |
873 | } | |
874 | ||
8827c197 FC |
875 | /* |
876 | * (non-Javadoc) | |
877 | * | |
878 | * @see | |
879 | * org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView#displayModel | |
880 | * (org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model. | |
881 | * ITmfTimeAnalysisEntry[], long, long, boolean, long, long, | |
882 | * java.lang.Object) | |
d712a5f3 | 883 | */ |
550d787e | 884 | @Override |
8827c197 FC |
885 | public void displayModel(final ITmfTimeAnalysisEntry[] items, |
886 | final long startBoundTime, final long endBoundTime, | |
887 | final boolean updateTimeBounds, final long startVisibleWindow, | |
888 | final long endVisibleWindow, final Object source) { | |
3e9fdb8b FC |
889 | |
890 | if(tableViewer != null) { | |
891 | final Table table = tableViewer.getTable(); | |
892 | Display display = table.getDisplay(); | |
893 | ||
894 | // Perform the updates on the UI thread) | |
895 | display.asyncExec(new Runnable() { | |
896 | public void run() { | |
897 | ||
898 | tableViewer.setInput(items); // This shall be the minimal | |
899 | // initial | |
900 | tableFilter = new ViewProcessFilter(tableViewer); | |
901 | tableViewer.setFilters(new ViewerFilter[] { tableFilter }); | |
902 | ||
903 | resizeTableColumns(table); | |
904 | table.update(); | |
905 | tableViewer.refresh(); | |
906 | ||
907 | tsfviewer.display(items, startBoundTime, endBoundTime, | |
908 | updateTimeBounds); | |
909 | ||
910 | // validate visible boundaries | |
911 | if (startVisibleWindow > -1 && endVisibleWindow > -1) { | |
912 | tsfviewer.setSelectVisTimeWindow(startVisibleWindow, | |
913 | endVisibleWindow, source); | |
914 | } | |
915 | ||
916 | tsfviewer.resizeControls(); | |
917 | ||
918 | // Adjust the size of the vertical scroll bar to fit the | |
919 | // contents | |
920 | if (scrollFrame != null) { | |
921 | updateScrolls(scrollFrame); | |
922 | } | |
dfaf8391 | 923 | } |
3e9fdb8b FC |
924 | }); |
925 | } | |
dfaf8391 FC |
926 | } |
927 | ||
928 | @Override | |
929 | public void dispose() { | |
930 | // dispose parent resources | |
931 | super.dispose(); | |
dfaf8391 | 932 | |
dfaf8391 FC |
933 | tsfviewer.removeFilterSelectionListner(this); |
934 | tsfviewer.removeWidgetSelectionListner(this); | |
935 | tsfviewer.removeWidgetTimeScaleSelectionListner(this); | |
936 | tableViewer = null; | |
937 | tsfviewer = null; | |
938 | } | |
939 | ||
940 | /** | |
941 | * @param tableComposite | |
942 | * @param table | |
943 | */ | |
944 | private synchronized void resizeTableColumns(Table table) { | |
945 | if (table != null) { | |
946 | Composite parent = table.getParent(); | |
947 | int tableWidthSum = parent.getBorderWidth(); | |
948 | ||
949 | TableColumn[] columns = table.getColumns(); | |
950 | for (TableColumn column : columns) { | |
951 | column.pack(); | |
952 | tableWidthSum += column.getWidth(); | |
953 | } | |
954 | } | |
955 | } | |
956 | ||
957 | // @Override | |
958 | public void tmfTaProcessFilterSelection(TmfTimeFilterSelectionEvent event) { | |
959 | if (tableFilter != null) { | |
960 | Vector<ITmfTimeAnalysisEntry> filteredout = event.getFilteredOut(); | |
961 | if (filteredout != null) { | |
962 | tableFilter.setFilter(filteredout); | |
963 | } else { | |
964 | tableFilter.setFilter(new Vector<ITmfTimeAnalysisEntry>()); | |
965 | } | |
966 | tableViewer.refresh(); | |
967 | } | |
968 | } | |
969 | ||
dfaf8391 FC |
970 | /** |
971 | * @param scrollFrame | |
972 | * @param wrapper | |
973 | */ | |
8827c197 FC |
974 | private void updateScrolls(final ScrolledComposite scrollFrame) { |
975 | scrollFrame.setMinSize(tableViewer.getTable().computeSize(SWT.DEFAULT, SWT.DEFAULT)); | |
dfaf8391 FC |
976 | } |
977 | ||
978 | /** | |
8827c197 | 979 | * Registers as listener of time selection from other views |
dfaf8391 | 980 | * |
8827c197 | 981 | * @param signal |
dfaf8391 | 982 | */ |
550d787e | 983 | @Override |
8827c197 FC |
984 | @TmfSignalHandler |
985 | public void synchToTime(TmfTimeSynchSignal signal) { | |
986 | super.synchToTime(signal); | |
dfaf8391 FC |
987 | } |
988 | ||
989 | /** | |
8827c197 FC |
990 | * Annotation Registers as listener of time range selection from other views |
991 | * The implementation handles the entry of the signal. | |
dfaf8391 FC |
992 | * |
993 | * @param signal | |
994 | */ | |
995 | @TmfSignalHandler | |
8827c197 FC |
996 | public void synchToTimeRange(TmfRangeSynchSignal signal) { |
997 | if (zoomFilter != null) { | |
998 | synchToTimeRange(signal, zoomFilter.isChecked()); | |
dfaf8391 | 999 | } |
6e512b93 ASL |
1000 | } |
1001 | ||
39332b5c | 1002 | @Override |
8827c197 FC |
1003 | public void modelIncomplete(ILttngSyntEventRequest request) { |
1004 | // Nothing to do | |
1005 | // The data will be refreshed on the next request | |
41dc35d0 FC |
1006 | } |
1007 | ||
1008 | /* | |
1009 | * (non-Javadoc) | |
1010 | * | |
8827c197 FC |
1011 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# |
1012 | * getEventProcessor() | |
41dc35d0 | 1013 | */ |
39332b5c | 1014 | @Override |
8827c197 FC |
1015 | public ITransEventProcessor getEventProcessor() { |
1016 | return FlowEventToHandlerFactory.getInstance(); | |
1017 | } | |
d712a5f3 | 1018 | |
8827c197 FC |
1019 | /** |
1020 | * @param signal | |
1021 | */ | |
1022 | @TmfSignalHandler | |
1023 | public void experimentSelected( | |
1024 | TmfExperimentSelectedSignal<? extends TmfEvent> signal) { | |
1025 | if (signal != null) { | |
1026 | TmfTimeRange experimentTRange = signal.getExperiment() | |
1027 | .getTimeRange(); | |
1028 | ||
1029 | // prepare time intervals in widget | |
1030 | ModelUpdateInit(experimentTRange, experimentTRange, signal | |
1031 | .getSource()); | |
1032 | ||
1033 | // request initial data | |
1034 | initialExperimentDataRequest(signal | |
1035 | .getSource(), experimentTRange); | |
d712a5f3 | 1036 | } |
41dc35d0 FC |
1037 | } |
1038 | ||
8827c197 FC |
1039 | /** |
1040 | * @param source | |
1041 | * @param experimentTRange | |
1042 | * @return Adjusted time window used for the request (smaller window to | |
1043 | * initialize view) | |
41dc35d0 | 1044 | */ |
8827c197 FC |
1045 | private TmfTimeRange initialExperimentDataRequest(Object source, |
1046 | TmfTimeRange experimentTRange) { | |
1047 | // Adjust the initial time window to a shorter interval to allow | |
1048 | // user to select the interesting area based on the perspective | |
1049 | TmfTimeRange initTimeWindow = getInitTRange(experimentTRange); | |
41dc35d0 | 1050 | |
f6b14ce2 | 1051 | dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND); |
41dc35d0 | 1052 | if (TraceDebug.isDEBUG()) { |
8827c197 FC |
1053 | TraceDebug.debug("Initialization request time range is: " |
1054 | + initTimeWindow.getStartTime().toString() + "-" | |
1055 | + initTimeWindow.getEndTime().toString()); | |
41dc35d0 | 1056 | } |
8827c197 FC |
1057 | |
1058 | return initTimeWindow; | |
41dc35d0 | 1059 | } |
542c8a2e WB |
1060 | |
1061 | // *** HACK *** | |
1062 | // | |
1063 | // | |
1064 | // | |
1065 | public int checkForSWTBugItemHeightAdjustement() { | |
1066 | int returnedAjustement = 0; | |
1067 | String desktopSessionName = System.getenv("DESKTOP_SESSION"); | |
1068 | ||
1069 | // Gnome : most common case, no adjustement | |
1070 | if ( desktopSessionName.equals("gnome") ) { | |
1071 | returnedAjustement = 0; | |
1072 | } | |
1073 | // Kde : ajustement of 2 is needed | |
1074 | else if ( desktopSessionName.equals("kde") ) { | |
1075 | returnedAjustement = 2; | |
1076 | } | |
1077 | ||
1078 | return returnedAjustement; | |
1079 | } | |
542c8a2e | 1080 | |
8827c197 FC |
1081 | /* |
1082 | * (non-Javadoc) | |
1083 | * | |
1084 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
1085 | * getParamsUpdater() | |
1086 | */ | |
1087 | @Override | |
1088 | protected ParamsUpdater getParamsUpdater() { | |
1089 | return FlowModelFactory.getParamsUpdater(); | |
1090 | } | |
1091 | ||
1092 | /* | |
1093 | * (non-Javadoc) | |
1094 | * | |
1095 | * @see org.eclipse.linuxtools.lttng.ui.views.common.AbsTimeUpdateView# | |
1096 | * getItemContainer() | |
1097 | */ | |
1098 | @Override | |
1099 | protected ItemContainer<?> getItemContainer() { | |
1100 | return FlowModelFactory.getProcContainer(); | |
1101 | } | |
1102 | } |