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