try {
fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace();
}
XSimpleFileAccess sfa = (XSimpleFileAccess)
UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc);
XMutableTreeNode xChildNode = null;
try {
xChildNode = mXTreeDataModel.createNode(dir.substring(dir.lastIndexOf("/")+1, dir.length()), sfa.isFolder(dir));
xChildNode.setDataValue(dir);
boolean test = sfa.isFolder(dir);
if (sfa.isFolder(dir)){
xChildNode.setExpandedGraphicURL( "private:graphicrepository/sd/res/triangle_down.png");
xChildNode.setCollapsedGraphicURL("private:graphicrepository/sd/res/triangle_right.png");
String[] children = sfa.getFolderContents(dir, true);
if (children != null){
for (int i=0; i<children.length; i++) {
// Get filename of file or directory
String filename = children[i];
dirlist( filename , xChildNode);