lttng: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / model / impl / TraceControlContentProvider.java
1 /**********************************************************************
2 * Copyright (c) 2012, 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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl;
13
14 import org.eclipse.jface.viewers.ITreeContentProvider;
15 import org.eclipse.jface.viewers.Viewer;
16 import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent;
17
18 /**
19 * <p>
20 * Tree content provider implementation for trace control view.
21 * </p>
22 *
23 * @author Bernd Hufmann
24 */
25 public class TraceControlContentProvider implements ITreeContentProvider {
26
27 // ------------------------------------------------------------------------
28 // Operations
29 // ------------------------------------------------------------------------
30
31 @Override
32 public void dispose() {
33 }
34
35 @Override
36 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
37 }
38
39 @Override
40 public Object[] getElements(Object inputElement) {
41 return getChildren(inputElement);
42 }
43
44 @Override
45 public Object[] getChildren(Object parentElement) {
46
47 if (parentElement instanceof ITraceControlComponent) {
48 return ((ITraceControlComponent)parentElement).getChildren();
49 }
50 return new Object[0];
51 }
52
53 @Override
54 public Object getParent(Object element) {
55 if (element instanceof ITraceControlComponent) {
56 return ((ITraceControlComponent)element).getParent();
57 }
58 return null;
59 }
60
61 @Override
62 public boolean hasChildren(Object element) {
63 if (element instanceof ITraceControlComponent) {
64 return ((ITraceControlComponent)element).hasChildren();
65 }
66 return false;
67 }
68 }
This page took 0.032018 seconds and 5 git commands to generate.