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 HistogramCurrentTimeControl extends HistogramTextControl { | |
25 | ||
26 | // ------------------------------------------------------------------------ | |
27 | // Construction | |
28 | // ------------------------------------------------------------------------ | |
29 | ||
b544077e BH |
30 | /** |
31 | * Constructor with default group and text value. | |
32 | * | |
33 | * @param parentView A parent histogram view | |
34 | * @param parent A parent composite to draw in | |
35 | * @param textStyle A test style | |
36 | * @param groupStyle A group style | |
37 | */ | |
c392540b FC |
38 | public HistogramCurrentTimeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) { |
39 | this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$ | |
40 | } | |
41 | ||
b544077e BH |
42 | /** |
43 | * | |
44 | * Constructor | |
45 | * @param parentView A parent histogram view | |
46 | * @param parent A parent composite to draw in | |
47 | * @param textStyle A test style | |
48 | * @param groupStyle A group style | |
49 | * @param groupValue A group value | |
50 | * @param textValue A text value | |
51 | */ | |
c392540b FC |
52 | public HistogramCurrentTimeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) { |
53 | super(parentView, parent, textStyle, groupStyle, groupValue, textValue); | |
54 | } | |
55 | ||
56 | // ------------------------------------------------------------------------ | |
57 | // Operations | |
58 | // ------------------------------------------------------------------------ | |
59 | ||
60 | @Override | |
61 | protected void updateValue() { | |
62 | String stringValue = fTextValue.getText(); | |
63 | long value = HistogramUtils.stringToNanoseconds(stringValue); | |
64 | ||
65 | if (getValue() != value) { | |
66 | setValue(value); | |
67 | fParentView.updateCurrentEventTime(value); | |
68 | } | |
69 | } | |
70 | ||
71 | } |