Commit | Line | Data |
---|---|---|
c392540b FC |
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>HistogramTimeRangeControl</u></b> | |
19 | * <p> | |
20 | * This control provides a group containing a text control. | |
21 | */ | |
22 | public class HistogramTimeRangeControl extends HistogramTextControl { | |
23 | ||
24 | // ------------------------------------------------------------------------ | |
25 | // Construction | |
26 | // ------------------------------------------------------------------------ | |
27 | ||
28 | public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) { | |
29 | this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$ | |
30 | } | |
31 | ||
32 | public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) { | |
33 | super(parentView, parent, textStyle, groupStyle, groupValue, textValue); | |
34 | } | |
35 | ||
36 | // ------------------------------------------------------------------------ | |
37 | // Operations | |
38 | // ------------------------------------------------------------------------ | |
39 | ||
40 | @Override | |
41 | protected void updateValue() { | |
42 | String stringValue = fTextValue.getText(); | |
43 | long value = HistogramUtils.stringToNanoseconds(stringValue); | |
44 | ||
45 | if (getValue() != value) { | |
46 | fParentView.updateTimeRange(value); | |
47 | } | |
48 | } | |
49 | ||
50 | } |