| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2012, 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.widgets.timegraph; |
| 14 | |
| 15 | import java.util.EventObject; |
| 16 | |
| 17 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; |
| 18 | |
| 19 | /** |
| 20 | * Notifier for the time graph that an object in the views has been selected. |
| 21 | * |
| 22 | * @author Patrick Tasse |
| 23 | */ |
| 24 | public class TimeGraphSelectionEvent extends EventObject { |
| 25 | |
| 26 | /** |
| 27 | * Default serial version UID for this class. |
| 28 | */ |
| 29 | private static final long serialVersionUID = 1L; |
| 30 | |
| 31 | /** |
| 32 | * The selected entry. |
| 33 | */ |
| 34 | private final ITimeGraphEntry fSelection; |
| 35 | |
| 36 | /** |
| 37 | * Standard constructor |
| 38 | * |
| 39 | * @param source |
| 40 | * The source of this event |
| 41 | * @param selection |
| 42 | * The entry that was selected |
| 43 | */ |
| 44 | public TimeGraphSelectionEvent(Object source, ITimeGraphEntry selection) { |
| 45 | super(source); |
| 46 | fSelection = selection; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @return the selected entry or null if the selection is empty. |
| 51 | */ |
| 52 | public ITimeGraphEntry getSelection() { |
| 53 | return fSelection; |
| 54 | } |
| 55 | |
| 56 | } |