tmf: Bug 499251: Call Stack view double-click listener no longer works
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / widgets / timegraph / widgets / TimeGraphSelection.java
1 /*****************************************************************************
2 * Copyright (c) 2007, 2016 Intel Corporation, Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Intel Corporation - Initial API and implementation
10 * Ruslan A. Scherbakov, Intel - Initial API and implementation
11 * Alvaro Sanchez-Leon - Updated for TMF
12 * Patrick Tasse - Refactoring
13 *****************************************************************************/
14
15 package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets;
16
17 import java.util.ArrayList;
18 import java.util.Iterator;
19 import java.util.List;
20
21 import org.eclipse.jface.viewers.IStructuredSelection;
22 import org.eclipse.jface.viewers.StructuredSelection;
23
24 /**
25 * Selection object for the time graph scale
26 *
27 * @version 1.0
28 * @author Alvaro Sanchez-Leon
29 * @author Patrick Tasse
30 * @deprecated Use {@link StructuredSelection} instead.
31 */
32 @Deprecated
33 public class TimeGraphSelection implements IStructuredSelection {
34
35 private List<Object> list = new ArrayList<>();
36
37 /**
38 * Default constructor
39 */
40 public TimeGraphSelection() {
41 }
42
43 /**
44 * "Wrapper" constructor. Instantiate a new selection object with only one
45 * existing selection.
46 *
47 * @param sel
48 * The initial selection to add to this one
49 */
50 public TimeGraphSelection(Object sel) {
51 if (sel != null) {
52 list.add(sel);
53 }
54 }
55
56 /**
57 * Add a selection to this one.
58 *
59 * @param sel
60 * The selection to add
61 */
62 public void add(Object sel) {
63 if (null != sel && !list.contains(sel)) {
64 list.add(sel);
65 }
66 }
67
68 @Override
69 public Object getFirstElement() {
70 if (!list.isEmpty()) {
71 return list.get(0);
72 }
73 return null;
74 }
75
76 @Override
77 public Iterator<Object> iterator() {
78 return list.iterator();
79 }
80
81 @Override
82 public int size() {
83 return list.size();
84 }
85
86 @Override
87 public Object[] toArray() {
88 return list.toArray();
89 }
90
91 @Override
92 public List<Object> toList() {
93 return list;
94 }
95
96 @Override
97 public boolean isEmpty() {
98 return list.isEmpty();
99 }
100 }
This page took 0.036843 seconds and 5 git commands to generate.