Commit | Line | Data |
---|---|---|
c392540b | 1 | /******************************************************************************* |
e0752744 | 2 | * Copyright (c) 2011, 2012 Ericsson |
c392540b FC |
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 | |
e0752744 | 11 | * Francois Chouinard - Moved from LTTng to TMF |
c392540b FC |
12 | *******************************************************************************/ |
13 | ||
e0752744 | 14 | package org.eclipse.linuxtools.tmf.ui.views.histogram; |
c392540b FC |
15 | |
16 | import org.eclipse.swt.widgets.Composite; | |
17 | ||
18 | /** | |
c392540b | 19 | * This control provides a group containing a text control. |
b544077e BH |
20 | * |
21 | * @version 1.0 | |
22 | * @author Francois Chouinard | |
c392540b FC |
23 | */ |
24 | public class HistogramTimeRangeControl extends HistogramTextControl { | |
25 | ||
26 | // ------------------------------------------------------------------------ | |
27 | // Construction | |
28 | // ------------------------------------------------------------------------ | |
b544077e BH |
29 | /** |
30 | * Constructor default values | |
31 | * @param parentView The parent histogram view. | |
32 | * @param parent The parent composite | |
33 | * @param textStyle The text style bits. | |
34 | * @param groupStyle The group style bits. | |
35 | */ | |
c392540b FC |
36 | public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) { |
37 | this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$ | |
38 | } | |
39 | ||
b544077e BH |
40 | /** |
41 | * Constructor with given group and text values. | |
42 | * | |
43 | * @param parentView The parent histogram view. | |
44 | * @param parent The parent composite | |
45 | * @param textStyle The text style bits. | |
46 | * @param groupStyle The group style bits. | |
47 | * @param groupValue A group value | |
48 | * @param textValue A text value | |
49 | */ | |
c392540b FC |
50 | public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) { |
51 | super(parentView, parent, textStyle, groupStyle, groupValue, textValue); | |
52 | } | |
53 | ||
54 | // ------------------------------------------------------------------------ | |
55 | // Operations | |
56 | // ------------------------------------------------------------------------ | |
57 | ||
b544077e BH |
58 | /* |
59 | * (non-Javadoc) | |
60 | * @see org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramTextControl#updateValue() | |
61 | */ | |
c392540b FC |
62 | @Override |
63 | protected void updateValue() { | |
64 | String stringValue = fTextValue.getText(); | |
65 | long value = HistogramUtils.stringToNanoseconds(stringValue); | |
66 | ||
67 | if (getValue() != value) { | |
68 | fParentView.updateTimeRange(value); | |
69 | } | |
70 | } | |
71 | ||
72 | } |