comparison jface/FileTreeViewer.d @ 63:59ae5360d98f

use FileRoots
author Frank Benoit <benoit@tionex.de>
date Fri, 11 Apr 2008 17:26:31 +0200
parents caaf053c44d6
children a84ba4d1820f
comparison
equal deleted inserted replaced
62:caaf053c44d6 63:59ae5360d98f
99 } 99 }
100 } 100 }
101 101
102 class FileTreeContentProvider : ITreeContentProvider { 102 class FileTreeContentProvider : ITreeContentProvider {
103 public override Object[] getChildren( Object arg0 ){ 103 public override Object[] getChildren( Object arg0 ){
104 Trace.formatln( "trc line={} ", __LINE__ );
105 try{ 104 try{
106 auto fp = cast(FilePath)arg0; 105 auto fp = cast(FilePath)arg0;
107 Object[] res; 106 Object[] res;
108 if( !fp.isFolder()) { 107 if( !fp.isFolder()) {
109 return null; 108 return null;
110 } 109 }
111 foreach( item; fp ){ 110 foreach( item; fp ){
112 res ~= FilePath.from( item ); 111 res ~= FilePath.from( item );
113 } 112 }
114 113
115 Trace.formatln( "trc line={} ", __LINE__ );
116 return res; 114 return res;
117 } 115 }
118 catch( Exception e ){ 116 catch( Exception e ){
119 ExceptionPrintStackTrace(e); 117 ExceptionPrintStackTrace(e);
120 return null; 118 return null;
121 } 119 }
122 } 120 }
123 121
124 public override Object getParent(Object arg0 ){ 122 public override Object getParent(Object arg0 ){
125 Trace.formatln( "trc line={} ", __LINE__ );
126 auto fp = cast(FilePath)arg0; 123 auto fp = cast(FilePath)arg0;
127 return fp.pop; 124 return fp.pop;
128 } 125 }
129 126
130 public override bool hasChildren(Object arg0 ){ 127 public override bool hasChildren(Object arg0 ){
131 Trace.formatln( "trc line={} ", __LINE__ );
132 auto obj = getChildren(arg0); 128 auto obj = getChildren(arg0);
133 return obj is null ? false : obj.length > 0; 129 return obj is null ? false : obj.length > 0;
134 } 130 }
135 131
136 public override Object[] getElements( Object arg0 ){ 132 public override Object[] getElements( Object arg0 ){
137 Trace.formatln( "trc line={} ", __LINE__ );
138 Object[] res; 133 Object[] res;
139 res ~= new FilePath( "/" ); 134
140 // foreach( root; FileRoots.list()){ 135 foreach( root; FileRoots.list()){
141 // res ~= new FilePath( root ); 136 res ~= new FilePath( root );
142 // } 137 }
138
143 return res; 139 return res;
144 } 140 }
145 141
146 public override void dispose(){ 142 public override void dispose(){
147 } 143 }