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