Import views plugins
[deliverable/tracecompass.git] / tmf / org.lttng.scope.tmf2.views.ui / src / org / lttng / scope / tmf2 / views / ui / timeline / widgets / timegraph / toolbar / ZoomToFullRangeButton.java
CommitLineData
735b1ca2
AM
1/*
2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
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
10package org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.toolbar;
11
12import org.lttng.scope.tmf2.views.core.TimeRange;
13import org.lttng.scope.tmf2.views.ui.jfx.JfxImageFactory;
14import org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.TimeGraphWidget;
15
16import javafx.scene.control.Button;
17import javafx.scene.control.Tooltip;
18import javafx.scene.image.Image;
19import javafx.scene.image.ImageView;
20
21/**
22 * Button to zoom (out) to the full trace's range.
23 *
24 * @author Alexandre Montplaisir
25 */
26class ZoomToFullRangeButton extends Button {
27
28 private static final String ZOOM_TO_FULL_RANGE_ICON_PATH = "/icons/toolbar/zoom_full.gif"; //$NON-NLS-1$
29
30 public ZoomToFullRangeButton(TimeGraphWidget viewer) {
31 Image icon = JfxImageFactory.instance().getImageFromResource(ZOOM_TO_FULL_RANGE_ICON_PATH);
32 setGraphic(new ImageView(icon));
33 setTooltip(new Tooltip(Messages.sfZoomToFullRangeActionDescription));
34 setOnAction(e -> {
35 TimeRange fullRange = viewer.getControl().getViewContext().getCurrentTraceFullRange();
36 viewer.getControl().updateVisibleTimeRange(fullRange, true);
37 });
38 }
39}
This page took 0.026547 seconds and 5 git commands to generate.