| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2013, 2014 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 | * Patrick Tasse - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.tracecompass.tmf.ui.views.histogram; |
| 14 | |
| 15 | import org.eclipse.swt.widgets.Composite; |
| 16 | |
| 17 | /** |
| 18 | * Text control for selection start time |
| 19 | */ |
| 20 | public class HistogramSelectionStartControl extends HistogramCurrentTimeControl { |
| 21 | |
| 22 | /** |
| 23 | * Standard constructor |
| 24 | * |
| 25 | * @param parentView A parent histogram view |
| 26 | * @param parent A parent composite to draw in |
| 27 | * @param label A label |
| 28 | * @param value A value |
| 29 | */ |
| 30 | public HistogramSelectionStartControl(HistogramView parentView, Composite parent, String label, long value) { |
| 31 | super(parentView, parent, label, value); |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | protected void updateSelectionTime(long time) { |
| 36 | if (fParentView.getLinkState()) { |
| 37 | fParentView.updateSelectionTime(time, time); |
| 38 | } else { |
| 39 | long begin = Math.min(time, fParentView.getSelectionEnd()); |
| 40 | long end = Math.max(time, fParentView.getSelectionEnd()); |
| 41 | fParentView.updateSelectionTime(begin, end); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | } |