KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > ui > SootConfigContentProvider


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package ca.mcgill.sable.soot.ui;
21
22 import org.eclipse.jface.viewers.ITreeContentProvider;
23 import org.eclipse.jface.viewers.Viewer;
24
25 import ca.mcgill.sable.soot.launching.SootConfiguration;
26 public class SootConfigContentProvider implements ITreeContentProvider {
27
28
29     protected static final Object JavaDoc[] EMPTY_ARRAY = new Object JavaDoc[0];
30
31     
32     /**
33      * Constructor for OptionsTreeContentProvider.
34      */

35     public SootConfigContentProvider() {
36         super();
37     }
38
39     /**
40      * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
41      */

42     public Object JavaDoc[] getChildren(Object JavaDoc parentElement) {
43         if (parentElement instanceof SootConfiguration) {
44             SootConfiguration opt = (SootConfiguration)parentElement;
45             if (opt.getChildren() != null) {
46                 return opt.getChildren().toArray();
47             }
48             else {
49                 return EMPTY_ARRAY;
50             }
51         }
52         else {
53             return EMPTY_ARRAY;
54         }
55         
56     }
57     
58
59     /**
60      * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
61      */

62     public Object JavaDoc getParent(Object JavaDoc element) {
63         return ((SootConfiguration)element).getParent();
64     }
65
66     /**
67      * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
68      */

69     public boolean hasChildren(Object JavaDoc element) {
70         if (element instanceof SootConfiguration) {
71             if (((SootConfiguration)element).getChildren() != null) {
72                 return true;
73             }
74             else {
75                 return false;
76             }
77         }
78         else {
79             return false;
80         }
81     }
82
83     /**
84      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
85      */

86     public Object JavaDoc[] getElements(Object JavaDoc inputElement) {
87         return getChildren(inputElement);
88     }
89
90     /**
91      * @see org.eclipse.jface.viewers.IContentProvider#dispose()
92      */

93     public void dispose() {
94     }
95
96     /**
97      * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
98      */

99     public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
100         
101     }
102
103 }
104
Popular Tags