tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / HistogramTimeRangeControl.java
1 /*******************************************************************************
2 * Copyright (c) 2011, 2013 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 * Francois Chouinard - Moved from LTTng to TMF
12 * Francois Chouinard - Simplified constructor, handle interval format change
13 *******************************************************************************/
14
15 package org.eclipse.linuxtools.tmf.ui.views.histogram;
16
17 import java.text.ParseException;
18
19 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
20 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
21 import org.eclipse.linuxtools.tmf.core.signal.TmfTimestampFormatUpdateSignal;
22 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
23 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
24 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
25 import org.eclipse.swt.widgets.Composite;
26
27 /**
28 * This control provides a group containing a text control.
29 *
30 * @version 2.0
31 * @author Francois Chouinard
32 */
33 public class HistogramTimeRangeControl extends HistogramTextControl {
34
35 // ------------------------------------------------------------------------
36 // Construction
37 // ------------------------------------------------------------------------
38
39 /**
40 * Constructor with given group and text values.
41 *
42 * @param parentView The parent histogram view.
43 * @param parent The parent composite
44 * @param groupLabel A group value
45 * @param value A text value
46 * @since 2.0
47 */
48 public HistogramTimeRangeControl(HistogramView parentView, Composite parent,
49 String groupLabel, long value)
50 {
51 super(parentView, parent, groupLabel, value);
52 TmfSignalManager.register(this);
53 }
54
55 @Override
56 public void dispose() {
57 TmfSignalManager.deregister(this);
58 }
59
60 // ------------------------------------------------------------------------
61 // Operations
62 // ------------------------------------------------------------------------
63
64 @Override
65 protected void updateValue() {
66 if (getValue() == Long.MIN_VALUE) {
67 fTextValue.setText(""); //$NON-NLS-1$
68 return;
69 }
70 String string = fTextValue.getText();
71 long value = getValue();
72 try {
73 value = TmfTimestampFormat.getDefaulIntervalFormat().parseValue(string);
74 } catch (ParseException e) {
75 }
76 fParentView.updateTimeRange(value);
77 }
78
79 @Override
80 public void setValue(long time) {
81 if (time != Long.MIN_VALUE) {
82 ITmfTimestamp ts = new TmfTimestamp(time, ITmfTimestamp.NANOSECOND_SCALE);
83 super.setValue(time, ts.toString(TmfTimestampFormat.getDefaulIntervalFormat()));
84 } else {
85 super.setValue(time, ""); //$NON-NLS-1$
86 }
87 }
88
89 // ------------------------------------------------------------------------
90 // Signal Handlers
91 // ------------------------------------------------------------------------
92
93 /**
94 * Format the interval and update the display. Compute the new text size,
95 * adjust the text and group widgets and then refresh the view layout.
96 *
97 * @param signal the incoming signal
98 * @since 2.0
99 */
100 @TmfSignalHandler
101 public void intervalFormatUpdated(TmfTimestampFormatUpdateSignal signal) {
102 setValue(getValue());
103 }
104
105 }
This page took 0.03185 seconds and 5 git commands to generate.