Fix a .gitignore that is too permissive
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / histogram / TimeRangeHistogram.java
1 /*******************************************************************************
2 * Copyright (c) 2011 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.ui.views.histogram;
14
15 import org.eclipse.swt.widgets.Composite;
16
17 /**
18 * <b><u>TimeRangeHistogram</u></b>
19 * <p>
20 * A basic histogram with the following additional features:
21 * <ul>
22 * <li>zoom in: mouse wheel up (or forward)
23 * <li>zoom out: mouse wheel down (or backward)
24 * </ul>
25 */
26 public class TimeRangeHistogram extends Histogram {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 HistogramZoom fZoom;
33
34 // ------------------------------------------------------------------------
35 // Constructor
36 // ------------------------------------------------------------------------
37
38 public TimeRangeHistogram(HistogramView view, Composite parent) {
39 super(view, parent);
40 fZoom = new HistogramZoom(this, fCanvas, getStartTime(), getTimeLimit());
41 }
42
43 // ------------------------------------------------------------------------
44 // Operations
45 // ------------------------------------------------------------------------
46
47 @Override
48 public void updateTimeRange(long startTime, long endTime) {
49 ((HistogramView) fParentView).updateTimeRange(startTime, endTime);
50 }
51
52 @Override
53 public synchronized void clear() {
54 if (fZoom != null)
55 fZoom.stop();
56 super.clear();
57 }
58
59 public synchronized void setTimeRange(long startTime, long duration) {
60 fZoom.setNewRange(startTime, duration);
61 }
62
63 public void setFullRange(long startTime, long endTime) {
64 long currentFirstEvent = getStartTime();
65 fZoom.setFullRange((currentFirstEvent == 0) ? startTime : currentFirstEvent, endTime);
66 }
67
68 }
This page took 0.032064 seconds and 5 git commands to generate.