1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
18 import org
.eclipse
.jface
.viewers
.IStructuredContentProvider
;
19 import org
.eclipse
.jface
.viewers
.Viewer
;
22 * Content provider implementation for trace folders for tree viewers that display
23 * the content of a trace folder.
27 * @author Francois Chouinard
29 public class TraceFolderContentProvider
implements IStructuredContentProvider
{
32 public Object
[] getElements(Object inputElement
) {
33 if (inputElement
instanceof TmfTraceFolder
) {
34 TmfTraceFolder folder
= (TmfTraceFolder
) inputElement
;
35 List
<ITmfProjectModelElement
> elements
= new ArrayList
<ITmfProjectModelElement
>();
36 for (ITmfProjectModelElement element
: folder
.getChildren()) {
37 if (element
instanceof TmfTraceElement
) {
38 TmfTraceElement trace
= (TmfTraceElement
) element
;
39 if (trace
.getTraceType() != null) {
44 return elements
.toArray();
50 public void dispose() {
54 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {