KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > internal > ui > refactoring > ChangeElementContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
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  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ltk.internal.ui.refactoring;
12
13 import org.eclipse.jface.viewers.ITreeContentProvider;
14 import org.eclipse.jface.viewers.Viewer;
15
16 /**
17  * A default content provider to present a hierarchy of <code>IChange</code>
18  * objects in a tree viewer.
19  */

20 class ChangeElementContentProvider implements ITreeContentProvider {
21     
22     /* non Java-doc
23      * @see ITreeContentProvider#inputChanged
24      */

25     public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
26         // do nothing
27
}
28     
29     /* non Java-doc
30      * @see ITreeContentProvider#getChildren
31      */

32     public Object JavaDoc[] getChildren(Object JavaDoc o) {
33         PreviewNode element= (PreviewNode)o;
34         return element.getChildren();
35     }
36     
37     /* non Java-doc
38      * @see ITreeContentProvider#getParent
39      */

40     public Object JavaDoc getParent(Object JavaDoc element){
41         return ((PreviewNode)element).getParent();
42     }
43     
44     /* non Java-doc
45      * @see ITreeContentProvider#hasChildren
46      */

47     public boolean hasChildren(Object JavaDoc element){
48         Object JavaDoc[] children= getChildren(element);
49         return children != null && children.length > 0;
50     }
51     
52     /* non Java-doc
53      * @see ITreeContentProvider#dispose
54      */

55     public void dispose(){
56     }
57     
58     /* non Java-doc
59      * @see ITreeContentProvider#getElements
60      */

61     public Object JavaDoc[] getElements(Object JavaDoc element){
62         return getChildren(element);
63     }
64 }
65
Popular Tags