1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.provisional
.tmf
.ui
.views
.timegraph2
.swt
;
12 import org
.eclipse
.jdt
.annotation
.Nullable
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.tracecompass
.internal
.provisional
.tmf
.core
.views
.timegraph2
.ITimeGraphModelRenderProvider
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.tmf
.ui
.views
.timegraph2
.TimeGraphModelView
;
17 import org
.eclipse
.tracecompass
.tmf
.ui
.signal
.TmfTimeViewAlignmentInfo
;
18 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.ITmfTimeAligned
;
19 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.TimeGraphViewer
;
25 public abstract class SwtTimeGraphView
extends TimeGraphModelView
implements ITmfTimeAligned
{
27 private @Nullable TimeGraphViewer fTimeGraphViewer
;
29 protected SwtTimeGraphView(String viewName
, ITimeGraphModelRenderProvider modelRenderProvider
) {
30 super(viewName
, modelRenderProvider
);
34 public void createPartControl(@Nullable Composite parent
) {
38 TimeGraphViewer viewer
= new TimeGraphViewer(parent
, SWT
.NONE
);
39 // viewer.setTimeGraphContentProvider(new SwtTimeGraphContentProvider());
40 // viewer.setTimeGraphProvider(new SwtTimeGraphPresentationProvider());
42 fTimeGraphViewer
= viewer
;
46 public void setFocus() {
49 // ------------------------------------------------------------------------
51 // ------------------------------------------------------------------------
54 public @Nullable TmfTimeViewAlignmentInfo
getTimeViewAlignmentInfo() {
55 if (fTimeGraphViewer
!= null) {
56 return fTimeGraphViewer
.getTimeViewAlignmentInfo();
62 public int getAvailableWidth(int requestedOffset
) {
63 if (fTimeGraphViewer
!= null) {
64 return fTimeGraphViewer
.getAvailableWidth(requestedOffset
);
70 public void performAlign(int offset
, int width
) {
71 if (fTimeGraphViewer
!= null) {
72 fTimeGraphViewer
.performAlign(offset
, width
);