Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /********************************************************************** |
ed902a2b | 2 | * Copyright (c) 2012, 2014 Ericsson |
11252342 | 3 | * |
eb1bab5b BH |
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 | |
11252342 AM |
8 | * |
9 | * Contributors: | |
eb1bab5b BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
9bc60be7 | 12 | package org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl; |
eb1bab5b BH |
13 | |
14 | import org.eclipse.jface.viewers.ITreeContentProvider; | |
15 | import org.eclipse.jface.viewers.Viewer; | |
9bc60be7 | 16 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent; |
eb1bab5b BH |
17 | |
18 | /** | |
eb1bab5b BH |
19 | * <p> |
20 | * Tree content provider implementation for trace control view. | |
21 | * </p> | |
11252342 | 22 | * |
dbd4432d | 23 | * @author Bernd Hufmann |
eb1bab5b BH |
24 | */ |
25 | public class TraceControlContentProvider implements ITreeContentProvider { | |
11252342 | 26 | |
eb1bab5b BH |
27 | // ------------------------------------------------------------------------ |
28 | // Operations | |
29 | // ------------------------------------------------------------------------ | |
11252342 | 30 | |
eb1bab5b BH |
31 | @Override |
32 | public void dispose() { | |
33 | } | |
34 | ||
eb1bab5b BH |
35 | @Override |
36 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { | |
37 | } | |
38 | ||
eb1bab5b BH |
39 | @Override |
40 | public Object[] getElements(Object inputElement) { | |
41 | return getChildren(inputElement); | |
42 | } | |
43 | ||
eb1bab5b BH |
44 | @Override |
45 | public Object[] getChildren(Object parentElement) { | |
11252342 | 46 | |
eb1bab5b BH |
47 | if (parentElement instanceof ITraceControlComponent) { |
48 | return ((ITraceControlComponent)parentElement).getChildren(); | |
49 | } | |
50 | return new Object[0]; | |
51 | } | |
52 | ||
eb1bab5b BH |
53 | @Override |
54 | public Object getParent(Object element) { | |
55 | if (element instanceof ITraceControlComponent) { | |
56 | return ((ITraceControlComponent)element).getParent(); | |
57 | } | |
58 | return null; | |
59 | } | |
60 | ||
eb1bab5b BH |
61 | @Override |
62 | public boolean hasChildren(Object element) { | |
63 | if (element instanceof ITraceControlComponent) { | |
64 | return ((ITraceControlComponent)element).hasChildren(); | |
65 | } | |
66 | return false; | |
67 | } | |
68 | } |