Mercurial > projects > dbus-d
comparison dbus-d-javatests/jsrc/filetree/FileTreeContentProvider.java @ 0:a5576806d36d
recreate repository without any libs for lightweight repository
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 20 Oct 2007 18:07:18 +0200 |
parents | |
children | 65fb7ef02c50 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a5576806d36d |
---|---|
1 package filetree; | |
2 | |
3 import java.io.File; | |
4 | |
5 import org.eclipse.jface.viewers.ITreeContentProvider; | |
6 import org.eclipse.jface.viewers.Viewer; | |
7 | |
8 /** | |
9 * This class provides the content for the tree in FileTree | |
10 */ | |
11 | |
12 class FileTreeContentProvider implements ITreeContentProvider { | |
13 /** | |
14 * Gets the children of the specified object | |
15 * | |
16 * @param arg0 | |
17 * the parent object | |
18 * @return Object[] | |
19 */ | |
20 public Object[] getChildren(Object arg0) { | |
21 // Return the files and subdirectories in this directory | |
22 return ((DataItem) arg0).getChilds(); | |
23 } | |
24 | |
25 /** | |
26 * Gets the parent of the specified object | |
27 * | |
28 * @param arg0 | |
29 * the object | |
30 * @return Object | |
31 */ | |
32 public Object getParent(Object arg0) { | |
33 // Return this file's parent file | |
34 return null;//((DataItem) arg0).getParentFile(); | |
35 } | |
36 | |
37 /** | |
38 * Returns whether the passed object has children | |
39 * | |
40 * @param arg0 | |
41 * the parent object | |
42 * @return boolean | |
43 */ | |
44 public boolean hasChildren(Object arg0) { | |
45 return ((DataItem) arg0).isFolder(); | |
46 } | |
47 | |
48 /** | |
49 * Gets the root element(s) of the tree | |
50 * | |
51 * @param arg0 | |
52 * the input data | |
53 * @return Object[] | |
54 */ | |
55 public Object[] getElements(Object arg0) { | |
56 // These are the root elements of the tree | |
57 // We don't care what arg0 is, because we just want all | |
58 // the root nodes in the file system | |
59 return ((DataFileSystem)arg0).getRoots(); | |
60 } | |
61 | |
62 /** | |
63 * Disposes any created resources | |
64 */ | |
65 public void dispose() { | |
66 // Nothing to dispose | |
67 } | |
68 | |
69 /** | |
70 * Called when the input changes | |
71 * | |
72 * @param arg0 | |
73 * the viewer | |
74 * @param arg1 | |
75 * the old input | |
76 * @param arg2 | |
77 * the new input | |
78 */ | |
79 public void inputChanged(Viewer arg0, Object arg1, Object arg2) { | |
80 // Nothing to change | |
81 } | |
82 } |