Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / model / TraceFolderContentProvider.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 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 * Francois Chouinard - Initial API and implementation
11 * Patrick Tasse - Add support for folder elements
12 *******************************************************************************/
13
14 package org.eclipse.linuxtools.tmf.ui.project.model;
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19 import org.eclipse.jface.viewers.IStructuredContentProvider;
20 import org.eclipse.jface.viewers.Viewer;
21
22 /**
23 * Content provider implementation for trace folders for tree viewers that display
24 * the content of a trace folder.
25 * <p>
26 *
27 * @version 1.0
28 * @author Francois Chouinard
29 */
30 public class TraceFolderContentProvider implements IStructuredContentProvider {
31
32 @Override
33 public Object[] getElements(Object inputElement) {
34 if (inputElement instanceof TmfTraceFolder) {
35 TmfTraceFolder folder = (TmfTraceFolder) inputElement;
36 List<ITmfProjectModelElement> elements = new ArrayList<>();
37 for (TmfTraceElement trace : folder.getTraces()) {
38 if (trace.getTraceType() != null) {
39 elements.add(trace);
40 }
41 }
42 return elements.toArray();
43 }
44 return null;
45 }
46
47 @Override
48 public void dispose() {
49 }
50
51 @Override
52 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
53 }
54
55 }
This page took 0.036493 seconds and 5 git commands to generate.