1 /*******************************************************************************
2 * Copyright (c) 2009, 2012 Ericsson
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
10 * Alvaro Sanchez-Leon - Initial API and implementation
11 * Patrick Tasse - Refactoring
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
;
18 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
19 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
20 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
21 import org
.eclipse
.swt
.graphics
.GC
;
22 import org
.eclipse
.swt
.graphics
.Image
;
23 import org
.eclipse
.swt
.graphics
.Rectangle
;
26 * Provider class for the time graph provider
29 * @author Patrick Tasse
32 public class TimeGraphPresentationProvider
implements ITimeGraphPresentationProvider
{
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
37 private static final int DEFAULT_ITEM_HEIGHT
= 19;
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
45 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTypeName()
48 public String
getStateTypeName() {
49 return Messages
.TmfTimeLegend_TRACE_STATES
;
53 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTypeName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
57 public String
getStateTypeName(ITimeGraphEntry entry
) {
62 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getStateTable()
65 public StateItem
[] getStateTable() {
71 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventTableIndex(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
74 public int getStateTableIndex(ITimeEvent event
) {
80 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#postDrawControl(org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
83 public void postDrawControl(Rectangle bounds
, GC gc
) {
84 // Override to add own drawing code
89 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#postDrawEntry(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry, org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
92 public void postDrawEntry(ITimeGraphEntry entry
, Rectangle bounds
, GC gc
) {
93 // Override to add own drawing code
98 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#postDrawEvent(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent, org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.GC)
101 public void postDrawEvent(ITimeEvent event
, Rectangle bounds
, GC gc
) {
102 // Override to add own drawing code
107 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getItemHeight(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
110 public int getItemHeight(ITimeGraphEntry entry
) {
111 return DEFAULT_ITEM_HEIGHT
;
116 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getItemImage(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)
119 public Image
getItemImage(ITimeGraphEntry entry
) {
125 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventName(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
128 public String
getEventName(ITimeEvent event
) {
134 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent)
137 public Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
) {
142 * @see org.eclipse.linuxtools.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider#getEventHoverToolTipInfo(org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent, long)
148 public Map
<String
, String
> getEventHoverToolTipInfo(ITimeEvent event
, long hoverTime
) {
149 return getEventHoverToolTipInfo(event
);