~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/view/CovFolderContentProvider.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2009 STMicroelectronics.
 
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
 *    Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.linuxtools.internal.gcov.view;
 
12
 
 
13
 
 
14
import java.util.LinkedList;
 
15
import org.eclipse.jface.viewers.ITreeContentProvider;
 
16
import org.eclipse.jface.viewers.Viewer;
 
17
import org.eclipse.linuxtools.internal.gcov.model.TreeElement;
 
18
import org.eclipse.linuxtools.internal.gcov.parser.CovManager;
 
19
 
 
20
 
 
21
public class CovFolderContentProvider implements ITreeContentProvider {
 
22
        
 
23
        /** Shared instance: this class is implemented as a Singleton */
 
24
        public static final CovFolderContentProvider sharedInstance = new CovFolderContentProvider();
 
25
 
 
26
        
 
27
        protected CovFolderContentProvider(){
 
28
        }
 
29
 
 
30
        public Object[] getChildren(Object parentElement) {
 
31
                TreeElement elem = (TreeElement) parentElement;
 
32
                LinkedList<? extends TreeElement> list = elem.getChildren();
 
33
                if (list != null)
 
34
                        return list.toArray();
 
35
                else return null;
 
36
        }
 
37
 
 
38
        public Object getParent(Object element) {
 
39
                TreeElement elem = (TreeElement) element;
 
40
                return elem.getParent();
 
41
        }
 
42
 
 
43
        public boolean hasChildren(Object element) {
 
44
                TreeElement elem = (TreeElement) element;
 
45
                return elem.hasChildren();
 
46
        }
 
47
 
 
48
        public Object[] getElements(Object inputElement) {
 
49
                if (inputElement == null) return new Object[0];
 
50
                CovManager cvrgMnger = (CovManager)inputElement;
 
51
                return new Object[] {
 
52
                                cvrgMnger.getRootNode() 
 
53
                };
 
54
        }
 
55
 
 
56
        public void dispose() {
 
57
        }
 
58
 
 
59
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 
60
        }       
 
61
}