analysis: Clean-up latency statistics
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.ui / src / org / eclipse / tracecompass / internal / analysis / os / linux / ui / views / latency / LatencyTableViewer.java
1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * France Lapointe Nguyen - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency;
14
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.eclipse.jface.action.Action;
17 import org.eclipse.jface.action.IAction;
18 import org.eclipse.jface.action.IMenuManager;
19 import org.eclipse.jface.action.Separator;
20 import org.eclipse.jface.viewers.IStructuredSelection;
21 import org.eclipse.jface.viewers.TableViewer;
22 import org.eclipse.tracecompass.analysis.os.linux.core.latency.LatencyAnalysis;
23 import org.eclipse.tracecompass.analysis.timing.core.segmentstore.AbstractSegmentStoreAnalysisModule;
24 import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.AbstractSegmentStoreTableViewer;
25 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.statistics.LatencyStatisticsView;
26 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
27 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
28 import org.eclipse.ui.IWorkbench;
29 import org.eclipse.ui.IWorkbenchPage;
30 import org.eclipse.ui.PartInitException;
31 import org.eclipse.ui.PlatformUI;
32
33 /**
34 * Displays the latency analysis data in a column table
35 *
36 * @author France Lapointe Nguyen
37 */
38 public class LatencyTableViewer extends AbstractSegmentStoreTableViewer {
39
40 // ------------------------------------------------------------------------
41 // Constructor
42 // ------------------------------------------------------------------------
43
44 /**
45 * Constructor
46 *
47 * @param tableViewer
48 * The table viewer
49 */
50 public LatencyTableViewer(TableViewer tableViewer) {
51 super(tableViewer);
52 }
53
54 // ------------------------------------------------------------------------
55 // Operations
56 // ------------------------------------------------------------------------
57
58 @Override
59 protected @Nullable AbstractSegmentStoreAnalysisModule getSegmentStoreAnalysisModule(ITmfTrace trace) {
60 return TmfTraceUtils.getAnalysisModuleOfClass(trace, LatencyAnalysis.class, LatencyAnalysis.ID);
61 }
62
63 @Override
64 protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) {
65 super.appendToTablePopupMenu(manager, sel);
66 manager.add(new Separator());
67 IAction showStatisticsAction = new Action(Messages.LatencyTable_ShowStatisticsActionName) {
68 @Override
69 public void run() {
70 final IWorkbench wb = PlatformUI.getWorkbench();
71 final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
72 try {
73 activePage.showView(LatencyStatisticsView.ID);
74 } catch (PartInitException e) {
75 }
76 }
77 };
78
79 manager.add(showStatisticsAction);
80 }
81 }
This page took 0.031964 seconds and 5 git commands to generate.